feat(q5_max): add speculative hold for caps_mod key #23

Merged
rootiest merged 5 commits from feat/speculative-hold into main 2026-04-23 02:59:38 +00:00
Owner

Summary

  • Cherry-picks upstream QMK speculative-hold core feature (#25572, #25797) into the local tree
  • Enables speculative hold for the caps_mod mod-tap key so mods register instantly while the key is still settling, reducing latency on fast typists

Test plan

  • Compile: qmk compile -kb keychron/q5_max/ansi_encoder -km via
  • Flash and confirm caps_mod fires its hold action without needing to wait out the tapping term when followed by another key
  • Confirm normal tap behaviour (Caps Lock) still works when caps_mod is pressed and released alone
## Summary - Cherry-picks upstream QMK speculative-hold core feature (#25572, #25797) into the local tree - Enables speculative hold for the `caps_mod` mod-tap key so mods register instantly while the key is still settling, reducing latency on fast typists ## Test plan - [x] Compile: `qmk compile -kb keychron/q5_max/ansi_encoder -km via` - [x] Flash and confirm `caps_mod` fires its hold action without needing to wait out the tapping term when followed by another key - [x] Confirm normal tap behaviour (Caps Lock) still works when `caps_mod` is pressed and released alone
rootiest added 5 commits 2026-04-23 02:56:05 +00:00
Adds a new HID_CMD_BATTERY (0x44) command to the shared qmk-host protocol.
When the keyboard is in wireless transport mode (BT or 2.4G) the firmware
now pushes the current battery percentage to the host:

- Periodic push every 5 minutes via timer_read32()/timer_elapsed32(); fires
  immediately on the first matrix_scan_user() call after boot so qmk-host
  gets a reading as soon as the keyboard connects over USB in wireless mode.
- Redundant sends are suppressed: g_last_sent_bat tracks the last value
  transmitted and the packet is skipped when the level has not changed.
- Query-response path: qmk-host can send CMD_BATTERY with HID_FLAG_QUERY at
  any time; the keyboard replies with the current percentage or
  HID_BATT_UNAVAILABLE (0xFF) when in USB transport mode.
- All battery and transport code is guarded by #ifdef LK_WIRELESS_ENABLE so
  the keymap compiles cleanly on any wired-only build.

Firmware size delta: +160 bytes (well within flash budget).
rootiest merged commit e8433ba5d9 into main 2026-04-23 02:59:38 +00:00
rootiest deleted branch feat/speculative-hold 2026-04-23 02:59:39 +00:00
Sign in to join this conversation.