From efa497c69b813852d3704dbd96207f1186eb941a Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sun, 7 Mar 2021 14:50:30 +0100 Subject: fix(behaviors): Fix timing of delayed hold-tap trigger A hold-tap timer event would be triggered too soon if the hold-tap was delayed for longer than its tapping-term. This may cause accidental hold behavior when the correct behavior would be tap. By queuing the timer event instead of executing it immediately, other delayed events get a chance to be processed properly. --- app/src/behaviors/behavior_hold_tap.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'app/src') diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index c83305d..0b6b587 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -449,11 +449,7 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding, // if this behavior was queued we have to adjust the timer to only // wait for the remaining time. int32_t tapping_term_ms_left = (hold_tap->timestamp + cfg->tapping_term_ms) - k_uptime_get(); - if (tapping_term_ms_left > 0) { - k_delayed_work_submit(&hold_tap->work, K_MSEC(tapping_term_ms_left)); - } else { - decide_hold_tap(hold_tap, HT_TIMER_EVENT); - } + k_delayed_work_submit(&hold_tap->work, K_MSEC(tapping_term_ms_left)); return ZMK_BEHAVIOR_OPAQUE; } -- cgit v1.2.3