Skip to content

Commit

Permalink
Possible fix for #3589 & partial fix for #3605
Browse files Browse the repository at this point in the history
  • Loading branch information
blazoncek committed Jan 9, 2024
1 parent 9940258 commit 2202175
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,14 @@ bool deserializeSegment(JsonObject elem, byte it, byte presetId)
#endif

byte fx = seg.mode;
if (getVal(elem["fx"], &fx, 0, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 0-255 exact value)
byte last = strip.getModeCount();
// partial fix for #3605
if (!elem["fx"].isNull() && elem["fx"].is<const char*>()) {
const char *tmp = elem["fx"].as<const char *>();
if (strlen(tmp) > 3 && (strchr(tmp,'r') || strchr(tmp,'~') != strrchr(tmp,'~'))) last = 0; // we have "X~Y(r|[w]~[-])" form
}
// end fix
if (getVal(elem["fx"], &fx, 0, last)) { //load effect ('r' random, '~' inc/dec, 0-255 exact value, 5~10r pick random between 5 & 10)
if (!presetId && currentPlaylist>=0) unloadPlaylist();
if (fx != seg.mode) seg.setMode(fx, elem[F("fxdef")]);
}
Expand Down
2 changes: 2 additions & 0 deletions wled00/udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ void exitRealtime() {
realtimeIP[0] = 0;
if (useMainSegmentOnly) { // unfreeze live segment again
strip.getMainSegment().freeze = false;
} else {
strip.show(); // possible fix for #3589
}
updateInterfaces(CALL_MODE_WS_SEND);
}
Expand Down

0 comments on commit 2202175

Please sign in to comment.