From a03937988aeb1f33cdf491bd5ede3c0dc3eb4bed Mon Sep 17 00:00:00 2001 From: fvanroie Date: Mon, 16 Nov 2020 17:22:30 +0100 Subject: [PATCH] Make LV_MEM_SIZE configurable --- include/lv_conf.h | 13 ++++++++----- platformio.ini | 8 ++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/lv_conf.h b/include/lv_conf.h index 9cba6751..54de85b7 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -11,7 +11,7 @@ #include -#ifdef ESP8266 +#if defined(ARDUINO_ARCH_ESP8266) #define LV_HIGH_RESOURCE_MCU 0 #endif @@ -76,11 +76,14 @@ typedef int16_t lv_coord_t; #define LV_MEM_CUSTOM 0 #if LV_MEM_CUSTOM == 0 /* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ -#ifdef ESP8266 -# define LV_MEM_SIZE (10 * 1024U) // 12KB -#endif + #ifndef LV_MEM_SIZE -# define LV_MEM_SIZE (20 * 1024U) // 48KB + +#if defined(ARDUINO_ARCH_ESP8266) +# define LV_MEM_SIZE (10 * 1024U) // Minimum 10 Kb +#else +# define LV_MEM_SIZE (20 * 1024U) // 20Kb is much better +#endif #endif /* Complier prefix for a big array declaration */ diff --git a/platformio.ini b/platformio.ini index 51ab581b..1a0500d1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -85,8 +85,10 @@ extra_scripts = move-rename-firmware.py ; pre:extra_script.py [flags] esp8266_flags= ${env.build_flags} - -D HTTP_UPLOAD_BUFLEN=640 ; lower http upload buffer - -D MQTT_MAX_PACKET_SIZE=1024 ; longer PubSubClient messages + -D HTTP_UPLOAD_BUFLEN=640 ; lower http upload buffer + -D MQTT_MAX_PACKET_SIZE=1024 ; longer PubSubClient messages +; -- lvgl build options ----------------------------- + -D LV_MEM_SIZE=(10*1024U) ; 10kB lvgl memory ; -- hasp-lvgl build options ------------------------ -D HASP_USE_WIFI=1 -D HASP_USE_MQTT=1 @@ -104,6 +106,8 @@ esp32_flags= ${env.build_flags} -D HTTP_UPLOAD_BUFLEN=1024 ; lower http upload buffer -D MQTT_MAX_PACKET_SIZE=2048 ; longer PubSubClient messages +; -- lvgl build options ----------------------------- + -D LV_MEM_SIZE=(20*1024U) ; 20kB lvgl memory ; -- hasp-lvgl build options ------------------------ -D HASP_USE_MQTT=1 -D HASP_USE_HTTP=1