Merge pull request #3 from glasser/glasser/refresh

Turn off light when done
pull/365/head
Jesse Vincent 7 years ago committed by GitHub
commit 89dea00e10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -22,9 +22,27 @@
namespace kaleidoscope {
bool BootGreetingEffect::done_;
byte BootGreetingEffect::row_;
byte BootGreetingEffect::col_;
void BootGreetingEffect::begin(void) {
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) {
@ -33,19 +51,12 @@ void BootGreetingEffect::loopHook(const bool post_clear) {
if (millis() > 9200) {
done_ = true;
::LEDControl.refreshAt(row_, col_);
return;
}
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) {
cRGB color = breath_compute();
::LEDControl.setCrgbAt(r, c, color);
}
}
}
::LEDControl.setCrgbAt(row_, col_, color);
}
}

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

Loading…
Cancel
Save