Skip to content

Commit

Permalink
Fix example for ESP8266httpUpdate (esp8266#2251)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
sk1tt1sh authored and igrr committed Jul 18, 2016
1 parent 3f1ab1f commit 9c36ff9
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -41,14 +41,14 @@ void loop() {
if((WiFiMulti.run() == WL_CONNECTED)) {

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) {
USE_SERIAL.println("Update sketch...");
ret = ESPhttpUpdate.update("https://server/file.bin");
ret = ESPhttpUpdate.update("http://server/file.bin");

switch(ret) {
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;

case HTTP_UPDATE_NO_UPDATES:
2 changes: 1 addition & 1 deletion libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp
Original file line number Diff line number Diff line change
@@ -297,7 +297,7 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
DEBUG_HTTP_UPDATE("[httpUpdate] Update ok\n");
http.end();

if(_rebootOnUpdate) {
if(_rebootOnUpdate && !spiffs) {
ESP.restart();
}

0 comments on commit 9c36ff9

Please sign in to comment.