kopia lustrzana https://github.com/Aircoookie/WLED
Fix for {on:"t",bri:100}
rodzic
acb17dc575
commit
9e828eccf6
|
@ -318,10 +318,12 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
|
||||||
bool onBefore = bri;
|
bool onBefore = bri;
|
||||||
getVal(root["bri"], &bri);
|
getVal(root["bri"], &bri);
|
||||||
|
|
||||||
bool on = root["on"] | (bri > 0);
|
if (root["on"].isNull()) {
|
||||||
if (!on != !bri) toggleOnOff();
|
if ((onBefore && bri==0) || (!onBefore && bri>0)) toggleOnOff();
|
||||||
|
} else {
|
||||||
if (root["on"].is<const char*>() && root["on"].as<const char*>()[0] == 't') toggleOnOff();
|
bool on = root["on"] | onBefore;
|
||||||
|
if (on != onBefore || (root["on"].is<const char*>() && root["on"].as<const char*>()[0] == 't')) toggleOnOff();
|
||||||
|
}
|
||||||
|
|
||||||
if (bri && !onBefore) { // unfreeze all segments when turning on
|
if (bri && !onBefore) { // unfreeze all segments when turning on
|
||||||
for (size_t s=0; s < strip.getSegmentsNum(); s++) {
|
for (size_t s=0; s < strip.getSegmentsNum(); s++) {
|
||||||
|
|
Ładowanie…
Reference in New Issue