Use LEDControl.paused instead of an implicit LEDOff

Fixes #1.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/365/head
Gergely Nagy 7 years ago committed by Gergely Nagy
parent 9dc2daddc5
commit d602988b95

@ -19,7 +19,6 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-MyOldFriend.h> #include <Kaleidoscope-MyOldFriend.h>
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include "LED-Off.h"
// This is a terrible hack until Arduino#6964 gets implemented. // This is a terrible hack until Arduino#6964 gets implemented.
// It makes the `_usbSuspendState` symbol available to us. // It makes the `_usbSuspendState` symbol available to us.
@ -32,19 +31,17 @@ bool MyOldFriend::initial_suspend_ = true;
void MyOldFriend::begin(void) { void MyOldFriend::begin(void) {
Kaleidoscope.useLoopHook(loopHook); Kaleidoscope.useLoopHook(loopHook);
Kaleidoscope.use(&::LEDOff);
} }
void MyOldFriend::toggleLEDs(MyOldFriend::Event event) { void MyOldFriend::toggleLEDs(MyOldFriend::Event event) {
static uint8_t prev_led_mode = 0;
switch (event) { switch (event) {
case Suspend: case Suspend:
prev_led_mode = ::LEDControl.get_mode_index(); ::LEDControl.paused = true;
::LEDOff.activate(); ::LEDControl.set_all_leds_to({0, 0, 0});
::LEDControl.syncLeds();
break; break;
case Resume: case Resume:
::LEDControl.set_mode(prev_led_mode); ::LEDControl.paused = false;
::LEDControl.refreshAll(); ::LEDControl.refreshAll();
break; break;
case Sleep: case Sleep:

Loading…
Cancel
Save