fix short black-out when a playlist advances (WLEDMM specific)
* do not call strip.show(), just shedule a "show()" in the next main loop. * experimental fix for inconsistent state when loading a preset (see upstream https://github.com/wled/WLED/issues/5200)
This commit is contained in:
@@ -475,14 +475,16 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool onBefore = bri;
|
||||
getVal(root["bri"], &bri);
|
||||
bool onBefore = bri > 0;
|
||||
//if (onBefore && briLast == 0) briLast = bri;
|
||||
(void) getVal(root["bri"], &bri);
|
||||
|
||||
bool on = root["on"] | (bri > 0);
|
||||
if (!on != !bri) toggleOnOff();
|
||||
|
||||
if (root["on"].is<const char*>() && root["on"].as<const char*>()[0] == 't') {
|
||||
if (onBefore || !bri) toggleOnOff(); // do not toggle off again if just turned on by bri (makes e.g. "{"on":"t","bri":32}" work)
|
||||
// WLEDMM bugfix: do not toggle twice when bri > 0
|
||||
if (onBefore && !bri) toggleOnOff(); // do not toggle off again if just turned on by bri (makes e.g. "{"on":"t","bri":32}" work)
|
||||
}
|
||||
|
||||
if (bri && !onBefore) { // unfreeze all segments when turning on
|
||||
@@ -666,6 +668,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
|
||||
//do not notify here, because the first playlist entry will do
|
||||
if (root["on"].isNull()) callMode = CALL_MODE_NO_NOTIFY;
|
||||
else callMode = CALL_MODE_DIRECT_CHANGE; // possible bugfix for playlist only containing HTTP API preset FX=~
|
||||
stateChanged = false; // WLEDMM: prevent premature LED update, let first preset handle it
|
||||
}
|
||||
|
||||
if (root.containsKey(F("rmcpal")) && root[F("rmcpal")].as<bool>()) {
|
||||
|
||||
@@ -253,7 +253,7 @@ void handlePresets()
|
||||
unsigned long waitstart = millis();
|
||||
while (strip.isServicing() && millis() - waitstart < FRAMETIME_FIXED) delay(1); // wait for effects to finish updating
|
||||
|
||||
strip.fill(BLACK); strip.show(); // experimental: set LEDs to black while new preset loads (instead of freezing effects)
|
||||
strip.fill(BLACK); strip.trigger(); // experimental: set LEDs to black while new preset loads (shortly freezing effects, but starts clean. Still better than a short black-out.)
|
||||
|
||||
unsigned long start = millis();
|
||||
while (strip.isUpdating() && millis() - start < FRAMETIME_FIXED) delay(1); // wait for strip to finish updating, accessing FS during sendout causes glitches // WLEDMM delay instead of yield
|
||||
|
||||
Reference in New Issue
Block a user