do not restart effects after LEDs off/on

This commit is contained in:
Frank
2024-10-27 17:26:04 +01:00
parent cff17861a4
commit e652bd7064
4 changed files with 11 additions and 5 deletions

View File

@@ -895,7 +895,7 @@ class WS2812FX { // 96 bytes
purgeSegments(bool force = false),
setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t grouping = 1, uint8_t spacing = 0, uint16_t offset = UINT16_MAX, uint16_t startY=0, uint16_t stopY=1),
setMainSegmentId(uint8_t n),
restartRuntime(),
restartRuntime(bool doReset=true),
resetSegments(bool boundsOnly = false), //WLEDMM add boundsOnly
makeAutoSegments(bool forceReset = false),
fixInvalidSegments(),

View File

@@ -2281,8 +2281,14 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping,
_segments[n].setUp(i1, i2, grouping, spacing, offset, startY, stopY);
}
void WS2812FX::restartRuntime() {
for (segment &seg : _segments) {seg.markForReset(); seg.resetIfRequired();}
void WS2812FX::restartRuntime(bool doReset) {
for (segment &seg : _segments) {
if (doReset) { // WLEDMM we prefer not to perform a complete restart of all effects
seg.markForReset(); seg.resetIfRequired();
} else {
seg.next_time = 0; seg.step = 0;
}
}
}
void WS2812FX::resetSegments(bool boundsOnly) { //WLEDMM add boundsonly

View File

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

View File

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