Fix UART caps LED leak, framed Fn+1 ESC, and modifier state leak on mode switch#1
Merged
Merged
Conversation
The caps one-shot indicator (green LED) never cleared after the next alphabetic key press in UART or ESP-NOW modes, because app_clear_caps_one_time() was only called from the I2C/BLE HID ASCII output branch. Add a mode-independent caps consumer that fires when a Latin letter is pressed (excluding modifier keys and Fn-combined presses).
The Fn+1 ESC branch for UART sent a bare 0x1B via bsp_uart_send,
which hosts parsing the 5-byte {0xAA, 0x03, key_id, state, checksum}
frame format drop. Replace with app_send_uart_frame(KEY_ESC, true) so
ESC presses are delivered as regular framed key events, matching the
host UART protocol used by the rest of the keys.
app_mode_apply() re-initialised the comms peripherals but left the modifier flags untouched. Combined with app_led_blink_white() then restoring the previous current_r/g/b, the new mode would boot with Sym/Caps/Fn flags still engaged and the LED in the pre-switch colour (e.g. cyan when both Sym and Caps were active). Clear the modifier flags and refresh the LED at the end of app_mode_apply() so each new mode starts clean.
Mark this build as containing the fixes applied in the preceding three commits so host-side libraries can distinguish the patched firmware from the original (0x01) via the I2C version register and the AT+VERSION? production-test command.
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.
Summary
Three bug fixes for UART mode, all observed and reproduced on hardware.
Also includes a
FIRMWARE_VERSION0x01 → 0x02 bump so host-side libraries can detect the fixed build.Fn + Sym + N1. Caps one-shot LED stays lit in UART/ESP-NOW modes
After
Aais tapped (one-shot uppercase armed → green LED on), the next alphabetic key is correctly returned as uppercase and the host sees lowercase from then on, but the green LED never clears.app_clear_caps_one_time()is only called from the I2C / BLE HID ASCII output branch, socaps_one_timestays set in UART/ESP-NOW. Fix: add a mode-independent caps consumer that fires when a Latin letter is pressed.2. Fn + 1 (ESC) sent as raw byte in UART mode
This was previously flagged and acknowledged in earlier correspondence (developer's answer: "Right, I overlooked that. It should send an ESC event, just like in I2C mode.") but the fix isn't yet in the current
444b5bdsnapshot. The ESC branch for UART sends a bare `0x1B` via `bsp_uart_send()`, which hosts parsing the 5-byte `{0xAA, 0x03, key_id, state, checksum}` frame format drop. Fix: use `app_send_uart_frame(KEY_ESC, true)` so the ESC press is delivered as a regular framed key event.3. Modifier state / LED leak across mode switch
Steps to reproduce: tap `Sym` (blue LED), then `Aa` x2 (caps lock → cyan LED), then `Fn + Sym + 1`. After the white blink the LED stays cyan and the new mode boots with `sym_mode` and `caps_locked` still engaged. `app_mode_apply()` re-initialises peripherals but leaves modifier flags untouched, and `app_led_blink_white()` restores the pre-switch `current_r/g/b`. Fix: clear `sym_mode`, `sym_pressed`, `fn_pressed`, `caps_one_time`, `caps_locked`, `caps_hold` and refresh the LED at the end of `app_mode_apply()`.
Reproduction
If a fix for any of these is already prepared in an internal branch, or if this isn't the right repository, apologies for the noise — feel free to close.