bugfix: rest segments when leds are switched off/on

based on an idea from @blazoncek in 4cc2cc4ad4 (diff-749825f808f7ce1ce1108fffc7ed037085160a63cad32397135dfc0063494373R56)
This commit is contained in:
Frank
2024-10-27 16:43:21 +01:00
parent 73b7fa7d35
commit cff17861a4
5 changed files with 6 additions and 4 deletions

View File

@@ -2282,7 +2282,7 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping,
}
void WS2812FX::restartRuntime() {
for (segment &seg : _segments) seg.markForReset();
for (segment &seg : _segments) {seg.markForReset(); seg.resetIfRequired();}
}
void WS2812FX::resetSegments(bool boundsOnly) { //WLEDMM add boundsonly

View File

@@ -189,6 +189,7 @@ void handleAnalog(uint8_t b)
briLast = bri;
bri = 0;
} else {
if (bri == 0) strip.restartRuntime();
bri = aRead;
}
} else if (macroDoublePress[b] == 249) {

View File

@@ -430,7 +430,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
}
}
int tr = -1;
long tr = -1;
if (!presetId || currentPlaylist < 0) { //do not apply transition time from preset if playlist active, as it would override playlist transition times
tr = root[F("transition")] | -1;
if (tr >= 0)
@@ -463,7 +463,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
strip.setTransition(transitionDelayTemp); // required here for color transitions to have correct duration
tr = root[F("tb")] | -1;
if (tr >= 0) strip.timebase = ((uint32_t)tr) - millis();
if (tr >= 0) strip.timebase = ((unsigned long)tr) - millis();
JsonObject nl = root["nl"];
nightlightActive = nl["on"] | nightlightActive;

View File

@@ -58,6 +58,7 @@ void toggleOnOff()
if (bri == 0)
{
bri = briLast;
strip.restartRuntime();
} else
{
briLast = bri;

View File

@@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2410200
#define VERSION 2410270
// WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED.
#define _MoonModules_WLED_