fix(ui): CardKB key handling - debounce, Fn modifier for submit/accents

CardKB is level-triggered (repeats the held byte every poll) and its Enter
key collided with the on-screen keyboard grid's own commit action, causing
duplicate characters and accidental message sends. Debounce polling and use
the CardKB v1.1 Fn modifier (confirmed working on real hardware) instead of
tracking navigation state: plain Enter now behaves like the physical centre
button, Fn+Enter submits, Fn+Tab opens the Hold-Enter equivalent, and
Fn+<letter> opens that letter's accent popup directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-07-22 17:49:04 +02:00
co-authored by Claude Sonnet 5
parent 7cae6470bf
commit ad4668242b
4 changed files with 88 additions and 25 deletions
+5 -1
View File
@@ -200,7 +200,11 @@ class UITask : public AbstractUITask {
// without that bus, or when nothing ACKs 0x5F at boot.
#if defined(ENV_PIN_SDA) && defined(ENV_PIN_SCL)
bool _has_cardkb = false;
uint32_t _cardkb_poll_ms = 0;
// CardKB is level-triggered, not edge-triggered -- it keeps returning the
// same byte for as long as the physical key is held, not just once. Track
// the last raw byte seen so a held key enqueues exactly one press instead
// of one per poll tick.
uint8_t _cardkb_last_raw = 0;
#endif
void pollCardKB();