Chase: Properly flip the direction when pos goes below zero

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/449/head
Gergely Nagy 6 years ago
parent 37605d12d7
commit ef2c6a3e95
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -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 // 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). // known to be invalid (LED_COUNT).
pos += chase_sign; pos += chase_sign;
if (pos < LED_COUNT) { if (pos < LED_COUNT && pos > 0) {
pos2 += chase_sign; pos2 += chase_sign;
} else { } else {
chase_sign = -chase_sign; chase_sign = -chase_sign;

Loading…
Cancel
Save