Fix bootloop if config is reset (#4852)

* Fix bootloop if config missing/reset

Can't reset the config if there's nothing to reset!

* ESP8266: Commit ACTIONT_TRACKER

* Use consistent naming for backups and reset cfgs

Use 'rst.cfg.json' instead of 'cfg.json.rst.json' for configs that were
reset.

* Add a little more PSTR to bootloop handling
This commit is contained in:
Will Miles
2025-08-20 01:37:14 -04:00
committed by GitHub
parent dcc1fbc96e
commit 3b5c6ca284
3 changed files with 18 additions and 13 deletions

View File

@@ -787,13 +787,15 @@ bool verifyConfig() {
}
// rename config file and reboot
// if the cfg 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];
snprintf_P(backupname, sizeof(backupname), PSTR("/rst.%s"), &s_cfg_json[1]);
WLED_FS.rename(s_cfg_json, backupname);
doReboot = true;
}
}
bool deserializeConfigFromFS() {