fixed some bugs with persistent settings and hard reset
This commit is contained in:
+3
-1
@@ -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;
|
||||
|
||||
+7
-7
@@ -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
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user