JSON IR improvements

Restored support for "PL=~" mistakenly removed in 2106300
This commit is contained in:
cschwinne
2021-07-04 13:23:45 +02:00
parent 1bb7e36a65
commit c879351063
4 changed files with 26 additions and 7 deletions

View File

@@ -580,13 +580,13 @@ void decodeIRJson(uint32_t code)
{
if (cmdStr.startsWith("!")) {
// call limited set of C functions
if (cmdStr == "!incBrightness") {
if (cmdStr.startsWith(F("!incBri"))) {
lastValidCode = code;
incBrightness();
} else if (cmdStr == "!decBrightness") {
} else if (cmdStr.startsWith(F("!decBri"))) {
lastValidCode = code;
decBrightness();
} else if (cmdStr == "!presetFallback") {
} else if (cmdStr.startsWith(F("!presetF"))) { //!presetFallback
uint8_t p1 = fdo["PL"] ? fdo["PL"] : 1;
uint8_t p2 = fdo["FX"] ? fdo["FX"] : random8(100);
uint8_t p3 = fdo["FP"] ? fdo["FP"] : 0;
@@ -598,7 +598,8 @@ void decodeIRJson(uint32_t code)
{
// repeatable action
lastValidCode = code;
} if (effectCurrent == 0 && cmdStr.indexOf("FP=") > -1) {
}
if (effectCurrent == 0 && cmdStr.indexOf("FP=") > -1) {
// setting palette but it wont show because effect is solid
effectCurrent = FX_MODE_GRADIENT;
}
@@ -609,7 +610,10 @@ void decodeIRJson(uint32_t code)
}
} else if (!jsonCmdObj.isNull()) {
// command is JSON object
//allow applyPreset() to reuse JSON buffer, or it would alloc. a second buffer and run out of mem.
fileDoc = &irDoc;
deserializeState(jsonCmdObj);
fileDoc = nullptr;
}
}
}