Held + normal key should prevent oneshot from firing

When holding a one-shot key and tapping another that would cancel the one-shot
effect, when we release the one-shot key within `hold_time_out`, do not start
the oneshot effect.

This is done by only clearing the `should_cancel_` flag in `loopHook` when
cancellation did happen. If we clear anyway, then the flag set by the
interrupting keypress will be lost by the time we release the one-shot key.

Reported by @ToyKeeper, thanks a lot for the detailed explanation!

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 7 years ago
parent 85336c5172
commit 2fe4ef3aee

@ -170,19 +170,23 @@ void OneShot::loopHook(bool is_post_clear) {
if (hasTimedOut())
cancel();
bool is_cancelled = false;
for (uint8_t i = 0; i < 32; i++) {
if (should_cancel_) {
if (isSticky(i)) {
if (should_cancel_stickies_) {
is_cancelled = true;
clearSticky(i);
}
} else if (isOneShot(i) && !isPressed(i)) {
is_cancelled = true;
cancelOneShot(i);
}
}
}
if (should_cancel_) {
if (is_cancelled) {
should_cancel_ = false;
should_cancel_stickies_ = false;
}

Loading…
Cancel
Save