Cache 20 images when PSram is present

This commit is contained in:
fvanroie 2021-06-18 01:59:12 +02:00
parent 233cb53f8c
commit e099e454c7
3 changed files with 11 additions and 33 deletions

View File

@ -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,
};

View File

@ -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;

View File

@ -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