Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By picstart
#77713 So far my projects using OTA have worked. Now OTA consumes CPU cycles and the OTA handle must be called frequently so watch out for delay(xx) statements and any other code that might be blocking OTA and not giving OTA the cycles it needs. I'm unsure what might happen if the OTA is starved it should just fail or freeze during the upload but potentially your Spiffs is active and it gets impacted. Often you wrap a long delay(xx) as many smaller ones with a call to OTA before each small delay.
User avatar
By JimDrew
#77717 My code is about as simple as it gets. There are no "delays" required. You just call the update command with a path to the new firmware to flash and it returns with an error or success. This has worked perfectly for a couple of years, but I have never had a SPIFFS setup before.

Code: Select all#include <ESP8266httpUpdate.h>

  t_httpUpdate_return ret = ESPhttpUpdate.update("http://www.urlpath.com/subpath/update.bin");

  switch (ret) {
    case HTTP_UPDATE_FAILED:
      Serial.printf("Update failed! - %s", ESPhttpUpdate.getLastErrorString().c_str());
      Serial.println();
      break;

    case HTTP_UPDATE_NO_UPDATES:
      Serial.println("Latest firmware is already installed!");
      Serial.println();
      break;

    case HTTP_UPDATE_OK:
      Serial.println("Update complete - rebooting!");
      Serial.println();
      delay(2000);
      ESP.Restart();
      break;
  }
}


Is there a known problem using a 3M SPIFFS partition? I am going to try a 1M partition (which is not big enough for my application) to see if that somehow works. Maybe there is bug that wipes out the 1st 2M or something?
User avatar
By btidey
#77724 I've used 1M, 2M, 3M SPIFFS and OTA without issue.

I use the browser OTA method rather than the ESPhttpUpdate.update method so there may be some difference there.