Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve lvgl memory #676

Open
1achy opened this issue Mar 15, 2024 · 23 comments
Open

Improve lvgl memory #676

1achy opened this issue Mar 15, 2024 · 23 comments
Labels
question Further information is requested

Comments

@1achy
Copy link

1achy commented Mar 15, 2024

i use Sunton ESP32-S3 7" 800*480

Device Memory

Free Heap | 65.80 KiB
Free Block | 55.98 KiB
Fragmentation | 14%
PSRam Free | 7.18 MiB
PSRam Size | 7.99 MiB

Total | 64.00 KiB
Free | 5.61 KiB
Fragmentation | 14%

out of memory ..... block screen...

solution reflash firmware ...

@1achy 1achy added the question Further information is requested label Mar 15, 2024
@fvanroie
Copy link
Collaborator

Try increasing # define LV_MEM_SIZE (64 * 1024U) // 64Kb on ESP32 with PSram
or set #define LV_MEM_CUSTOM 1

@1achy
Copy link
Author

1achy commented Mar 17, 2024

I ever used https://nightly.openhasp.com/ precompiled 0.7 FOR SUNTO 7":

image

STEP COMPILING:

  1. The file include\user_config_override-template.h
    for suntun ????

  2. CAN I USE : Compiling online with Gitpod (WHAT IS IT LINK FOR 0.7 version)

@1achy
Copy link
Author

1achy commented Mar 20, 2024

Where do i found source 0.7?

@fvanroie
Copy link
Collaborator

fvanroie commented Mar 20, 2024

@1achy
Copy link
Author

1achy commented Mar 23, 2024

Where do i found source 0.7?

It is here: https://github.com/HASwitchPlate/openHASP

For Gitpod use https://gitpod.io/new/#https://github.com/HASwitchPlate/openHASP/tree/master

i cant found 0.7, i need for sutun 7 inch

image

@1achy
Copy link
Author

1achy commented Mar 24, 2024

What do u choose for sunton 7 inch :

extra_default_envs =
; Uncomment specific environments or create extra:
; az-touch-mod-esp32_ili9341_4MB
; az-touch-mod-esp32_ili9341_8MB
; d1-mini-esp32_ili9341
; d1-r32-unoshield_ili9341_adc

And what file define 👍

LV_MEM_CUSTOM.???

@1achy
Copy link
Author

1achy commented Mar 29, 2024

COMPILING STEP
A copy of platformio_override-template.ini to platformio_override.ini will be readily prepared for you.

Click platformio_override.ini to open it, and to select your firmware flavour for your hardware uncomment in the extra_configs section the platform of your hadware, for example for ESP32:

STEP1
[platformio]
extra_configs =
; Uncomment or edit the lines to show more User Setups in the PIO sidebar
; user_setups/darwin_sdl/.ini
user_setups/esp32s3/.ini
; user_setups/esp32/
.ini
; user_setups/esp8266/.ini
; user_setups/linux_sdl/
.ini

If you use customization, remove the comment from the line -DUSE_CONFIG_OVERRIDE and make sure you have your own user_config_override.h in place:
(please consider before saving your wifi and mqtt credentials to an online cloud)

STEP2
[override]
; -- Hasp config options --------------------------------------
build_flags =
; -- Uncomment the next line to use the file include/user_config_override.h settings
-DUSE_CONFIG_OVERRIDE

And finally select your supported hardware from the extra_default_envs section by uncommenting the corresponding line. For example to build firmware for Lanbon L8, you should remove that comment only:

STEP3
extra_default_envs =
; Comment unneeded environments or create extra
; arduitouch-esp32_ili9341
; d1-mini-esp32_ili9341
; d1-mini-esp8266_ili9341
; d132-unoshield
; esp12e-st7735
; esp32dev-mrb3511
; esp32dev-ili9488
; lanbon_l8
sunton-8048s070c_16MB
; lolin-d32-pro_ili9341
; my_custom_build
; nodemcu32s-raspi
; wt32-sc01
; ttgo_esp32_poe-ili9341

Save the file by pressing Ctrl + S or selecting Save from the top-left menu.

Note
You can of course uncomment multiple lines, the system will make builds for each. Note that these environments rely on the platforms above so double-check that your hardware has the correct platform enabled in the extra_configs section!

STEP 4 Customization
The file include\user_config_override-template.h lists the options you have to customize your build. Settings applied here will act as factory defaults in the firmware. REname in : user_config_override.h
Check the file for the self-explanatory options. Some of the available possibilities are:
• WiFi Settings
• MQTT Settings
• OTA Server Settings
• Syslog Settings
• Timezone
• Interface Language
• Web interface coloring
• Built-in fonts choice
• GPIO Templates
Copy it to include\user_config_override.h and change the settins per your needs.
Uncomment -DUSE_CONFIG_OVERRIDE in platformio_override.ini to ensure that the config overrides are taken into account during the compilation process.

STEP 5 Parameters lvgl is in file : include\user_config_override-template.h row 150

define LV_MEM_SIZE (64 * 1024U) // 64Kb on ESP32 with PSram
define LV_MEM_CUSTOM 1 // completely remove the specific LVGL heap and use the ESP32 heap

image

@1achy
Copy link
Author

1achy commented Mar 30, 2024

The problen is rename: include\user_config_override-template.h to include\user_config_override.h

NOW where can found :

STEP 5 Parameters lvgl is in file : include\user_config_override-template.h row 150

define LV_MEM_SIZE (64 * 1024U) // 64Kb on ESP32 with PSram
define LV_MEM_CUSTOM 1

@1achy
Copy link
Author

1achy commented Mar 30, 2024

image

now i need try

@1achy
Copy link
Author

1achy commented Mar 30, 2024

i use : define LV_MEM_SIZE (64 * 1024U)

BEFORE

i use Sunton ESP32-S3 7" 800*480

Device Memory

Free Heap | 65.80 KiB
Free Block | 55.98 KiB
Fragmentation | 14% PSRam
Free | 7.18 MiB PSRam Size | 7.99 MiB

LVGL Memory
Total | 64.00 KiB
Free | 5.61 KiB
Fragmentation | 14%

out of memory ..... block screen...

solution reflash firmware ...

AFTER
Now i have :

Device Memory

Free Heap | 75.34 KiB
Free Block | 63.98 KiB
Fragmentation | 15%
PSRam Free | 7.20 MiB
PSRam Size | 7.99 MiB

LVGL Memory
Total | 64.00 KiB
Free | 11.19 KiB
Fragmentation | 4%

free lgvl INCREASE 5Kib
free heap increase 10kib

@1achy
Copy link
Author

1achy commented Mar 30, 2024

is it better use define LV_MEM_CUSTOM 1 ?

@marsman7
Copy link
Contributor

marsman7 commented Apr 1, 2024

is it better use define LV_MEM_CUSTOM 1 ?

I don't think that's a good idea for you, you would have to programme your own memory management.

@fvanroie
Copy link
Collaborator

fvanroie commented Apr 1, 2024

LV_MEM_CUSTOM 1 just means to use the default heap memory pool instead of the reserved LVGL block. It uses the standard C memory management of malloc/free/etc. It has been used and should work fine... the only downside I can think of is a higher fragmentation, which should be compensated by the larger pool.

When you start customizing the firmware, it is up to you to test it and tweak where needed.

@1achy
Copy link
Author

1achy commented Apr 1, 2024

LV_MEM_CUSTOM 1 just means to use the default heap memory pool instead of the reserved LVGL block. It uses the standard C memory management of malloc/free/etc. It has been used and should work fine... the only downside I can think of is a higher fragmentation, which should be compensated by the larger pool.

When you start customizing the firmware, it is up to you to test it and tweak where needed.

Di u have same guide for improve this mem allocaror?

@fvanroie
Copy link
Collaborator

fvanroie commented Apr 2, 2024

Just change #define LV_MEM_CUSTOM 0 to #define LV_MEM_CUSTOM 1 in include\lv_conf_v7.h and then recompile.

@1achy
Copy link
Author

1achy commented Apr 6, 2024

i try :
image

lvgl memory dont change :

image

@1achy
Copy link
Author

1achy commented Apr 6, 2024

Just change #define LV_MEM_CUSTOM 0 to #define LV_MEM_CUSTOM 1 in include\lv_conf_v7.h and then recompile.

so i do

@hb020
Copy link
Contributor

hb020 commented Apr 11, 2024

Just created a PR that will allow avoiding to have to modify lv_conf_v7.h or lv_conf_v8.h, and will allow control from user_config_override.h, as is expected.

Not that LV_MEM_CUSTOM 1 is really recommended: To be tested. It made my sc01plus lose WiFi randomly.

edit: the PR is accepted. One no longer needs to modify lv_conf_v7.h or lv_conf_v8.h. Just user_config_override.h will do.

@fvanroie
Copy link
Collaborator

You'll need to keep an eye on the memory fragmentation on the info page.
I doubt the WiFi signal issue has anything to do with the LVGL memory option, but please let me know if you find anything conclusive.

@MrEcosse
Copy link

I've used this method too to overcome an issue with both the Sunton and Guition screen crashing due to lack of available LVGL memory. Forgive my ignorance here (my first program was input via paper tape on an acoustic coupler telephone line) but with these higher resolution screens would it be possible for the default LVGL allocation to be higher? I am not able to create as many screens or use as many objects as I do on my Lanbon screens without having to do a custom compile.

@fvanroie
Copy link
Collaborator

What settings did you change? Were there any adverse effects?
If there needs to be a different limit, please propose a change or PR.

I can't know what number of pages and objects are being used by everybody, so your feedback is needed to come up with a reasonable default value. The current default have been in place for quite a while and are quite stable. We can increase the LVGL memory, but the change needs to be justified and stable. What limit do you suggest?

@fvanroie
Copy link
Collaborator

No suggestions?

@MrEcosse
Copy link

Sorry been travelling again. I changed LV_MEM_CUSTOM 1 as noted in a previous thread. So far no noticeable problems in the past 3 weeks. Fragmentation had increased to 70%. I just rebooted one of the panels and fragmentation now 45%. I'll add notes if anything changes/goes wrong!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants