LVGL screen freezing/lagging after entering custom menu (Modbus RTU/TCP tasks running)

What do you want to achieve?

The system includes a Modbus TCP/IP (Wi-Fi) slave mode, a Modbus RTU (UART) master mode, and an LVGL task. (There are a few other tasks as well, but they perform very simple functions.) I’ve been working on this for a long time. I just can’t seem to fix the screen freezing issue when I enter the menu. Everything runs smoothly when returning to the main screen. As shown in the video, I was able to make a smooth transition three times when the system started up, but then the smoothness disappeared and it started freezing. I designed the main screen using Squareline. I coded the settings section myself. I need your help.

What have you tried so far?

-“Changed the ‘buffer’ size,”

-“I used a ‘single-double buffer,’”

-“I increased the task priority.”

Code to reproduce

/*You code here*/

Screenshot and/or video

https://drive.google.com/drive/folders/1EZUWoITbV9XMNIeyx3HkqycfyaPHrXkL?usp=sharing

Environment

  • MCU/MPU/Board: ESP32 P4 Dev Kit
  • LVGL version: V9.3.0

Hi @mstfablbl. Have you tried seeing the delays for each task? Are you using psram or iram? You can try switch between to test

First of all, thank you. I haven’t had the chance to consider your advice yet.

I had designed the main screen in Squareline, and created the menu (settings) section using LVGL’s lv_menu() function. However, when creating the menu, I had created it on top of the active screen using lv_create_settings_menu(lv_screen_active()), and this apparently caused the objects on the main screen to remain there without being cleared, leading to lag. I created the menu on a new ‘screen’. The lag issue in the menu has now been resolved.

This is my first HMI design. There’s something that strikes me as odd: when I looked into it, I’d read that deleting objects from the screen is detrimental to performance. However, when I hid the objects instead of deleting them, I experienced severe lag and freezing. Apologies for my English ::))

Translated with DeepL.com (free version)

Hello,

If you do not call lv_obj_delete(), you must not call lv_obj_create() again for the same objects.

Either never delete objects but never create the same object twice, or delete screens when closing them.
I have found deleting screens/objects when no longer wanting to show objects works fine and recommend doing that anyway.

This was my first time designing an HMI. During my preliminary research, I came across the advice: “Don’t delete any data displayed on the screen; use the show/hide method instead,” but this gave me a lot of trouble.
Is there a guide that covers the “basics/rules” of HMI design? Thank you…

Hello,

This is not really a matter of HMI design, so much as specifics for LVGL. The show/hide method is indeed better if you have unlimited memory available for LVGL and are willing to go through all of the trouble as you say.
Again, I recommend just deleting a screen upon switching, this will delete all of the objects on the screen.