Hi everyone,
i successfully made a webserver than distributes firmware updates for my nodes, and I now added the function to update spiffs file as well.
All goes ok during the update, my webserver returns a filename called GlobalCloudSettings.json and the httpupdate returns ok and reboots after.
My problem is that now i can't find the file on my nodeMCU, even though debug says everything was ok.
this is the code for the update:
bool actualUpdate(bool sketch=false)
{
String msg;
t_httpUpdate_return ret;
Serial.println("AUTOMATIC UPDATES: Checking for updates...");
ESPhttpUpdate.rebootOnUpdate(false);
if(sketch)
ret=ESPhttpUpdate.update(updateUrl,updateUrlPort,updateUrlPath,FIRMWARE_VERSION); // **************** This is the line that "does the business"
else
ret=ESPhttpUpdate.updateSpiffs(updateSpiffsUrl,SPIFFS_VERSION);
if(ret!=HTTP_UPDATE_NO_UPDATES)
{
if(ret==HTTP_UPDATE_OK)
{
Serial.println(F("AUTOMATIC UPDATES: Update succeeded! Device will now restart."));
return true;
}
else
{
if(ret==HTTP_UPDATE_FAILED)
Serial.println(F("AUTOMATIC UPDATES: Update failed!"));
}
}
else
Serial.println(F("AUTOMATIC UPDATES: No new updates were found."));
return false;
}
then after update i call this method:
void checkFile()
{
if (SPIFFS.begin())
{
if (SPIFFS.exists("/globalCloudSettings.json"))
{
Serial.println("HURRAYYYYYYYYYYYYYYYYY!!");
}
}
code never enters in the if, meaning the file doesn't exists. I wonder how the httpupdate works, if my webserver returns a file called globalCloudSettings.json, does the httpupdate write the file in the spiffs with the same name?