Increasing lag. lv_task_handler() takes longer each time it's called

I have an app that goes slower and slower the more I use it. It’s a simple UI with one small display and a few screens, a couple of which have countdowns. One has a progress bar. As you go through the workflow, from one screen to another it slows down over time and never recovers unless you reboot it. Logging has revealed that lv_task_handler() takes longer each time it’s called.

I’m guessing I need to free up resources by deleting something each time I leave a screen, but that hasn’t helped.

I’m very new to LVGL, the app I’m working on was written by someone else who is no longer involved.

This is running on an stm32h743zi, on FreeRTOS.

Any clues would be appreciated.

Thanks,
Tim

A couple things to check:

  • Are any LVGL tasks being created and never stopped? A lot of tasks running each time might be part of the problem.
  • When you move from one screen to another, you should delete the previous screen object so it doesn’t need to be “redrawn”.
  • Is lv_tick_inc being called at the correct speed? Does the speed at which it’s called change over time? I don’t think that would affect lv_task_handler's execution speed but it’s something to check.

Related to the second point here, when you update screens/views, are you recreating objects instead of updating them? If you create new objects when updating, you likely need to remove/delete the old ones.

1 Like

My guess it that you are always creating objects on screens and never deleted them. Due to this as time passes LVGL needs to draw a lot of overlapping objects.