From 810acd9842f55cc609e8fe3c708928c002559ea7 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 9 Aug 2017 12:51:29 +0200 Subject: [PATCH] When cancelling after hold timeout, turn should_cancel_ off too. If we do not turn `should_cancel_` off, the next time one taps a one-shot key, the flag will still be on (because nothing else turned it off, and it was set before `hold_time_out_` happened, because the normal one-shot timeout is shorter than that). If the flag is on, the loop hook will turn any and all one-shot effects off. In practice, this resulted in one-shot keys not working properly if they were held for a longer period before. Fixes #12, with many thanks to @ToyKeeper for finding and reporting the issue with reproduction steps. Signed-off-by: Gergely Nagy --- src/Kaleidoscope/OneShot.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Kaleidoscope/OneShot.cpp b/src/Kaleidoscope/OneShot.cpp index 743de1d7..01ad5905 100644 --- a/src/Kaleidoscope/OneShot.cpp +++ b/src/Kaleidoscope/OneShot.cpp @@ -124,6 +124,7 @@ Key OneShot::eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_st clearPressed(idx); if ((millis() - start_time_) >= hold_time_out) { cancelOneShot(idx); + should_cancel_ = false; } }