Skip to content

Commit 88ceba5

Browse files
committed
Fix error 12 issues
1 parent 54f4658 commit 88ceba5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

wled00/ir.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ void decBrightness()
7171
// apply preset or fallback to a effect and palette if it doesn't exist
7272
void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
7373
{
74+
byte prevError = errorFlag;
7475
if (!applyPreset(presetID, CALL_MODE_BUTTON)) {
7576
effectCurrent = effectID;
7677
effectPalette = paletteID;
78+
errorFlag = prevError; //clear error 12 from non-existent preset
7779
}
7880
}
7981

@@ -566,16 +568,17 @@ void decodeIRJson(uint32_t code)
566568
char objKey[10];
567569
const char* cmd;
568570
String cmdStr;
571+
byte irError;
569572
DynamicJsonDocument irDoc(JSON_BUFFER_SIZE);
570573
JsonObject fdo;
571574
JsonObject jsonCmdObj;
572575

573576
sprintf(objKey, "\"0x%X\":", code);
574577

575-
errorFlag = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_PLOAD;
578+
irError = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_PLOAD;
576579
fdo = irDoc.as<JsonObject>();
577580
lastValidCode = 0;
578-
if (!errorFlag)
581+
if (!irError)
579582
{
580583
cmd = fdo["cmd"];
581584
cmdStr = String(cmd);

0 commit comments

Comments
 (0)