Change cleanupDone to numlockUnsynced to better represent what it does

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
pull/365/head
Jesse Vincent 6 years ago
parent efbf158b13
commit c6886b09fb

@ -21,7 +21,7 @@
byte NumPad_::numpad_lock_key_row = 255, NumPad_::numpad_lock_key_col = 255; byte NumPad_::numpad_lock_key_row = 255, NumPad_::numpad_lock_key_col = 255;
uint8_t NumPad_::numPadLayer; uint8_t NumPad_::numPadLayer;
bool NumPad_::cleanupDone = false; bool NumPad_::numlockUnsynced = false;
bool NumPad_::originalNumLockState = false; bool NumPad_::originalNumLockState = false;
cRGB NumPad_::color = CRGB(160, 0, 0); cRGB NumPad_::color = CRGB(160, 0, 0);
uint8_t NumPad_::lock_hue = 170; uint8_t NumPad_::lock_hue = 170;
@ -45,7 +45,7 @@ void NumPad_::syncNumlockState(bool state) {
void NumPad_::cleanupNumlockState() { void NumPad_::cleanupNumlockState() {
if (!cleanupDone) { if (!numlockUnsynced) {
bool numLockLEDState = getNumlockState(); bool numLockLEDState = getNumlockState();
LEDControl.set_mode(LEDControl.get_mode_index()); LEDControl.set_mode(LEDControl.get_mode_index());
if (!originalNumLockState) { if (!originalNumLockState) {
@ -53,7 +53,7 @@ void NumPad_::cleanupNumlockState() {
numLockLEDState = false; numLockLEDState = false;
} }
originalNumLockState = numLockLEDState; originalNumLockState = numLockLEDState;
cleanupDone = true; numlockUnsynced = true;
} }
} }
@ -91,10 +91,10 @@ kaleidoscope::EventHandlerResult NumPad_::afterEachCycle() {
if (!Layer.isOn(numPadLayer)) { if (!Layer.isOn(numPadLayer)) {
cleanupNumlockState(); cleanupNumlockState();
} else { } else {
if (cleanupDone) { if (numlockUnsynced) {
// If it's the first time we're in this loop after toggling the Numpad mode on // If it's the first time we're in this loop after toggling the Numpad mode on
syncNumlockState(true); syncNumlockState(true);
cleanupDone = false; numlockUnsynced = false;
} }
setKeyboardLEDColors(); setKeyboardLEDColors();
} }

@ -40,7 +40,7 @@ class NumPad_ : public kaleidoscope::Plugin {
static uint8_t numpad_lock_key_row; static uint8_t numpad_lock_key_row;
static uint8_t numpad_lock_key_col; static uint8_t numpad_lock_key_col;
static bool cleanupDone; static bool numlockUnsynced;
static bool originalNumLockState; static bool originalNumLockState;
}; };

Loading…
Cancel
Save