backup with RAM

This commit is contained in:
cjkas 2026-03-13 18:40:34 +01:00
parent 9113e58ec4
commit 2509030c49
9 changed files with 121 additions and 19 deletions

View file

@ -858,14 +858,11 @@ void Web::handleBackup(WebServer &server, bool attach) {
}
Serial.println("Saving current shade information");
somfy.writeBackup();
File file = LittleFS.open("/controller.backup", "r");
if (!file) {
Serial.println("Error opening shades.cfg");
server.send(500, _encoding_text, "shades.cfg");
if(somfy.backupData.length() == 0) {
server.send(500, _encoding_text, "backup failed");
return;
}
server.streamFile(file, _encoding_text);
file.close();
server.send(200, _encoding_text, somfy.backupData);
}
void Web::handleSetPositions(WebServer &server) {
webServer.sendCORSHeaders(server);