From a643b5655593c6381221587fd5bc8fcdd5421011 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Wed, 1 Dec 2021 23:03:30 +0100 Subject: [PATCH] Fixed no color updated on full JSON state request --- wled00/json.cpp | 11 +++++++---- wled00/wled.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index 3e27c0b15..f9fc75154 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -8,6 +8,7 @@ bool getVal(JsonVariant elem, byte* val, byte vmin=0, byte vmax=255) { if (elem.is()) { + if (elem < 0) return false; //ignore e.g. {"ps":-1} *val = elem; return true; } else if (elem.is()) { @@ -152,17 +153,19 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId) //temporary, strip object gets updated via colorUpdated() if (id == strip.getMainSegmentId()) { - if (getVal(elem["fx"], &effectCurrent, 1, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 1-255 exact value) - if (!presetId) unloadPlaylist(); //stop playlist if active and FX changed manually + byte effectPrev = effectCurrent; + if (getVal(elem["fx"], &effectCurrent, 1, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 0-255 exact value) + if (!presetId && effectCurrent != effectPrev) unloadPlaylist(); //stop playlist if active and FX changed manually } effectSpeed = elem[F("sx")] | effectSpeed; effectIntensity = elem[F("ix")] | effectIntensity; getVal(elem["pal"], &effectPalette, 1, strip.getPaletteCount()); } else { //permanent byte fx = seg.mode; - if (getVal(elem["fx"], &fx, 1, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 1-255 exact value) + byte fxPrev = fx; + if (getVal(elem["fx"], &fx, 1, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 0-255 exact value) strip.setMode(id, fx); - if (!presetId) unloadPlaylist(); //stop playlist if active and FX changed manually + if (!presetId && seg.mode != fxPrev) unloadPlaylist(); //stop playlist if active and FX changed manually } seg.speed = elem[F("sx")] | seg.speed; seg.intensity = elem[F("ix")] | seg.intensity; diff --git a/wled00/wled.h b/wled00/wled.h index 062de8ffe..5bfb4735e 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2111300 +#define VERSION 2112010 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG