From d30e219d7bcdeae4ffe8f1ea110f0570ab49cdaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Fri, 4 Nov 2022 08:27:35 +0100 Subject: [PATCH] Faster strip updates. --- usermods/Animated_Staircase/Animated_Staircase.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/usermods/Animated_Staircase/Animated_Staircase.h b/usermods/Animated_Staircase/Animated_Staircase.h index 818b14b5..1ef2c959 100644 --- a/usermods/Animated_Staircase/Animated_Staircase.h +++ b/usermods/Animated_Staircase/Animated_Staircase.h @@ -114,9 +114,10 @@ class Animated_Staircase : public Usermod { seg.setOption(SEG_OPTION_ON, false); } // Always mark segments as "transitional", we are animating the staircase - //seg.setOption(SEG_OPTION_TRANSITIONAL, true); // not needed anymore + //seg.setOption(SEG_OPTION_TRANSITIONAL, true); // not needed anymore as setOption() does it } - stateChanged = true; + strip.trigger(); // force strip refresh + stateChanged = true; // inform external devices/UI of change colorUpdated(CALL_MODE_DIRECT_CHANGE); } @@ -287,9 +288,10 @@ class Animated_Staircase : public Usermod { onIndex = minSegmentId = strip.getMainSegmentId(); // it may not be the best idea to start with main segment as it may not be the first one offIndex = maxSegmentId = strip.getLastActiveSegmentId() + 1; - // shorten the strip trnasition time to be equal or shorter than segment delay + // shorten the strip transition time to be equal or shorter than segment delay transitionDelayTemp = transitionDelay = segment_delay_ms; strip.setTransition(segment_delay_ms/100); + strip.trigger(); } else { // Restore segment options for (int i = 0; i <= strip.getLastActiveSegmentId(); i++) { @@ -297,7 +299,8 @@ class Animated_Staircase : public Usermod { if (!seg.isActive()) continue; // skip vector gaps seg.setOption(SEG_OPTION_ON, true); } - stateChanged = true; + strip.trigger(); // force strip update + stateChanged = true; // inform external dvices/UI of change colorUpdated(CALL_MODE_DIRECT_CHANGE); DEBUG_PRINTLN(F("Animated Staircase disabled.")); }