From 88ceba59cfe40d3d1b010b9e89001c0bc7ddccbf Mon Sep 17 00:00:00 2001 From: Scott Bailey Date: Thu, 2 Sep 2021 22:56:49 -0700 Subject: [PATCH] Fix error 12 issues --- wled00/ir.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wled00/ir.cpp b/wled00/ir.cpp index 30dae3db..63b5410f 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -71,9 +71,11 @@ void decBrightness() // apply preset or fallback to a effect and palette if it doesn't exist void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID) { + byte prevError = errorFlag; if (!applyPreset(presetID, CALL_MODE_BUTTON)) { effectCurrent = effectID; effectPalette = paletteID; + errorFlag = prevError; //clear error 12 from non-existent preset } } @@ -566,16 +568,17 @@ void decodeIRJson(uint32_t code) char objKey[10]; const char* cmd; String cmdStr; + byte irError; DynamicJsonDocument irDoc(JSON_BUFFER_SIZE); JsonObject fdo; JsonObject jsonCmdObj; sprintf(objKey, "\"0x%X\":", code); - errorFlag = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_PLOAD; + irError = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_PLOAD; fdo = irDoc.as(); lastValidCode = 0; - if (!errorFlag) + if (!irError) { cmd = fdo["cmd"]; cmdStr = String(cmd);