From 46f89b93b37c4a8d1cc3bf647165021504b3640a Mon Sep 17 00:00:00 2001 From: Stephan Hadinger <stephan.hadinger@gmail.com> Date: Fri, 21 May 2021 18:24:41 +0200 Subject: [PATCH] LVGL increase image cache when PSRAM is present --- tasmota/lvgl_berry/tasmota_lv_conf.h | 1 + tasmota/xdrv_54_lvgl.ino | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/tasmota/lvgl_berry/tasmota_lv_conf.h b/tasmota/lvgl_berry/tasmota_lv_conf.h index 715794347..5d31e8a2e 100644 --- a/tasmota/lvgl_berry/tasmota_lv_conf.h +++ b/tasmota/lvgl_berry/tasmota_lv_conf.h @@ -259,6 +259,7 @@ typedef void * lv_fs_drv_user_data_t; * However the opened images might consume additional RAM. * Set it to 0 to disable caching */ #define LV_IMG_CACHE_DEF_SIZE 1 +#define LV_IMG_CACHE_DEF_SIZE_PSRAM 20 // special Tasmota setting when PSRAM is used /*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/ typedef void * lv_img_decoder_user_data_t; diff --git a/tasmota/xdrv_54_lvgl.ino b/tasmota/xdrv_54_lvgl.ino index 3b83ca199..d72bb4cdd 100644 --- a/tasmota/xdrv_54_lvgl.ino +++ b/tasmota/xdrv_54_lvgl.ino @@ -445,6 +445,10 @@ void start_lvgl(const char * uconfig) { lv_png_init(); #endif // USE_LVGL_PNG_DECODER + if (psramFound()) { + lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE_PSRAM); + } + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_LVGL "LVGL initialized")); }