File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -775,15 +775,15 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
775775
776776static const char s_cfg_json[] PROGMEM = " /cfg.json" ;
777777
778- void deserializeConfigFromFS () {
778+ bool deserializeConfigFromFS () {
779779 [[maybe_unused]] bool success = deserializeConfigSec ();
780780 #ifdef WLED_ADD_EEPROM_SUPPORT
781781 if (!success) { // if file does not exist, try reading from EEPROM
782782 deEEPSettings ();
783783 }
784784 #endif
785785
786- if (!requestJSONBufferLock (1 )) return ;
786+ if (!requestJSONBufferLock (1 )) return false ;
787787
788788 DEBUG_PRINTLN (F (" Reading settings from /cfg.json..." ));
789789
@@ -795,7 +795,7 @@ void deserializeConfigFromFS() {
795795 bool needsSave = deserializeConfig (root, true );
796796 releaseJSONBufferLock ();
797797
798- if ( needsSave) serializeConfigToFS (); // usermods required new parameters
798+ return needsSave;
799799}
800800
801801void serializeConfigToFS () {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ void IRAM_ATTR touchButtonISR();
2525
2626// cfg.cpp
2727bool deserializeConfig (JsonObject doc, bool fromFS = false );
28- void deserializeConfigFromFS ();
28+ bool deserializeConfigFromFS ();
2929bool deserializeConfigSec ();
3030void serializeConfig (JsonObject doc);
3131void serializeConfigToFS ();
Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ void WLED::setup()
423423 multiWiFi.push_back (WiFiConfig (CLIENT_SSID,CLIENT_PASS)); // initialise vector with default WiFi
424424
425425 DEBUG_PRINTLN (F (" Reading config" ));
426- deserializeConfigFromFS ();
426+ bool needsCfgSave = deserializeConfigFromFS ();
427427 DEBUG_PRINTF_P (PSTR (" heap %u\n " ), ESP.getFreeHeap ());
428428
429429#if defined(STATUSLED) && STATUSLED>=0
@@ -443,6 +443,8 @@ void WLED::setup()
443443 UsermodManager::setup ();
444444 DEBUG_PRINTF_P (PSTR (" heap %u\n " ), ESP.getFreeHeap ());
445445
446+ if (needsCfgSave) serializeConfigToFS (); // usermods required new parameters; need to wait for strip to be initialised #4752
447+
446448 if (strcmp (multiWiFi[0 ].clientSSID , DEFAULT_CLIENT_SSID) == 0 )
447449 showWelcomePage = true ;
448450 WiFi.persistent (false );
You can’t perform that action at this time.
0 commit comments