aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp
diff options
context:
space:
mode:
authormark9064 <30447455+mark9064@users.noreply.github.com>2024-04-23 00:16:19 +0100
committerJF <JF002@users.noreply.github.com>2024-08-05 20:32:43 +0200
commita407902b0600ca0b2b26c91a4597c856d16e4b26 (patch)
tree3a80d29b3580837df53cf303d1f1a5836cbf5d03 /src/displayapp
parent3e8accde6969737183eeb14c4b73761f8932197f (diff)
aod: avoid spinning DisplayApp under high LVGL load
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/DisplayApp.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index bc9a57bc..f5a92117 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -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;