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;