Handle SPI contention in LVGL flush and optimize mutex usage#114
Draft
zjwhitehead wants to merge 3 commits into
Draft
Handle SPI contention in LVGL flush and optimize mutex usage#114zjwhitehead wants to merge 3 commits into
zjwhitehead wants to merge 3 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.