Repository navigation
keychron: harden CKBT51 Bluetooth link and raise report rate to 133 Hz (26 Pro models) - #529
Open
thementalcoding wants to merge 6 commits into
Open
thementalcoding wants to merge 6 commits into
thementalcoding wants to merge 6 commits into
Conversation
…08/201) - UART parser: bound frame length to PACKET_MAX_LEN, chunked dfu_tx, resync - flush report queue on EVT_RECONNECTING; retry timer reset on FIFO_FULL - drop dead bluetooth_report_protocol; LPM gate: no STOP1 with pending reports/retry/events - rate-limit bluetooth_connect() to 1/500ms; opt-in CKBT51_FAST_WAKE (off by default)
…P-110/111a) Applies uniformly to all CKBT51 boards; LKBT51 stack intentionally untouched.
…ce opt-in note (SDD WP-111b/202/203)
25 boards only applied report_rate/reconnect_timeout if the CKBT51 module booted within 1s of MCU start; a slow module boot or switching to Bluetooth later left the module running on factory defaults. Use the existing firstDisconnect flag instead of an uptime window, and align k13_pro.
The KC_TASK case in q6_pro's process_record_kb() called ckbt51_factory_reset() on key press, so Fn+F3 wiped the Bluetooth pairing information and module parameters on every q6_pro keymap (default and via, ansi and iso encoders). None of the other Keychron models that handle KC_TASK do this. Drop the stray call so Fn+F3 only emits the task-view shortcut like the rest of the family.
ckbt51_set_local_name() expects a plain C string, but q1_pro passed
STR(PRODUCT), so the advertised name included the literal quotes
("Keychron Q1 Pro"). Use PRODUCT directly in both the own_bt_param_init()
and ckbt51_param_init() paths, matching every other CKBT51 board.
Author
|
Added two commits on top of the CKBT51 work:
The PR now covers 26 CKBT51 boards / 95 variants, with the two point fixes above. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
keychron: harden CKBT51 Bluetooth link and raise report rate to 133 Hz (26 Pro models)
Summary
Six commits improving Bluetooth reliability and report rate on the Keychron
CKBT51-based Pro range (K Pro / Q Pro):
bluetooth/— four link-handling fixes: bound the UART frame parser andchunk the DFU TX path; flush the pending report queue on reconnection; reset
the retry timer on
ACK_FIFO_FULL_ERRORinstead of resending immediately;and gate STOP1 so low-power mode is not entered with work still pending.
Connect attempts are also rate-limited (one per 500 ms), and an opt-in
CKBT51_FAST_WAKEis compiled out by default.report_rate90 → 133 Hz andreconnect_timeout5 → 60 s, applied on the first Bluetooth initafter power-on. The old 1 s (and k13_pro's 5 s) MCU-uptime window is gone, so
a slow module boot or a late switch to Bluetooth no longer leaves the module
on factory defaults.
k13_pro/: LPM tunables documented inconfig.h; the debounceexperiment is recorded as opt-in only (not enabled).
q6_pro/: removed an accidentalckbt51_factory_reset()bound toFn+F3 that wiped pairing and module parameters on every keymap.
q1_pro/: the advertised Bluetooth name no longer includes literalquotes (
"Keychron Q1 Pro"→Keychron Q1 Pro).Scope: 26 CKBT51 boards, 95 variants (K1–K17 Pro, Q1–Q14 Pro), plus the
q6_pro/q1_pro point fixes. LKBT51 (the separate SPI stack) is intentionally
untouched. No JSON/PID/layout changes; default behaviour is unchanged except
for the parameters above and the Fn+F3 fix.
Why
A K13 Pro (ISO RGB, Linux host, Intel AX210) intermittently produced bursts of
repeated keystrokes and "silent" reconnections after short idle periods.
Analysis of the QMK side found:
EVT_DISCONNECTEDwas lost (UART overrun after STOP1 wake), the reportqueue was never flushed, so the backlog was replayed at ~3 ms/report after
the link came back — the most likely source of the burst symptom.
ckbt51_task()copied up to 255 bytes into a 32-byte stack buffer with nolength check (a 64-byte
GET_MODULE_INFOresponse is valid), i.e. anunbounded UART parser over a fixed buffer.
ACK_FIFO_FULL_ERRORwere issued immediately, without backoff.lpm_task()allowed STOP1 with reports, retries or events still pending.connectcommand,causing reconnect churn.
start, so slow-booting modules stayed on
report_rate = 90andreconnect_timeout = 5 s.Scope
keyboards/keychron/bluetooth/:bluetooth.c,ckbt51.c,lpm.c,report_buffer.c,report_buffer.h.keyboards/keychron/*_pro/*_pro.c: all 26 CKBT51 boards (K1–K17 Pro,Q1–Q14 Pro), each applying the module parameters on first Bluetooth init.
keyboards/keychron/k13_pro/{config.h,rules.mk}: documented LPM tunables;opt-in debounce note.
keyboards/keychron/q6_pro/q6_pro.candkeyboards/keychron/q1_pro/q1_pro.c:the two point fixes.
33 files, all under
keyboards/keychron/. No files outside that tree, and nochanges to the LKBT51 stack.
Build evidence
arm-gcc 14.2; each image passed DFU-suffix, VID/PID, size, CRC andmanifest/checksum checks.
ansi/iso,rgb/white) are reproduciblelocally; flash usage ≈ 24 % of 256 KB.
(26 models, 95 images,
manifest.json+SHA256SUMS).Testing
AX210. Minimum inter-report gap 7 → 5 ms, estimated ceiling ~143 → ~200
reports/s.
field use.
has been flashed on hardware.
modified.
Note on module parameters
The parameters are sent on the first Bluetooth init after power-on, not on
every reconnection. A module that is already initialised keeps its values until
the keyboard is power-cycled.
Checklist
qmk compilefor all 26 boards / 95 variants (QMK CLI, arm-gcc 14.2)clang-format 19.1.7 --dry-run --Werrorclean on changed filesqmk linton changed keyboards: only pre-existing findings in thisbranch (empty variant
rules.mk,viakeymap header, license header),none introduced here
keyboards/keychron/**