fix(cardkb): no background poll task when the CardKB shares the display's I2C bus

On the ProMicro the CardKB sits on Wire with the SSD1306. The poll task,
active while a frame goes out, read the keyboard mid-transfer: frozen
screen and a boot loop since rc3. Fixes #51.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-16 15:38:26 +02:00
co-authored by Claude Opus 5.5
parent 31b8c3fbb0
commit 9dbf4501a3
+5
View File
@@ -125,6 +125,11 @@ void UITask::cardkbTask(void* self) {
void UITask::startCardKBCapture() {
#if defined(CARDKB_I2C) && defined(NRF52_PLATFORM)
if (!_has_cardkb) return;
// A CardKB on the primary bus (ProMicro: CARDKB_I2C=Wire) shares it with an
// I2C display. The task would then read the keyboard in the middle of a frame
// going out to the OLED -- a garbled bus, a frozen screen and a reboot. An
// OLED frame takes milliseconds anyway, so the loop's own poll is enough.
if (&CARDKB_I2C == &Wire) return;
SemaphoreHandle_t m = xSemaphoreCreateMutex();
if (!m) return;
// Publish the mutex BEFORE creating the task: at higher priority it starts