Turn off light when done

Fixes #2.
pull/365/head
David Glasser 7 years ago
parent 74b79d60f6
commit 4342080621

@ -22,9 +22,27 @@
namespace kaleidoscope { namespace kaleidoscope {
bool BootGreetingEffect::done_; bool BootGreetingEffect::done_;
byte BootGreetingEffect::row_;
byte BootGreetingEffect::col_;
void BootGreetingEffect::begin(void) { void BootGreetingEffect::begin(void) {
Kaleidoscope.useLoopHook(loopHook); Kaleidoscope.useLoopHook(loopHook);
// Find the LED key.
for (uint8_t r = 0; r < ROWS; r++) {
for (uint8_t c = 0; c < COLS; c++) {
Key k = Layer.lookupOnActiveLayer(r, c);
if (k == Key_LEDEffectNext) {
row_ = r;
col_ = c;
return;
}
}
}
// We didn't find the LED key. Let's just pretend we're "done".
done_ = true;
} }
void BootGreetingEffect::loopHook(const bool post_clear) { void BootGreetingEffect::loopHook(const bool post_clear) {
@ -33,19 +51,12 @@ void BootGreetingEffect::loopHook(const bool post_clear) {
if (millis() > 9200) { if (millis() > 9200) {
done_ = true; done_ = true;
::LEDControl.refreshAt(row_, col_);
return; return;
} }
for (uint8_t r = 0; r < ROWS; r++) { cRGB color = breath_compute();
for (uint8_t c = 0; c < COLS; c++) { ::LEDControl.setCrgbAt(row_, col_, color);
Key k = Layer.lookupOnActiveLayer(r, c);
if (k == Key_LEDEffectNext) {
cRGB color = breath_compute();
::LEDControl.setCrgbAt(r, c, color);
}
}
}
} }
} }

@ -30,6 +30,8 @@ class BootGreetingEffect : public KaleidoscopePlugin {
private: private:
static void loopHook(const bool post_clear); static void loopHook(const bool post_clear);
static bool done_; static bool done_;
static byte row_;
static byte col_;
}; };
} }

Loading…
Cancel
Save