From 9dbf4501a3c0154c1e07de09d5dc0fbfd4defab4 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Fri, 16 Oct 2026 15:38:26 +0200 Subject: [PATCH] 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 --- examples/companion_radio/ui-new/CardKB.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/companion_radio/ui-new/CardKB.h b/examples/companion_radio/ui-new/CardKB.h index 1f369339..f61b9ef4 100644 --- a/examples/companion_radio/ui-new/CardKB.h +++ b/examples/companion_radio/ui-new/CardKB.h @@ -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