From 847d7313b1dc5c72799c7a89693e36f95266ee42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 00:37:31 +0000 Subject: [PATCH] Fix RPI breaking all mod-tap holds: revert to manual last_key_time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit last_input_activity_elapsed() includes the mod-tap key's OWN matrix event. Since process_record_user fires ~tapping_term ms after the physical press (after action_tapping resolves tap/hold), the elapsed time is always ≈ tapping_term < RPI thresholds, so holds never work. Revert to manual last_key_time updated at the END of process_record_user. Remove SPLIT_ACTIVITY_ENABLE (not needed — master processes all keys from both halves). Agent-Logs-Url: https://github.com/timfee/qmk_userspace/sessions/14d8fea9-7e5d-40c4-9b47-abab68e5d4e2 Co-authored-by: timfee <3246342+timfee@users.noreply.github.com> --- users/timfee/config.h | 1 - users/timfee/timfee.c | 22 ++++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/users/timfee/config.h b/users/timfee/config.h index f28ca664..75a91967 100644 --- a/users/timfee/config.h +++ b/users/timfee/config.h @@ -29,6 +29,5 @@ // ── Split transport ── #define SPLIT_TRANSPORT_MIRROR #define SPLIT_WPM_ENABLE -#define SPLIT_ACTIVITY_ENABLE #define SPLIT_WATCHDOG_TIMEOUT 4000 #define SPLIT_TRANSACTION_IDS_USER USER_SYNC_OLED_STATE, USER_SYNC_LASTKEY, USER_SYNC_PRESSES diff --git a/users/timfee/timfee.c b/users/timfee/timfee.c index 10969ba6..8ca0d203 100644 --- a/users/timfee/timfee.c +++ b/users/timfee/timfee.c @@ -6,8 +6,16 @@ #endif // ── State for require-prior-idle ── -// (last_key_time removed: using last_input_activity_elapsed() instead, which -// is synced from both halves via SPLIT_ACTIVITY_ENABLE, fixing cross-half RPI) +// Manual timestamp of the last key processed through process_record_user. +// This is intentionally NOT last_input_activity_elapsed() — that API reflects +// the most recent matrix scan change, which includes the current mod-tap key's +// OWN press. Since process_record_user fires ~tapping_term ms after the +// physical press (after tap/hold resolution), the elapsed time would always be +// ≈ tapping_term, which is less than the RPI thresholds — killing every hold. +// A manual variable updated at the END of process_record_user correctly +// captures the previous key's timing. This works for both halves because QMK +// split processes all key events on the master side. +static uint16_t last_key_time = 0; // ── Combos (matching Vial config) ── const uint16_t PROGMEM lparen_combo[] = {KC_R, KC_T, COMBO_END}; @@ -214,12 +222,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } #endif - // Require-prior-idle: force tap if pressed too soon after any recent - // activity on either half. SPLIT_ACTIVITY_ENABLE synchronizes the - // underlying activity timestamp from the slave to the master at the - // transport level, so last_input_activity_elapsed() reflects the most - // recent keypress on either half — not just the master side. - uint32_t elapsed = last_input_activity_elapsed(); + // Require-prior-idle: force tap if pressed too soon after last key + uint16_t elapsed = timer_elapsed(last_key_time); switch (keycode) { case GU_SPC: @@ -271,6 +275,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; } + + last_key_time = timer_read(); } return true; }