From b1f20fadb7d09aebefbf156f4334f74d88ae82a2 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 21 Mar 2017 19:59:53 +0100 Subject: [PATCH] More reliable state transitions Record the position of the first key pressed after going into the `WAIT_FOR_KEY` state, but transition only when that key is released. Signed-off-by: Gergely Nagy --- src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp b/src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp index 95ef3253..9e58241d 100644 --- a/src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp +++ b/src/Kaleidoscope/EEPROM-Keymap-Programmer.cpp @@ -60,9 +60,12 @@ namespace KaleidoscopePlugins { return mappedKey; if (state == WAIT_FOR_KEY) { - if (key_toggled_off (keyState)) { + if (key_toggled_on (keyState)) { updatePosition = Layer.top () * ROWS * COLS + row * COLS + col; - nextState (); + } + if (key_toggled_off (keyState)) { + if ((uint16_t)(Layer.top () * ROWS * COLS + row * COLS + col) == updatePosition) + nextState (); } return Key_NoKey; }