Fix bootloop if config missing/reset

Can't reset the config if there's nothing to reset!
This commit is contained in:
Will Miles
2025-08-19 19:01:33 -04:00
parent 501b6e7de5
commit 79762f45b2

View File

@@ -651,13 +651,16 @@ bool verifyConfig() {
}
// rename config file and reboot
// if the file doesn't exist, such as after a reset, do nothing
void resetConfig() {
DEBUG_PRINTLN(F("Reset config"));
char backupname[32];
strcpy(backupname, s_cfg_json);
strcat(backupname, ".rst.json");
WLED_FS.rename(s_cfg_json, backupname);
doReboot = true;
if (WLED_FS.exists(s_cfg_json)) {
DEBUG_PRINTLN(F("Reset config"));
char backupname[32];
strcpy(backupname, s_cfg_json);
strcat(backupname, ".rst.json");
WLED_FS.rename(s_cfg_json, backupname);
doReboot = true;
}
}
bool deserializeConfigFromFS() {