Callback when all objects drawn

I couldn’t find an event that is triggered at the moment the last line of the screen is drawn. A similar post was published here: Is there any way to get a callback when screen is competely drawn?:

The answer provides a solution where the event is triggered every time a draw operation occurs, but I would expect there to be an event specifically at the end when the parent and all children are drawn. I have expected it would be one of the LV_EVENT_DRAW_… options, but they dont match my case.

Hi,

If you have configures LVGL for partial update (e.g. provided 10kB as draw buffer(s)) and only 2 buttons are redrawn on the middle of the screen, the last line of the display is not update.

What is the specific problem that you need to solve?

Similar to the linked post, I would also like to trigger backlight fade-out/in events. I communicate with the LCD driver using an SPI interface, and when the entire screen is changed, the redrawing is noticeably visible. To address this, I plan to implement a fade-out effect before drawing a new screen and a fade-in effect after all pixels of the new screen are redrawn.

My additional challenge arises when showing a “notification screen”. In this case, I use a single parent object, and depending on the notification type, I change the screen background, icons, and labels. Although the screen essentially remains the same, all pixels need to be redrawn, where again the refresh is visible.

I recommend this:

  • check the size of the area parameter of the flush_cb. If it’slarge, fade out.
  • use lv_disp_flush_is_last(drv) to find the last refresh. If there was a fade out, fade it.