Merge branch 'pr-os-sleep' into 'master'

use OS sleep instead of polling to reduce CPU usage

See merge request postmarketOS/buffybox!31
This commit is contained in:
Johannes Marbach
2024-10-05 18:34:02 +00:00
2 changed files with 4 additions and 2 deletions

View File

@@ -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;

View File

@@ -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();
}