From 9adf73db879dd83ef2ebb5dcbaec4f476f9c1ba3 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 18 Jan 2017 22:22:26 +0100 Subject: [PATCH] Fix cancellation on interrupt Cancel the one-shot state when the interruptor is pressed, not when it is released. Otherwise, when typing fast, other keys pressed while the interruptor is still releasing, may have the one-shot effect applied too. For this to work, we need to do the cancellation post-clear, otherwise the one-shot modifiers are cleared before they register with the interruptor. Fixes #1, which used to be keyboardio/Akela#121. Signed-off-by: Gergely Nagy --- src/Akela/OneShot.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Akela/OneShot.cpp b/src/Akela/OneShot.cpp index 7cd2596b..874fde2c 100644 --- a/src/Akela/OneShot.cpp +++ b/src/Akela/OneShot.cpp @@ -190,9 +190,6 @@ namespace Akela { if (key_is_pressed (keyState)) { saveAsPrevious (mappedKey); - } - - if (key_toggled_off (keyState)) { shouldCancel = true; } @@ -204,7 +201,7 @@ namespace Akela { if (!State) return; - if (!postClear) { + if (postClear) { if (Timer < TimeOut) Timer++;