From ab89785ab5bb832c1ce60a6dc62484595cca7a49 Mon Sep 17 00:00:00 2001 From: matt venn Date: Mon, 3 Sep 2018 11:40:02 +0200 Subject: [PATCH] moved to millisAtCycleStart and fixed overflow bug present on ARM platform --- src/Kaleidoscope/LED-Stalker.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kaleidoscope/LED-Stalker.cpp b/src/Kaleidoscope/LED-Stalker.cpp index 57b55304..04c3b114 100644 --- a/src/Kaleidoscope/LED-Stalker.cpp +++ b/src/Kaleidoscope/LED-Stalker.cpp @@ -46,7 +46,7 @@ void StalkerEffect::update(void) { return; uint16_t now = millis(); - bool time_out = (now - step_start_time_) > step_length; + uint16_t elapsed = Kaleidoscope.millisAtCycleStart() - step_start_time_; for (byte r = 0; r < ROWS; r++) { for (byte c = 0; c < COLS; c++) { @@ -55,7 +55,7 @@ void StalkerEffect::update(void) { ::LEDControl.setCrgbAt(r, c, variant->compute(&step)); } - if (time_out) { + if (elapsed > step_length) { map_[r][c] = step; } @@ -66,8 +66,8 @@ void StalkerEffect::update(void) { } } - if (time_out) - step_start_time_ = now; + if (elapsed > step_length) + step_start_time_ = Kaleidoscope.millisAtCycleStart(); } namespace stalker {