2 Commits

Author SHA1 Message Date
575341a22b specify scdoc as a native dependency instead of a runtime dependency 2024-10-05 12:49:16 +00:00
a9f2f4602a 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>
2024-10-05 12:49:16 +00:00
3 changed files with 5 additions and 3 deletions

View File

@@ -284,7 +284,8 @@ int main(int argc, char *argv[]) {
/* Periodically run timer / task handler */ /* Periodically run timer / task handler */
while(1) { while(1) {
lv_timer_periodic_handler(); uint32_t time_till_next = lv_timer_handler();
usleep(time_till_next * 1000);
} }
return 0; return 0;

View File

@@ -11,7 +11,7 @@ deplibinput = dependency('libinput')
deplibudev = dependency('libudev') deplibudev = dependency('libudev')
if get_option('man') if get_option('man')
depscdoc = dependency('scdoc') depscdoc = dependency('scdoc', native: true)
endif endif
common_include_dirs = include_directories('.') common_include_dirs = include_directories('.')

View File

@@ -591,7 +591,8 @@ int main(int argc, char *argv[]) {
uint32_t timeout = conf_opts.general.timeout * 1000; /* ms */ uint32_t timeout = conf_opts.general.timeout * 1000; /* ms */
while(1) { while(1) {
if (!timeout || lv_disp_get_inactive_time(NULL) < timeout) { 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) { } else if (timeout) {
shutdown(); shutdown();
} }