aod: avoid spinning DisplayApp under high LVGL load
This commit is contained in:
parent
3e8accde69
commit
a407902b06
|
@ -242,14 +242,16 @@ void DisplayApp::Refresh() {
|
||||||
// If not true, then wait that amount of time
|
// If not true, then wait that amount of time
|
||||||
queueTimeout = CalculateSleepTime();
|
queueTimeout = CalculateSleepTime();
|
||||||
if (queueTimeout == 0) {
|
if (queueTimeout == 0) {
|
||||||
// Keep running the task handler if it still has things to draw
|
// Only advance the tick count when LVGL is done
|
||||||
while (!lv_task_handler()) {
|
// 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 {
|
} else {
|
||||||
queueTimeout = portMAX_DELAY;
|
queueTimeout = portMAX_DELAY;
|
||||||
|
|
Loading…
Reference in a new issue