Skip to content

Flash SPIFFS over the air (OTA) #802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 28, 2015
Merged

Flash SPIFFS over the air (OTA) #802

merged 7 commits into from
Sep 28, 2015

Conversation

pgollor
Copy link
Contributor

@pgollor pgollor commented Sep 18, 2015

I updated the espota.py, the UpdaterClass and added an example sketch: OTA-MDNS-SPIFFS

I did some tests with Ubuntu 14.04 (python version 2.7) and a generic ESP8266-01 module with 1M64k:

  • Flashing sketch over console with espota.py
  • Flashing sketch with the current ESP8622 Arduino version.
  • Flashing SPIFFS image over console with espota.py

All test work successfully but it has to be tested with another OS and someone has to be update the esp8266fs.jar to upgrade the SPIFFS image over the air if this options is active.

espota.py changes:

  • Add option parser.
  • Add logging.
  • Send command to controller to differ between flash image and SPIFFS image.

Please feel free to post your test results here. Tanks!

@igrr
Copy link
Member

igrr commented Sep 28, 2015

May I suggest to update the example to acknowledge the fact that SDK will automatically reconnect to the last used WiFi network? We only need to call WiFi.begin() if there was a change to SSID/password. Otherwise this leads to rewriting SDK config sectors on every boot.

@pgollor
Copy link
Contributor Author

pgollor commented Sep 28, 2015

Your idea is great but i had to add two functions to the ESP8266WiFi class:

  • begin(): To start connecting without new parameters.
  • psk() : To read the pre shared key from sdk configuration.

I tried it multiple times without calling WiFi.begin(...). But WiFi.status() returns always WL_IDLE_STATUS (0) and the esp8266 didn't connect to the AP are stored in the sdk configuration. I checked the sdk config with WiFi.printDiag(Serial); for right parameters.

So I hope that you are able to understand my explanation in english ;) and you are to agree with my solution?

@igrr
Copy link
Member

igrr commented Sep 28, 2015

Adding begin() and psk() is a good idea. This has been requested in other tickets.
I think we need to look at the overall logic of WiFi class, i.e. how switching between STA/AP modes should work. But it is a separate task...
I will merge this pull request now, and let's update the sample once these new functions are added.

@igrr igrr closed this Sep 28, 2015
@igrr igrr reopened this Sep 28, 2015
igrr added a commit that referenced this pull request Sep 28, 2015
Flash SPIFFS over the air (OTA)
@igrr igrr merged commit 119512d into esp8266:esp8266 Sep 28, 2015
@igrr
Copy link
Member

igrr commented Sep 28, 2015

It might be worth changing psk (and SSID()) function to return a String rather than char*, because I think users might make the following error:

const char* ssid = "adasdasd";
const char* psk = "23801380123";
...
if (WiFi.ssid() != ssid || WiFi.psk() != psk) { ... }

I.e. this will result in pointer comparison rather than string comparison.

@chrisfraser
Copy link
Contributor

I agree. Needing to do a strcmp is going to confuse some users.

if (strcmp(WiFi.ssid(), ssid) == 0 && strcmp(WiFi. psk(), psk) == 0){ ... }

How about internally doing this check in begin(ssid, psk) before rewriting the sector?

@pgollor
Copy link
Contributor Author

pgollor commented Sep 29, 2015

i will add string return functions in a few days.

igrr added a commit that referenced this pull request Sep 29, 2015
Sorry i added maginal changes after your merge from #802
igrr added a commit that referenced this pull request Oct 29, 2015
Flash SPIFFS over the air (OTA)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants