Screens transition more than 4 screens


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


What LVGL version are you using?

v 7.11

What do you want to achieve?

screen transition with more than 2 structures

What have you tried so far?

I made back button to turn back to the previous screen, and the home button to go back to the main (first) screen.

I went from the first screen to the second screen, and then from the second screen to the third screen.
I can go from the third screen to the second screen, but I can’t go to the first screen from the second screen by pressing the back button again.

The screens are randomly freezing after I pushed the back button several times.
I made 11 screens and there is 4~5 depth.

And I wonder which is correct or much better:

  1. use lv_scr_load and load the previous screen
  2. call the function that creates and calls the corresponding screen

Code to reproduce

// the function is called when the back button pressed
static void back_btn_touched_cb(lv_obj_t * btn, lv_event_t event)
	if(event == LV_EVENT_PRESSED && event != LV_EVENT_GESTURE)
// I made the back button on several screens, 
// I checked which screen is on.

    	current_scr = lv_obj_get_screen(lv_back_btn);

    	if(current_scr == second_scr)
                // first_screen_on();

    	else if(current_scr == third_scr)
                // second_screen_on();

    	else if(current_scr == fourth_scr )

    	const char * screen_name = lv_obj_get_user_data(current_scr);
    	printf("The current screen is %s\r\n", screen_name ? screen_name : "N/A");


Screenshot and/or video

after on the 3rd screen, I cannot go to the 1st screen, even though I’ve already come to the 2nd from the 3rd. The back button suddenly doesn’t work.