diff --git a/GitOTA.cpp b/GitOTA.cpp index 2a936a8..5c8d168 100644 --- a/GitOTA.cpp +++ b/GitOTA.cpp @@ -259,9 +259,11 @@ void GitUpdater::loop() { } else if(this->status == GIT_UPDATE_CANCELLING) { Serial.println("Cancelling update process.........."); - this->status = GIT_UPDATE_CANCELLED; - this->emitUpdateCheck(); - this->cancelled = true; + if(!this->lockFS) { + this->status = GIT_UPDATE_CANCELLED; + this->cancelled = true; + this->emitUpdateCheck(); + } } } void GitUpdater::checkForUpdate() { @@ -382,7 +384,7 @@ bool GitUpdater::beginUpdate(const char *version) { this->emitUpdateCheck(); this->setFirmwareFile(); this->partition = U_FLASH; - this->cancelled = false; + this->lockFS = this->cancelled = false; this->error = 0; this->error = this->downloadFile(); if(this->error == 0 && !this->cancelled) { @@ -457,7 +459,7 @@ int8_t GitUpdater::downloadFile() { while(https.connected() && (len > 0 || len == -1) && total < len) { size_t size = stream->available(); if(size) { - if(this->cancelled) { + if(this->cancelled && !this->lockFS) { Update.abort(); https.end(); free(buff); diff --git a/GitOTA.h b/GitOTA.h index cf4cf29..98aa5b7 100644 --- a/GitOTA.h +++ b/GitOTA.h @@ -39,6 +39,7 @@ class GitRepo { class GitUpdater { public: bool lockFS = false; + bool canCancel = true; uint8_t status = 0; uint32_t lastCheck = 0; bool updateAvailable = false; diff --git a/SomfyController.ino.esp32.bin b/SomfyController.ino.esp32.bin index a46d72e..bd56edc 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 2ee775e..980c5d4 100644 Binary files a/SomfyController.ino.esp32s3.bin and b/SomfyController.ino.esp32s3.bin differ diff --git a/SomfyController.littlefs.bin b/SomfyController.littlefs.bin index cf4e92b..6edcb7e 100644 Binary files a/SomfyController.littlefs.bin and b/SomfyController.littlefs.bin differ diff --git a/Web.cpp b/Web.cpp index 1b83958..6e0614c 100644 --- a/Web.cpp +++ b/Web.cpp @@ -1090,9 +1090,11 @@ void Web::begin() { if(server.method() == HTTP_OPTIONS) { server.send(200, "OK"); return; } DynamicJsonDocument sdoc(512); JsonObject sobj = sdoc.to(); - git.status = GIT_UPDATE_CANCELLING; - git.toJSON(sobj); - git.cancelled = true; + if(!git.lockFS) { + git.status = GIT_UPDATE_CANCELLING; + git.toJSON(sobj); + git.cancelled = true; + } serializeJson(sdoc, g_content); server.send(200, _encoding_json, g_content); }); diff --git a/data/index.html b/data/index.html index f8180cb..c046129 100644 --- a/data/index.html +++ b/data/index.html @@ -3,11 +3,11 @@ - - - + + + - +
diff --git a/data/index.js b/data/index.js index 859abc1..1f5abb4 100644 --- a/data/index.js +++ b/data/index.js @@ -4277,6 +4277,9 @@ class Firmware { // Update the status on the client that started the install. if (pct >= 100 && prog.part === 100) git.remove(); else { + if (prog.part === 100) { + document.getElementById('btnCancelUpdate').style.display = 'none'; + } let p = prog.part === 100 ? document.getElementById('progApplicationDownload') : document.getElementById('progFirmwareDownload'); if (p) { p.style.setProperty('--progress', `${pct}%`); @@ -4306,7 +4309,7 @@ class Firmware { else { general.reloadApp = true; // Change the display and allow the percentage to be shown when the socket emits the progress. - let html = `
Installing ${ver.name}
Please wait as the files are downloaded and installed.
`; + let html = `
Installing ${ver.name}
Please wait as the files are downloaded and installed. Once the application update process starts you may no longer cancel the update as this will corrupt the downloaded files.
`; html += `
`; html += ``; html += `
`;