Rename 'doSerializeConfig' to 'configNeedsWrite'

Clarify the name and usage of this flag, as the function name has
changed out from underneath it.
This commit is contained in:
Will Miles 2025-03-23 15:16:52 -04:00
parent e21a09cec9
commit 9c8f8c645e
7 changed files with 11 additions and 11 deletions

View File

@ -704,7 +704,7 @@ void serializeConfigToFS() {
f.close();
releaseJSONBufferLock();
doSerializeConfig = false;
configNeedsWrite = false;
}
void serializeConfig(JsonObject root) {

View File

@ -22,7 +22,7 @@ void rdmPersonalityChangedCb(dmx_port_t dmxPort, const rdm_header_t *header,
if (header->cc == RDM_CC_SET_COMMAND_RESPONSE) {
const uint8_t personality = dmx_get_current_personality(dmx->inputPortNum);
DMXMode = std::min(DMX_MODE_PRESET, std::max(DMX_MODE_SINGLE_RGB, int(personality)));
doSerializeConfig = true;
configNeedsWrite = true;
DEBUG_PRINTF("DMX personality changed to to: %d\n", DMXMode);
}
}
@ -40,7 +40,7 @@ void rdmAddressChangedCb(dmx_port_t dmxPort, const rdm_header_t *header,
if (header->cc == RDM_CC_SET_COMMAND_RESPONSE) {
const uint16_t addr = dmx_get_start_address(dmx->inputPortNum);
DMXAddress = std::min(512, int(addr));
doSerializeConfig = true;
configNeedsWrite = true;
DEBUG_PRINTF("DMX start addr changed to: %d\n", DMXAddress);
}
}

View File

@ -242,7 +242,7 @@ void savePreset(byte index, const char* pname, JsonObject sObj)
if (!sObj[FPSTR(bootPS)].isNull()) {
bootPreset = sObj[FPSTR(bootPS)] | bootPreset;
sObj.remove(FPSTR(bootPS));
doSerializeConfig = true;
configNeedsWrite = true;
}
if (sObj.size()==0 || sObj["o"].isNull()) { // no "o" means not a playlist or custom API call, saving of state is async (not immediately)

View File

@ -805,8 +805,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
lastEditTime = millis();
// do not save if factory reset or LED settings (which are saved after LED re-init)
doSerializeConfig = subPage != SUBPAGE_LEDS && !(subPage == SUBPAGE_SEC && doReboot);
if (subPage == SUBPAGE_UM) doReboot = request->hasArg(F("RBT")); // prevent race condition on dual core system (set reboot here, after doSerializeConfig has been set)
configNeedsWrite = subPage != SUBPAGE_LEDS && !(subPage == SUBPAGE_SEC && doReboot);
if (subPage == SUBPAGE_UM) doReboot = request->hasArg(F("RBT")); // prevent race condition on dual core system (set reboot here, after configNeedsWrite has been set)
#ifndef WLED_DISABLE_ALEXA
if (subPage == SUBPAGE_SYNC) alexaInit();
#endif

View File

@ -193,14 +193,14 @@ void WLED::loop()
if (aligned) strip.makeAutoSegments();
else strip.fixInvalidSegments();
BusManager::setBrightness(bri); // fix re-initialised bus' brightness
doSerializeConfig = true;
configNeedsWrite = true;
}
if (loadLedmap >= 0) {
strip.deserializeMap(loadLedmap);
loadLedmap = -1;
}
yield();
if (doSerializeConfig) serializeConfigToFS();
if (configNeedsWrite) serializeConfigToFS();
yield();
handleWs();
@ -223,7 +223,7 @@ void WLED::loop()
}
#endif
if (doReboot && (!doInitBusses || !doSerializeConfig)) // if busses have to be inited & saved, wait until next iteration
if (doReboot && (!doInitBusses || !configNeedsWrite)) // if busses have to be inited & saved, wait until next iteration
reset();
// DEBUG serial logging (every 30s)

View File

@ -877,7 +877,7 @@ WLED_GLOBAL byte errorFlag _INIT(0);
WLED_GLOBAL String messageHead, messageSub;
WLED_GLOBAL byte optionType;
WLED_GLOBAL bool doSerializeConfig _INIT(false); // flag to initiate saving of config
WLED_GLOBAL bool configNeedsWrite _INIT(false); // flag to initiate saving of config
WLED_GLOBAL bool doReboot _INIT(false); // flag to initiate reboot from async handlers
WLED_GLOBAL bool psramSafe _INIT(true); // is it safe to use PSRAM (on ESP32 rev.1; compiler fix used "-mfix-esp32-psram-cache-issue")

View File

@ -328,7 +328,7 @@ void initServer()
interfaceUpdateCallMode = CALL_MODE_WS_SEND; // schedule WS update
serveJson(request); return; //if JSON contains "v"
} else {
doSerializeConfig = true; //serializeConfig(); //Save new settings to FS
configNeedsWrite = true; //Save new settings to FS
}
}
request->send(200, CONTENT_TYPE_JSON, F("{\"success\":true}"));