Fixed no color updated on full JSON state request
This commit is contained in:
parent
f7404085de
commit
a643b56555
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
bool getVal(JsonVariant elem, byte* val, byte vmin=0, byte vmax=255) {
|
bool getVal(JsonVariant elem, byte* val, byte vmin=0, byte vmax=255) {
|
||||||
if (elem.is<int>()) {
|
if (elem.is<int>()) {
|
||||||
|
if (elem < 0) return false; //ignore e.g. {"ps":-1}
|
||||||
*val = elem;
|
*val = elem;
|
||||||
return true;
|
return true;
|
||||||
} else if (elem.is<const char*>()) {
|
} else if (elem.is<const char*>()) {
|
||||||
@ -152,17 +153,19 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
|||||||
|
|
||||||
//temporary, strip object gets updated via colorUpdated()
|
//temporary, strip object gets updated via colorUpdated()
|
||||||
if (id == strip.getMainSegmentId()) {
|
if (id == strip.getMainSegmentId()) {
|
||||||
if (getVal(elem["fx"], &effectCurrent, 1, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 1-255 exact value)
|
byte effectPrev = effectCurrent;
|
||||||
if (!presetId) unloadPlaylist(); //stop playlist if active and FX changed manually
|
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;
|
effectSpeed = elem[F("sx")] | effectSpeed;
|
||||||
effectIntensity = elem[F("ix")] | effectIntensity;
|
effectIntensity = elem[F("ix")] | effectIntensity;
|
||||||
getVal(elem["pal"], &effectPalette, 1, strip.getPaletteCount());
|
getVal(elem["pal"], &effectPalette, 1, strip.getPaletteCount());
|
||||||
} else { //permanent
|
} else { //permanent
|
||||||
byte fx = seg.mode;
|
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);
|
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.speed = elem[F("sx")] | seg.speed;
|
||||||
seg.intensity = elem[F("ix")] | seg.intensity;
|
seg.intensity = elem[F("ix")] | seg.intensity;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// 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
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
Loading…
Reference in New Issue
Block a user