Skip to content

Commit be98013

Browse files
committed
aod: avoid spinning DisplayApp under high LVGL load
1 parent 4fcfcf6 commit be98013

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/displayapp/DisplayApp.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,16 @@ void DisplayApp::Refresh() {
242242
// If not true, then wait that amount of time
243243
queueTimeout = CalculateSleepTime();
244244
if (queueTimeout == 0) {
245-
// Keep running the task handler if it still has things to draw
246-
while (!lv_task_handler()) {
245+
// Only advance the tick count when LVGL is done
246+
// Otherwise keep running the task handler while it still has things to draw
247+
// Note: under high graphics load, LVGL will always have more work to do
248+
if (lv_task_handler() > 0) {
249+
// Drop frames that we've missed if drawing/event handling took way longer than expected
250+
while (queueTimeout == 0) {
251+
alwaysOnTickCount += 1;
252+
queueTimeout = CalculateSleepTime();
253+
}
247254
};
248-
// Drop frames that we've missed if the loop took way longer than expected to execute
249-
while (queueTimeout == 0) {
250-
alwaysOnTickCount += 1;
251-
queueTimeout = CalculateSleepTime();
252-
}
253255
}
254256
} else {
255257
queueTimeout = portMAX_DELAY;

0 commit comments

Comments
 (0)