Fix cross-half RPI timing with SPLIT_ACTIVITY_ENABLE + last_input_activity_elapsed

Agent-Logs-Url: https://github.com/timfee/qmk_userspace/sessions/c129e415-070b-4b3e-b26d-2262310412aa

Co-authored-by: timfee <3246342+timfee@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-13 20:58:11 +00:00 committed by GitHub
commit bb425b3cfe
Failed to generate hash of commit
2 changed files with 9 additions and 5 deletions

View file

@ -29,5 +29,6 @@
// ── Split transport ── // ── Split transport ──
#define SPLIT_TRANSPORT_MIRROR #define SPLIT_TRANSPORT_MIRROR
#define SPLIT_WPM_ENABLE #define SPLIT_WPM_ENABLE
#define SPLIT_ACTIVITY_ENABLE
#define SPLIT_WATCHDOG_TIMEOUT 4000 #define SPLIT_WATCHDOG_TIMEOUT 4000
#define SPLIT_TRANSACTION_IDS_USER USER_SYNC_OLED_STATE, USER_SYNC_LASTKEY, USER_SYNC_PRESSES #define SPLIT_TRANSACTION_IDS_USER USER_SYNC_OLED_STATE, USER_SYNC_LASTKEY, USER_SYNC_PRESSES

View file

@ -6,7 +6,8 @@
#endif #endif
// ── State for require-prior-idle ── // ── State for require-prior-idle ──
static uint16_t last_key_time = 0; // (last_key_time removed: using last_input_activity_elapsed() instead, which
// is synced from both halves via SPLIT_ACTIVITY_ENABLE, fixing cross-half RPI)
// ── Combos (matching Vial config) ── // ── Combos (matching Vial config) ──
const uint16_t PROGMEM lparen_combo[] = {KC_R, KC_T, COMBO_END}; const uint16_t PROGMEM lparen_combo[] = {KC_R, KC_T, COMBO_END};
@ -213,8 +214,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
#endif #endif
// Require-prior-idle handling // Require-prior-idle: force tap if pressed too soon after any recent
uint16_t elapsed = timer_elapsed(last_key_time); // 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();
switch (keycode) { switch (keycode) {
case GU_SPC: case GU_SPC:
@ -266,8 +271,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
break; break;
} }
last_key_time = timer_read();
} }
return true; return true;
} }