fix(ui-new): keep CardKB key presses during an e-ink refresh

While the loop task is inside a display refresh (seconds on a big e-ink
panel) the CardKB isn't polled, and the keyboard's own one-key buffer
drops every press but the last.

A small FreeRTOS task polls the CardKB every 10 ms while a refresh is in
progress, into a 16-entry queue that the loop drains afterwards. A mutex
guards the shared Wire1 bus against querySensors(). The task is created
after the screens so its stack doesn't starve their allocations, and the
loop falls back to the old direct polling if it can't be created.

Tested on hardware: Wio Tracker L1 + CardKB, several quick presses during
an 800x480 refresh all arrive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KxAZVAbhhYr18Dd4guTQM1
This commit is contained in:
pmow
2026-10-09 08:48:03 -10:00
co-authored by Claude Opus 5.5
parent 5c66795cbd
commit 06e741b310
3 changed files with 138 additions and 7 deletions
@@ -229,7 +229,7 @@ private:
// Sensors: every reading but the battery (above) and the position (GPS).
if (!_lpp_at || millis() - _lpp_at > 5000) { // both passes (measure, draw) read one query
_lpp.reset();
sensors.querySensors(0xFF, _lpp);
{ CardKBBusLock bus_lock; sensors.querySensors(0xFF, _lpp); } // shares the CardKB's bus
_lpp_at = millis() | 1;
}
static const struct { uint8_t type; const char* name; } NAMES[] = {