Skip to content

Commit

Permalink
fix(timer) delay execution only until the next timer fires up (#61)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
cristian-stoica and kisvegabor authored Oct 18, 2024
1 parent 8e98544 commit eb945a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ int main(void)

/*Handle LVGL tasks*/
while(1) {
lv_timer_handler();
usleep(5000);
uint32_t idle_time = lv_timer_handler(); /*Returns the time to the next timer execution*/
usleep(idle_time * 1000);
}

return 0;
Expand Down

0 comments on commit eb945a8

Please sign in to comment.