Description
When creating several screens and loading them one after another, only the last two screens are displayed.
MCU and board type
STM32F205RET (128K SRAM, 512K Flash) in a custom board, with gcc-arm(1), GNU make(1), and STM32 HAL.
What LVGL version are you using?
7.11.0
What do you want to achieve?
I want to create several screens and switch between them with no user interaction, instead according to a time delay.
What have you tried so far?
I copied the sample code from the screens doc page.
Code to reproduce
int main(void)
{
// Initialisation and configuration code
// ...
// Screen 1 (never displayed!)
lv_obj_t *pScreen1 = lv_scr_act();
lv_obj_t *pLabel1 = lv_label_create(pScreen1, NULL);
lv_label_set_text(pLabel1, "Screen 1!");
lv_scr_load_anim(pScreen1, LV_SCR_LOAD_ANIM_MOVE_TOP, 250, 1000, true);
// Screen 2 (never displayed!)
lv_obj_t *pScreen2 = lv_obj_create(NULL, NULL);
lv_obj_t *pLabel2 = lv_label_create(pScreen2, NULL);
lv_label_set_text(pLabel2, "Screen 2!");
lv_scr_load_anim(pScreen2, LV_SCR_LOAD_ANIM_MOVE_TOP, 250, 1000, true);
// Screen 3 (display jumps to Screen3 at program start?)
lv_obj_t *pScreen3 = lv_obj_create(NULL, NULL);
lv_obj_t *pLabel3 = lv_label_create(pScreen3, NULL);
lv_label_set_text(pLabel3, "Screen 3!");
lv_scr_load_anim(pScreen3, LV_SCR_LOAD_ANIM_MOVE_TOP, 250, 1000, true);
// Screen 4 (screen load and animated transition, working properly.)
lv_obj_t *pScreen4 = lv_obj_create(NULL, NULL);
lv_obj_t *pLabel4 = lv_label_create(pScreen4, NULL);
lv_label_set_text(pLabel4, "Screen 4!");
lv_scr_load_anim(pScreen4, LV_SCR_LOAD_ANIM_MOVE_TOP, 250, 1000, true);
while(1)
{
lv_task_handler();
HAL_Delay(5);
}
}
Suspicions
- Is my MCU’s 128K SRAM too little for storing all four screens?
- Is this problem why some people create custom heaps?