From ef2c6a3e95439e97512d55a8888444aa41696b70 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 28 Oct 2018 09:25:13 +0100 Subject: [PATCH] Chase: Properly flip the direction when pos goes below zero Signed-off-by: Gergely Nagy --- src/kaleidoscope/plugin/LEDEffect-Chase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kaleidoscope/plugin/LEDEffect-Chase.cpp b/src/kaleidoscope/plugin/LEDEffect-Chase.cpp index 0234a544..7a1088ce 100644 --- a/src/kaleidoscope/plugin/LEDEffect-Chase.cpp +++ b/src/kaleidoscope/plugin/LEDEffect-Chase.cpp @@ -48,7 +48,7 @@ void LEDChaseEffect::update(void) { // will be out of bounds. The simplest way to do this is to assign it a value that is // known to be invalid (LED_COUNT). pos += chase_sign; - if (pos < LED_COUNT) { + if (pos < LED_COUNT && pos > 0) { pos2 += chase_sign; } else { chase_sign = -chase_sign;