From bf9f385e9f5dc62a4745f0abb67927efefbc0650 Mon Sep 17 00:00:00 2001 From: Georgy Dyuldin Date: Sun, 29 Sep 2024 13:26:03 +0300 Subject: [PATCH] Increase responsibility --- src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 3146908..3b1f0ce 100644 --- a/src/main.c +++ b/src/main.c @@ -126,10 +126,14 @@ int main(void) { lv_scr_load(main_obj); #endif + int64_t next_loop_time, sleep_time; while (1) { - lv_timer_handler(); + next_loop_time = get_time() + lv_timer_handler(); event_obj_check(); - usleep(5 * 1000); + sleep_time = next_loop_time - get_time(); + if (sleep_time > 0) { + usleep(sleep_time * 1000); + } } return 0; }