How to handle animations while MCU is sleeping?

Description

Hi,

I’m using lvgl with mcu that works in sleep-wake_up mode.
After mcu wake up screen and all elements on it just continue their operations from positions(states) that it was before mcu fall in sleep mode.

Some of my screenes have scrollongs texts (example: “This_is_long_string_to_scroll”)
If mcu go to sleep mode, text just stop as it is. (example: “onl_string_to_scroll”)
I want to be able to see “start” of text (example:“This_is_long_stri”)

I thought about refreshing screen just before mcu go to sleep mode.
But maybe there is some other options to achieve this.

What MCU/Processor/Board and compiler are you using?

ESP32 with IDF, LVGL 5.3

What do you want to achieve?

I want to see begins of each label when MCU in sleep mode.
Refresh all objects on screen before MCU fall in sleep mode.
At least, I want refresh all text labels on screen.

What have you tried so far?

I have tried to send lv_obj_refresh_style() before mcu send to sleep mode, but no affects, even after wake up all labels continues to scroll from previous positions.

You need to wake up the MCU every 10-30ms to run lv_task_handler.

Once lv_task_handler finishes running you can immediately sleep again. If there is no need to update the screen lv_task_handler will return almost immediately and thus your MCU will still be asleep most of the time.

1 Like

To reset the labels (start form x = 0 again) you should refresh their text manually. For example

lv_label_set_text(my_label, NULL); //Pass NULL to refresh the text.
1 Like

I suppose the question is a bit ambiguous. I interpreted it as meaning that you wanted the processor to be sleeping as much as possible (for power savings), but maybe you meant a full suspend (i.e. what you would find on a smartphone). In that case @kisvegabor’s method should do what you want.