diff --git a/GitOTA.cpp b/GitOTA.cpp index ff16fba..791f6a5 100644 --- a/GitOTA.cpp +++ b/GitOTA.cpp @@ -44,6 +44,10 @@ void GitRelease::setAssetProperty(const char *key, const char *val) { if(strlen(this->hwVersions)) strcat(this->hwVersions, ","); strcat(this->hwVersions, "s3"); } + else if(strstr(val, "ino.esp32s2.bin")) { + if(strlen(this->hwVersions)) strcat(this->hwVersions, ","); + strcat(this->hwVersions, "s2"); + } else if(strstr(val, "ino.esp32c3.bin")) { if(strlen(this->hwVersions)) strcat(this->hwVersions, ","); strcat(this->hwVersions, "c3"); @@ -391,6 +395,7 @@ bool GitUpdater::beginUpdate(const char *version) { bool GitUpdater::recoverFilesystem() { sprintf(this->baseUrl, "https://github.com/rstrouse/ESPSomfy-RTS/releases/download/%s/", settings.fwVersion.name); strcpy(this->currentFile, "SomfyController.littlefs.bin"); + this->status = GIT_UPDATING; this->partition = U_SPIFFS; this->lockFS = true; this->error = this->downloadFile(); @@ -400,6 +405,7 @@ bool GitUpdater::recoverFilesystem() { Serial.println("Committing Configuration..."); somfy.commit(); } + this->status = GIT_UPDATE_COMPLETE; rebootDelay.reboot = true; rebootDelay.rebootTime = millis() + 500; return true; diff --git a/GitOTA.h b/GitOTA.h index 360fce4..cf4cf29 100644 --- a/GitOTA.h +++ b/GitOTA.h @@ -13,6 +13,7 @@ #define GIT_UPDATE_COMPLETE 4 #define GIT_UPDATE_CANCELLING 5 #define GIT_UPDATE_CANCELLED 6 + class GitRelease { public: uint64_t id = 0; diff --git a/SomfyController.ino.esp32.bin b/SomfyController.ino.esp32.bin index 2c2f9c1..6b4edba 100644 Binary files a/SomfyController.ino.esp32.bin and b/SomfyController.ino.esp32.bin differ diff --git a/SomfyController.ino.esp32s3.bin b/SomfyController.ino.esp32s3.bin index 7642c72..aa81fe3 100644 Binary files a/SomfyController.ino.esp32s3.bin and b/SomfyController.ino.esp32s3.bin differ diff --git a/Web.cpp b/Web.cpp index a8fa582..62a8004 100644 --- a/Web.cpp +++ b/Web.cpp @@ -2449,8 +2449,14 @@ void Web::begin() { server.on("/recoverFilesystem", [] () { if(server.method() == HTTP_OPTIONS) { server.send(200, "OK"); return; } webServer.sendCORSHeaders(server); - git.recoverFilesystem(); - server.send(200, "application/json", "{\"status\":\"OK\",\"desc\":\"Recovering filesystem from github please wait!!!\"}"); + if(git.status == GIT_UPDATING) + server.send(200, "application/json", "{\"status\":\"OK\",\"desc\":\"Filesystem is updating. Please wait!!!\"}"); + else if(git.status != GIT_STATUS_READY) + server.send(200, "application/json", "{\"status\":\"ERROR\",\"desc\":\"Cannot recover file system at this time.\"}"); + else { + git.recoverFilesystem(); + server.send(200, "application/json", "{\"status\":\"OK\",\"desc\":\"Recovering filesystem from github please wait!!!\"}"); + } }); server.begin(); apiServer.begin();