Add FS recovery for failed FS updates.

This commit is contained in:
Robert Strouse 2024-01-06 11:28:03 -08:00
parent 2bb23e6d3e
commit a3cb1d63fe
6 changed files with 41 additions and 4 deletions

View file

@ -7,12 +7,14 @@
#include "Sockets.h"
#include "MQTT.h"
#include "ConfigFile.h"
#include "GitOTA.h"
extern Preferences pref;
extern SomfyShadeController somfy;
extern SocketEmitter sockEmit;
extern ConfigSettings settings;
extern MQTTClass mqtt;
extern GitUpdater git;
uint8_t rxmode = 0; // Indicates whether the radio is in receive mode. Just to ensure there isn't more than one interrupt hooked.
@ -545,6 +547,7 @@ bool SomfyShadeController::begin() {
return true;
}
void SomfyShadeController::commit() {
if(git.lockFS) return;
ShadeConfigFile file;
file.begin();
file.save(this);
@ -553,6 +556,7 @@ void SomfyShadeController::commit() {
this->lastCommit = millis();
}
void SomfyShadeController::writeBackup() {
if(git.lockFS) return;
ShadeConfigFile file;
file.begin("/controller.backup", false);
file.backup(this);