mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
Working through git filesystem recovery
This commit is contained in:
parent
a3cb1d63fe
commit
67cd9a3200
5 changed files with 15 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
1
GitOTA.h
1
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;
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
10
Web.cpp
10
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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue