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 <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 8 years ago
parent 0fadb782ca
commit af56e5b5a5

@ -33,11 +33,17 @@ namespace KaleidoscopePlugins {
void void
EEPROMKeymapProgrammer::nextState (void) { EEPROMKeymapProgrammer::nextState (void) {
state++; switch (state) {
case INACTIVE:
if (state == END) { state = WAIT_FOR_KEY;
EEPROMKeymap.updateKey (updatePosition, newKey); break;
case WAIT_FOR_KEY:
state = WAIT_FOR_CODE;
break;
case WAIT_FOR_CODE:
::EEPROMKeymap.updateKey (updatePosition, newKey);
cancel (); cancel ();
break;
} }
} }
@ -50,7 +56,7 @@ namespace KaleidoscopePlugins {
Key Key
EEPROMKeymapProgrammer::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { EEPROMKeymapProgrammer::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
if (state == INACTIVE || state == END) if (state == INACTIVE)
return mappedKey; return mappedKey;
if (state == WAIT_FOR_KEY) { if (state == WAIT_FOR_KEY) {

@ -38,7 +38,6 @@ namespace KaleidoscopePlugins {
INACTIVE, INACTIVE,
WAIT_FOR_KEY, WAIT_FOR_KEY,
WAIT_FOR_CODE, WAIT_FOR_CODE,
END
} state_t; } state_t;
static state_t state; static state_t state;

Loading…
Cancel
Save