diff --git a/user/cgi_persist.c b/user/cgi_persist.c index 7f2faac..667baaa 100644 --- a/user/cgi_persist.c +++ b/user/cgi_persist.c @@ -67,7 +67,9 @@ cgiPersistRestoreHard(HttpdConnData *connData) return HTTPD_CGI_DONE; } - persist_restore_hard_default(); + // this only changes live settings (and persists it) + // Defaults are not changed. + persist_load_hard_default(); httpdRedirect(connData, SET_REDIR_SUC); return HTTPD_CGI_DONE; diff --git a/user/persist.c b/user/persist.c index c1b7541..c521ee9 100644 --- a/user/persist.c +++ b/user/persist.c @@ -99,7 +99,7 @@ persist_load(void) } if (hard_reset) { - persist_restore_hard_default(); + persist_load_hard_default(); // this also stores them to flash and applies to modules } else { apply_live_settings(); @@ -127,18 +127,18 @@ persist_store(void) * Restore to built-in defaults */ void ICACHE_FLASH_ATTR -persist_restore_hard_default(void) +persist_load_hard_default(void) { - info("[Persist] Restoring all settings to hard defaults..."); + info("[Persist] Restoring live settings to hard defaults..."); // Set live config to default values restore_live_settings_to_hard_defaults(); - - // Store current -> default - memcpy(&persist.defaults, &persist.current, sizeof(AppConfigBundle)); persist_store(); - info("[Persist] All settings restored to hard defaults."); +// // Store current -> default +// memcpy(&persist.defaults, &persist.current, sizeof(AppConfigBundle)); + + info("[Persist] Settings restored to hard defaults."); apply_live_settings(); // apply } diff --git a/user/persist.h b/user/persist.h index be334e4..c5b6b87 100644 --- a/user/persist.h +++ b/user/persist.h @@ -47,7 +47,7 @@ typedef struct { extern PersistBlock persist; void persist_load(void); -void persist_restore_hard_default(void); +void persist_load_hard_default(void); void persist_restore_default(void); void persist_set_as_default(void); void persist_store(void);