From e099e454c7195adb77d916455345bc086cc8f163 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Fri, 18 Jun 2021 01:59:12 +0200 Subject: [PATCH] Cache 20 images when PSram is present --- include/bootscreen.h | 33 --------------------------------- include/lv_conf_v7.h | 5 +++++ src/hasp_gui.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 33 deletions(-) delete mode 100644 include/bootscreen.h diff --git a/include/bootscreen.h b/include/bootscreen.h deleted file mode 100644 index 1df706f7..00000000 --- a/include/bootscreen.h +++ /dev/null @@ -1,33 +0,0 @@ -// Images can be converted to XBM format by using the online converter here: -// https://www.online-utility.org/image/convert/to/XBM - -// The output must be pasted in a header file, renamed and adjusted to appear -// as as a const unsigned char array in PROGMEM (FLASH program memory). - -// The xbm format adds padding to pixel rows so they are a whole number of bytes -// In this example 50 pixel width means 56 bits = 7 bytes -// the 50 height then means array uses 50 x 7 = 350 bytes of FLASH -// The library ignores the padding bits when drawing the image on the display. - -// The openHASP logo uses the MaterialDesign icons font, released under the OFL license - -#define logoBgColor {0,128,128} -#define logoFgColor {255,255,255} - -#define logoWidth 93 -#define logoHeight 16 - -// Image is stored in th array below, adjust the width and height accordingly -PROGMEM const unsigned char logoImage[] = { - 0x7C, 0xF0, 0x07, 0xFF, 0x71, 0x1C, 0xC7, 0xC1, 0x07, 0xFC, 0xF1, 0x07, 0xFE, 0xF0, 0x0F, 0xFF, 0xF1, 0x1C, - 0xC7, 0xE1, 0x0F, 0xFE, 0xF1, 0x0F, 0xFF, 0xF1, 0x1F, 0xFF, 0xF1, 0x1C, 0xC7, 0xF1, 0x1F, 0xFF, 0xF1, 0x1F, - 0xC7, 0x71, 0x1C, 0x07, 0xF0, 0x1C, 0xC7, 0x71, 0x1C, 0x07, 0x70, 0x1C, 0xC7, 0x71, 0x1C, 0x07, 0xF0, 0x1D, - 0xC7, 0x71, 0x1C, 0x07, 0x70, 0x1C, 0xC7, 0x71, 0x1C, 0x07, 0xF0, 0x1D, 0xC7, 0x71, 0x1C, 0x07, 0x70, 0x1C, - 0xC7, 0x71, 0x1C, 0x07, 0xF0, 0x1F, 0xC7, 0x71, 0x1C, 0x07, 0x70, 0x1C, 0xC7, 0xF1, 0x1F, 0xFF, 0xF1, 0x1F, - 0xFF, 0xF1, 0x1F, 0xFF, 0xF0, 0x1F, 0xC7, 0xF1, 0x0F, 0xFF, 0xF1, 0x1F, 0xFF, 0xF1, 0x1F, 0xFE, 0xF1, 0x0F, - 0xC7, 0xF1, 0x07, 0xFF, 0xF1, 0x1F, 0xFF, 0xF1, 0x1F, 0xFC, 0xF1, 0x07, 0xC7, 0x71, 0x00, 0x07, 0x70, 0x1F, - 0xC7, 0x71, 0x1C, 0xC0, 0x71, 0x00, 0xC7, 0x71, 0x00, 0x07, 0x70, 0x1F, 0xC7, 0x71, 0x1C, 0xC0, 0x71, 0x00, - 0xC7, 0x71, 0x00, 0x07, 0x70, 0x1E, 0xC7, 0x71, 0x1C, 0xC0, 0x71, 0x00, 0xFF, 0x71, 0x00, 0xFF, 0x71, 0x1E, - 0xC7, 0x71, 0x1C, 0xFF, 0x71, 0x00, 0xFE, 0x70, 0x00, 0xFF, 0x71, 0x1E, 0xC7, 0x71, 0x1C, 0xFF, 0x71, 0x00, - 0x7C, 0x70, 0x00, 0xFF, 0x71, 0x1C, 0xC7, 0x71, 0x1C, 0xFF, 0x70, 0x00, -}; diff --git a/include/lv_conf_v7.h b/include/lv_conf_v7.h index 2d5f3017..3fa5d20a 100644 --- a/include/lv_conf_v7.h +++ b/include/lv_conf_v7.h @@ -221,7 +221,12 @@ typedef void* lv_fs_drv_user_data_t; * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. * However the opened images might consume additional RAM. * LV_IMG_CACHE_DEF_SIZE must be >= 1 */ +#ifndef LV_IMG_CACHE_DEF_SIZE #define LV_IMG_CACHE_DEF_SIZE 1 +#endif +#ifndef LV_IMG_CACHE_DEF_SIZE_PSRAM +#define LV_IMG_CACHE_DEF_SIZE_PSRAM 20 // special openHASP setting when PSRAM is used +#endif /*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/src/hasp_gui.cpp b/src/hasp_gui.cpp index fde91c86..819cced8 100644 --- a/src/hasp_gui.cpp +++ b/src/hasp_gui.cpp @@ -267,6 +267,12 @@ void guiSetup() lv_png_init(); #endif +#if defined(ARDUINO_ARCH_ESP32) + if(psramFound()) { + lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE_PSRAM); + } +#endif + #ifdef USE_DMA_TO_TFT LOG_VERBOSE(TAG_GUI, F("DMA : " D_SETTING_ENABLED)); #else