mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-01 10:21:59 +00:00
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:
@@ -125,6 +125,11 @@ void UITask::cardkbTask(void* self) {
|
|||||||
void UITask::startCardKBCapture() {
|
void UITask::startCardKBCapture() {
|
||||||
#if defined(CARDKB_I2C) && defined(NRF52_PLATFORM)
|
#if defined(CARDKB_I2C) && defined(NRF52_PLATFORM)
|
||||||
if (!_has_cardkb) return;
|
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();
|
SemaphoreHandle_t m = xSemaphoreCreateMutex();
|
||||||
if (!m) return;
|
if (!m) return;
|
||||||
// Publish the mutex BEFORE creating the task: at higher priority it starts
|
// Publish the mutex BEFORE creating the task: at higher priority it starts
|
||||||
|
|||||||
Reference in New Issue
Block a user