Use standard timeout checker for LED-BootAnimation

Alos, don't bother to set `start_time_` in `onSetup()`; it's unnecessary.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/642/head
Michael Richters 6 years ago
parent 27f1c5fb53
commit 6a830f01af

@ -40,7 +40,6 @@ const uint8_t BootAnimationEffect::greeting_[11] PROGMEM = {
}; };
EventHandlerResult BootAnimationEffect::onSetup() { EventHandlerResult BootAnimationEffect::onSetup() {
start_time_ = Kaleidoscope.millisAtCycleStart();
return EventHandlerResult::OK; return EventHandlerResult::OK;
} }
@ -70,12 +69,12 @@ EventHandlerResult BootAnimationEffect::afterEachCycle() {
} }
} }
if ((Kaleidoscope.millisAtCycleStart() - start_time_) > timeout) { if (Kaleidoscope.hasTimeExpired(start_time_, timeout)) {
current_index_++; current_index_++;
if (current_index_ == sizeof(greeting_)) if (current_index_ == sizeof(greeting_))
done_ = true; done_ = true;
start_time_ = Kaleidoscope.millisAtCycleStart(); start_time_ += timeout;
if (row != 255 && col != 255) if (row != 255 && col != 255)
::LEDControl.refreshAt(row, col); ::LEDControl.refreshAt(row, col);
return EventHandlerResult::OK; return EventHandlerResult::OK;

Loading…
Cancel
Save