1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Fix example for ESP8266httpUpdate (#2251)

* Fix minor typo in spelling of failed. Removed s from http paths.

* add check if we are just updating spiffs to not reboot. example now works with this change.
This commit is contained in:
sk1tt1sh 2016-07-18 05:33:34 -06:00 committed by Ivan Grokhotkov
parent 3f1ab1fd81
commit 9c36ff9932
2 changed files with 4 additions and 4 deletions

View File

@ -41,14 +41,14 @@ void loop() {
if((WiFiMulti.run() == WL_CONNECTED)) { if((WiFiMulti.run() == WL_CONNECTED)) {
USE_SERIAL.println("Update SPIFFS..."); USE_SERIAL.println("Update SPIFFS...");
t_httpUpdate_return ret = ESPhttpUpdate.updateSpiffs("https://server/spiffs.bin"); t_httpUpdate_return ret = ESPhttpUpdate.updateSpiffs("http://server/spiffs.bin");
if(ret == HTTP_UPDATE_OK) { if(ret == HTTP_UPDATE_OK) {
USE_SERIAL.println("Update sketch..."); USE_SERIAL.println("Update sketch...");
ret = ESPhttpUpdate.update("https://server/file.bin"); ret = ESPhttpUpdate.update("http://server/file.bin");
switch(ret) { switch(ret) {
case HTTP_UPDATE_FAILED: case HTTP_UPDATE_FAILED:
USE_SERIAL.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str()); USE_SERIAL.printf("HTTP_UPDATE_FAILED Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
break; break;
case HTTP_UPDATE_NO_UPDATES: case HTTP_UPDATE_NO_UPDATES:

View File

@ -297,7 +297,7 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
DEBUG_HTTP_UPDATE("[httpUpdate] Update ok\n"); DEBUG_HTTP_UPDATE("[httpUpdate] Update ok\n");
http.end(); http.end();
if(_rebootOnUpdate) { if(_rebootOnUpdate && !spiffs) {
ESP.restart(); ESP.restart();
} }