Strange screen overlap issue

I am having a strange overlapping issue while trying to load a screen from another screen.
For example, let say in a task I am doing this:

	lv_scr_load_anim(home_scr, LV_SCR_LOAD_ANIM_FADE_ON, 500, 10, 0);
//create another task to load the menu after some delay
	task2 = lv_task_create(menu_scr_load, 3000, LV_TASK_PRIO_MID, NULL);

and in task2

	lv_scr_load_anim(main_menu_scr, LV_SCR_LOAD_ANIM_FADE_ON, 500, 10, 0);

this works fine in the simulator, but when i ran it on my hardware, then 2 screens kinda overlap each other & creates a mess. Do i have to somehow manually clean the prev screen after/before loading a new screen?
This is just to simulate that screen loading works fine with my code, in reality it will be triggered by a hw input ofc.

Do you see the “mess” only during the animation (500 ms) or it keeps messed up even when the animation is finished?

I can’t actually see the 2nd screen load animation, I can see my 2nd screen behind the first screen at some places on the screen.

You see those icons, in the back? that’s my 2nd screen.

@kisvegabor any update on this please :slightly_frowning_face:
I also forgot to mention that, everything works fine in the simulator.

LV_COLOR_DEPTH is also the same in the simulator and real hardware?

yes, 16bit.

Hmm. Please send a good quality video about a slow (e.g. 10000 ms) screen change animation.

I suggest trying this: add a button to the new screen with a click event that calls lv_obj_invalidate(lv_scr_act()). When the screen is loaded click the button. Does it remove the artifacts?

For now I just want to be sure that UI can work, so I can simulate that button press in a task right? But that too has no effect to my issue. This is what I have tried:

I have added lv_obj_invalidate(lv_scr_act()) just before that line, tried after that line too, nothing changed.

Hmm… This is interesting…

it just stuck there like that forever.

Great, we are getting closer :slight_smile:

Let’s enable logging to find out if LVGL sees some problems.

I don’t know why but even after I have enabled logging from menuconfigm and set it to “Trace - Detailed information” I still couldn’t see any log related to lvgl. I had to enable “Print the log with ‘printf’” option. Also, the esp log is set to Verbose, but I don’t think it has any relation to lvgl’s logging.
But anyways, here’s what I found found interesting in the logs, I am going mad now that I haven’t checked the logs before :man_facepalming:

Warn: Couldn't allocate memory 	(lv_mem.c #199 lv_mem_alloc())
Warn: Couldn't allocate memory 	(lv_mem.c #306 lv_mem_realloc())
Error: _lv_mem_buf_get 	(lv_mem.c #511 _lv_mem_buf_get())
Error: Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size) (0x00000000) 	(lv_debug.c #127 lv_debug_log_error())

Increasing Memory from 32 to 64 fixed the issue.

Glad to hear that :slight_smile:

1 Like