mirror of
https://github.com/wled/WLED.git
synced 2025-07-20 17:26:32 +00:00
bugfix: prevent preset loading from resetting other errors
without this fix, any not-yet reported error - like filesystem problems at startup, or out-of-memory - was rest by successfully loading a preset.
This commit is contained in:
parent
e9d2182390
commit
0a97e28aab
@ -143,6 +143,7 @@ void applyPresetWithFallback(uint8_t index, uint8_t callMode, uint8_t effectID,
|
|||||||
|
|
||||||
void handlePresets()
|
void handlePresets()
|
||||||
{
|
{
|
||||||
|
byte presetErrFlag = ERR_NONE;
|
||||||
if (presetToSave) {
|
if (presetToSave) {
|
||||||
strip.suspend();
|
strip.suspend();
|
||||||
doSaveState();
|
doSaveState();
|
||||||
@ -166,14 +167,16 @@ void handlePresets()
|
|||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
if (tmpPreset==255 && tmpRAMbuffer!=nullptr) {
|
if (tmpPreset==255 && tmpRAMbuffer!=nullptr) {
|
||||||
deserializeJson(*pDoc,tmpRAMbuffer);
|
deserializeJson(*pDoc,tmpRAMbuffer);
|
||||||
errorFlag = ERR_NONE;
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
errorFlag = readObjectFromFileUsingId(getPresetsFileName(tmpPreset < 255), tmpPreset, pDoc) ? ERR_NONE : ERR_FS_PLOAD;
|
presetErrFlag = readObjectFromFileUsingId(getPresetsFileName(tmpPreset < 255), tmpPreset, pDoc) ? ERR_NONE : ERR_FS_PLOAD;
|
||||||
}
|
}
|
||||||
fdo = pDoc->as<JsonObject>();
|
fdo = pDoc->as<JsonObject>();
|
||||||
|
|
||||||
|
// only reset errorflag if previous error was preset-related
|
||||||
|
if ((errorFlag == ERR_NONE) || (errorFlag == ERR_FS_PLOAD)) errorFlag = presetErrFlag;
|
||||||
|
|
||||||
//HTTP API commands
|
//HTTP API commands
|
||||||
const char* httpwin = fdo["win"];
|
const char* httpwin = fdo["win"];
|
||||||
if (httpwin) {
|
if (httpwin) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user