Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for "Send notifications on button press or IR" does not work when using "JSON remote" #4519 #4528

Merged
merged 1 commit into from
Feb 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions wled00/ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,15 @@ static void decodeIRJson(uint32_t code)
handleSet(nullptr, cmdStr, false); // no stateUpdated() call here
}
} else {
// command is JSON object (TODO: currently will not handle irApplyToAllSelected correctly)
if (jsonCmdObj[F("psave")].isNull()) deserializeState(jsonCmdObj, CALL_MODE_BUTTON_PRESET);
else {
// command is JSON object
if (jsonCmdObj[F("psave")].isNull()) {
if (irApplyToAllSelected && jsonCmdObj["seg"].is<JsonArray>()) {
JsonObject seg = jsonCmdObj["seg"][0]; // take 1st segment from array and use it to apply to all selected segments
seg.remove("id"); // remove segment ID if it exists
jsonCmdObj["seg"] = seg; // replace array with object
}
deserializeState(jsonCmdObj, CALL_MODE_BUTTON_PRESET); // **will call stateUpdated() with correct CALL_MODE**
} else {
uint8_t psave = jsonCmdObj[F("psave")].as<int>();
char pname[33];
sprintf_P(pname, PSTR("IR Preset %d"), psave);
Expand All @@ -628,6 +634,7 @@ static void applyRepeatActions()
{
if (irEnabled == 8) {
decodeIRJson(lastValidCode);
stateUpdated(CALL_MODE_BUTTON_PRESET);
return;
} else switch (lastRepeatableAction) {
case ACTION_BRIGHT_UP : incBrightness(); stateUpdated(CALL_MODE_BUTTON); return;
Expand Down Expand Up @@ -664,7 +671,7 @@ static void decodeIR(uint32_t code)

if (irEnabled == 8) { // any remote configurable with ir.json file
decodeIRJson(code);
stateUpdated(CALL_MODE_BUTTON);
stateUpdated(CALL_MODE_BUTTON_PRESET);
return;
}
if (code > 0xFFFFFF) return; //invalid code
Expand Down