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

@ -60,8 +60,11 @@ 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;
}
if (key_toggled_off (keyState)) {
if ((uint16_t)(Layer.top () * ROWS * COLS + row * COLS + col) == updatePosition)
nextState ();
}
return Key_NoKey;

Loading…
Cancel
Save