EventHandlerResult BootGreetingEffect::afterEachCycle() { if (!Kaleidoscope.has_leds) return EventHandlerResult::OK; //If already done or we're not in a ready state, bail if (done_) { return EventHandlerResult::OK; } //If the start time isn't set, set the start time and //find the LEDs. if (start_time == 0) { start_time = millis(); findLed(); //the first time, don't do anything. return EventHandlerResult::OK; } //Only run for 'timeout' milliseconds if ((millis() - start_time) > timeout) { done_ = true; ::LEDControl.refreshAt(row_, col_); return EventHandlerResult::OK; } cRGB color = breath_compute(hue); ::LEDControl.setCrgbAt(row_, col_, color); return EventHandlerResult::OK; }
void LEDBreatheEffect_::update (void) { cRGB color = breath_compute(); LEDControl.set_all_leds_to (color); }