Skip to content

Commit

Permalink
aod: avoid spinning DisplayApp under high LVGL load
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9064 committed Jun 19, 2024
1 parent 2104c71 commit c5aac9a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,16 @@ void DisplayApp::Refresh() {
// If not true, then wait that amount of time
queueTimeout = CalculateSleepTime();
if (queueTimeout == 0) {
// Keep running the task handler if it still has things to draw
while (!lv_task_handler()) {
// Only advance the tick count when LVGL is done
// Otherwise keep running the task handler while it still has things to draw
// Note: under high graphics load, LVGL will always have more work to do
if (lv_task_handler() > 0) {
// Drop frames that we've missed if drawing/event handling took way longer than expected
while (queueTimeout == 0) {
alwaysOnTickCount += 1;
queueTimeout = CalculateSleepTime();
}
};
// Drop frames that we've missed if the loop took way longer than expected to execute
while (queueTimeout == 0) {
alwaysOnTickCount += 1;
queueTimeout = CalculateSleepTime();
}
}
} else {
queueTimeout = portMAX_DELAY;
Expand Down

0 comments on commit c5aac9a

Please sign in to comment.