From af56e5b5a57b948ea43d61766b1217e7e9643cc2 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 21 Mar 2017 19:52:53 +0100 Subject: [PATCH] Fix compile errors & drop the END state We can't ++ enums in C++, it seems, so use a switch statement instead. Also qualify the EEPROMKeymap object, so we call the object method, instead of trying to call a method on a class as if it was an object. Oops. Within this process, drop the END state, it is not required anymore. Signed-off-by: Gergely Nagy --- src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp | 16 +++++++++++----- src/Kaleidoscope/EEPROM-Keymap-Programmer.h | 1 - 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp b/src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp index 0794228a..95ef3253 100644 --- a/src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp +++ b/src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp @@ -33,11 +33,17 @@ namespace KaleidoscopePlugins { void EEPROMKeymapProgrammer::nextState (void) { - state++; - - if (state == END) { - EEPROMKeymap.updateKey (updatePosition, newKey); + switch (state) { + case INACTIVE: + state = WAIT_FOR_KEY; + break; + case WAIT_FOR_KEY: + state = WAIT_FOR_CODE; + break; + case WAIT_FOR_CODE: + ::EEPROMKeymap.updateKey (updatePosition, newKey); cancel (); + break; } } @@ -50,7 +56,7 @@ namespace KaleidoscopePlugins { Key EEPROMKeymapProgrammer::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { - if (state == INACTIVE || state == END) + if (state == INACTIVE) return mappedKey; if (state == WAIT_FOR_KEY) { diff --git a/src/Kaleidoscope/EEPROM-Keymap-Programmer.h b/src/Kaleidoscope/EEPROM-Keymap-Programmer.h index 7001a775..2be7ee2d 100644 --- a/src/Kaleidoscope/EEPROM-Keymap-Programmer.h +++ b/src/Kaleidoscope/EEPROM-Keymap-Programmer.h @@ -38,7 +38,6 @@ namespace KaleidoscopePlugins { INACTIVE, WAIT_FOR_KEY, WAIT_FOR_CODE, - END } state_t; static state_t state;