Skip to content

Commit fc0d64e

Browse files
committed
Fix for wled#4752
1 parent 7b0075d commit fc0d64e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

wled00/cfg.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,15 +775,15 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
775775

776776
static 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

801801
void serializeConfigToFS() {

wled00/fcn_declare.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void IRAM_ATTR touchButtonISR();
2525

2626
//cfg.cpp
2727
bool deserializeConfig(JsonObject doc, bool fromFS = false);
28-
void deserializeConfigFromFS();
28+
bool deserializeConfigFromFS();
2929
bool deserializeConfigSec();
3030
void serializeConfig(JsonObject doc);
3131
void serializeConfigToFS();

wled00/wled.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)