Board:
Arduino Portenta H7
LVGL Version: v9.2.2
Arduino Core: Arduino Mbed OS Portenta Boards v4.3.1
Screen Resolution: 1024x768 (Waveshare 10.1’ display)
Description:
I’m developing a UI on the Arduino Portenta H7 using LVGL v9.2.2. The layout includes:
- A fixed header (
w:1024 h:100
) - A fixed footer (
w:1024 h:100
) - A body container (
w:1024 h:568
) between the header and footer
There are 6 pages, and I use a switch_page(index)
function that:
- Clears the existing content from the body container
- Creates the new page’s content dynamically based on the given index
Each page has different UI widgets (labels, LEDs , Buttons, etc.). All 6 pages are working individually, but when I switch pages, I sometimes see blank screens or screen flicker, and occasionally the screen scrolls from bottom to top unexpectedly.
Questions / Issues:
- Is there a recommended way in LVGL v9.2.2 to destroy and recreate dynamic content inside a fixed body container for clean page switching?
- Is
lv_obj_clean(body_container)
enough, or should I uselv_obj_del(body_container)
and recreate it each time? - Could the issue be due to missing
lv_refr_now()
or improper invalidation of the screen? - Is there a best practice for lazy-loading tab/page content in a constrained system like the Portenta H7 with LVGL v9+?
Reference code:
void switch_page(uint8_t index) {
lv_obj_clean(body_container);
switch (index) {
case 0: create_operation_page(); break;
case 1: create_io_status_page(); break;
case 2: create_ppc_status_page(); break;
case 3: create_maintenance_page(); break;
case 4: create_debug_page(); break;
case 5: create_config_page(); break;
}
}