Refresh all labels on a screen


I have set multiple labels text using lv_label_set_static() to global char arrays. From a lv_timer I then populate these arrays every second with data arriving from my serial port. However the labels don’t update to show the new data in their arrays. If I load a new screen and return the new label text appears.
I am looking for a way to perhaps send an event that updates all labels?

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


What LVGL version are you using?


What do you want to achieve?

Have the labels text change whenever the array changes.

What have you tried so far?

I could probably call lv_label_refr_text(obj) for each label but there are quite a lot of them and at that point I could just set the text in the timer.
I could also Invalidate the screen but that seems costly and will mess up any animations.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

unsigned char strings[256][40] = {{'\0'}};
int main(void)
    lv_timer_t * refreshVariables = lv_timer_create(refreshCB, 1000,NULL);
void refreshCB(lv_timer_t * event)


I am fairly certain you have to refresh the labels manually with the methods you yourself already described above. The only way to optimize this would be to determine which labels are visible on screen or updated by your timer, and only change the text values of those labels.


Ah okay, that is unfortunate, what is the purpose of the static set in that case, to save some memory? It would be useful if there was an event I could send that would refresh all labels or all objects of a certain type.