Skip to content

Handle SPI contention in LVGL flush and optimize mutex usage#114

Draft
zjwhitehead wants to merge 3 commits into
masterfrom
patch/screen-tear
Draft

Handle SPI contention in LVGL flush and optimize mutex usage#114
zjwhitehead wants to merge 3 commits into
masterfrom
patch/screen-tear

Conversation

@zjwhitehead

Copy link
Copy Markdown
Member

No description provided.

Add a static `flush_skipped` flag to record when a display flush is skipped because the SPI bus mutex times out. When a flush is dropped the code still signals LVGL via `lv_display_flush_ready`, but sets `flush_skipped = true` so `updateLvgl()` will invalidate the entire screen on the next tick and force a full repaint to recover stale pixels. The flag is cleared when the invalidate is issued, and the logic runs only on the LVGL-driving task.
Stop holding the shared SPI bus across BMS cache reads: remove the display CS deselect here and clarify that the display flush owns displayCS, take the SPI mutex for the BMS update, then immediately deselect bmsCS and give the mutex after bms_can->update(). This prevents long SPI holds and contention with TFT flushes; also removes the redundant BMS CS/mutex release at the end of the function.
Introduce a single-writer CPU temperature cache to avoid concurrent tsens access. Expose primeCpuTemperatureCache(), refreshCpuTemperature(), and getCachedCpuTemperature() in inc/sp140/system_monitors.h and implement them in system_monitors.cpp (cachedCpuTemp made volatile; refresh throttles reads to 1 Hz; prime called once at startup). Make ctrlSensorTask the sole runtime owner of tsens by calling refreshCpuTemperature(), and prime the cache during initSimpleMonitor().

Also: documentation updates in CLAUDE.md (toolchain/build quirks, testing notes, path/name tweaks, lib dir rename) and enable CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE in sdkconfig.defaults with rationale for safer OTA rollbacks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant