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

@ -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;
}
}

Loading…
Cancel
Save