Skip to content
Snippets Groups Projects
Commit a036d1e9 authored by Colin's avatar Colin
Browse files

use OS sleep instead of polling to reduce CPU usage

without this lvgl never releases the CPU, and just pegs one of the cores
to 100%. see
<https://github.com/lvgl/lvgl/blob/master/docs/porting/timer_handler.rst>
parent 1e5ae8f8
No related branches found
No related tags found
No related merge requests found
......@@ -284,7 +284,8 @@ int main(int argc, char *argv[]) {
/* Periodically run timer / task handler */
while(1) {
lv_timer_periodic_handler();
uint32_t time_till_next = lv_timer_handler();
usleep(time_till_next * 1000);
}
return 0;
......
......@@ -591,7 +591,8 @@ int main(int argc, char *argv[]) {
uint32_t timeout = conf_opts.general.timeout * 1000; /* ms */
while(1) {
if (!timeout || lv_disp_get_inactive_time(NULL) < timeout) {
lv_timer_periodic_handler();
uint32_t time_till_next = lv_timer_handler();
usleep(time_till_next * 1000);
} else if (timeout) {
shutdown();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment