Skip to content

Commit eb945a8

Browse files
fix(timer) delay execution only until the next timer fires up (#61)
* fix(timer) delay execution only until the next timer fires up lv_timer_handle returns the time in ms until the next timer will fire. We need to delay only that much time for optimal execution. Signed-off-by: Cristian Stoica <[email protected]> * Update main.c Co-authored-by: Gabor Kiss-Vamosi <[email protected]> --------- Signed-off-by: Cristian Stoica <[email protected]> Co-authored-by: Gabor Kiss-Vamosi <[email protected]>
1 parent 8e98544 commit eb945a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ int main(void)
7878

7979
/*Handle LVGL tasks*/
8080
while(1) {
81-
lv_timer_handler();
82-
usleep(5000);
81+
uint32_t idle_time = lv_timer_handler(); /*Returns the time to the next timer execution*/
82+
usleep(idle_time * 1000);
8383
}
8484

8585
return 0;

0 commit comments

Comments
 (0)