From 6b4f75b8bcad5a9c1222039445184e451ebefd10 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Thu, 10 Oct 2019 06:43:01 +0200 Subject: [PATCH] Fixed random_matrix effect. --- include/effect_matrix.h | 2 +- src/effect_matrix.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/effect_matrix.h b/include/effect_matrix.h index 9105525..8b75c30 100644 --- a/include/effect_matrix.h +++ b/include/effect_matrix.h @@ -9,7 +9,7 @@ class MatrixEffectColumn { protected: Window* window; - accum88 x, y; + saccum78 x, y; uint8_t length = 1; uint8_t _direction = 2; bool _random_direction = false; diff --git a/src/effect_matrix.cpp b/src/effect_matrix.cpp index 33f8ff4..476f8f5 100644 --- a/src/effect_matrix.cpp +++ b/src/effect_matrix.cpp @@ -47,7 +47,7 @@ void MatrixEffectColumn::advance(uint16_t ms) { switch(_direction) { case DIR_NORTH: y-=speed * ms; - if ((y>>8) > window->height && (y>>8) + length > window->height) running=false; + if ((y>>8) + length < 0) running=false; break; case DIR_EAST: x+=speed * ms; @@ -59,7 +59,7 @@ void MatrixEffectColumn::advance(uint16_t ms) { break; case DIR_WEST: x-=speed * ms; - if ((x>>8) > window->width && (y>>8) + length > window->width) running=false; + if ((x>>8) + length < 0) running=false; break; } }