Calling lv_obj_clean(lv_scr_act()) to clear the current screen prevents further object creation?


I read on this forums that one can use lv_obj_clean(lv_scr_act()) to clear the current screen. When I do this the screen is cleared but I cannot seem to be able to display any objects to the screen after this.
Do I need to re-initialize the default screen after calling lv_obj_clean(lv_scr_act())?
If so, how to do this?


I can’t reproduce this behavior. With the following code I see the label appear on the screen (and not the meter):

    lv_obj_t * meter = lv_linemeter_create(lv_scr_act(), NULL);
    lv_obj_set_size(meter, LV_VER_RES, LV_VER_RES);
    lv_obj_align(meter, NULL, LV_ALIGN_CENTER, 0, 0);  
    lv_label_set_text(lv_label_create(lv_scr_act(), NULL), "test");

There shouldn’t be any reinitialization required.


Thanks for the reply. It is interesting that this works for you.

I have fixed this issue by increasing the refresh rate. What I believe was happening was that the obj was created in the same tick or time step as a screen refresh. And the obj was never displayed even though it was created after the screen was cleared.
Increasing the refresh rate seems to have fixed this issue without modifying the code.