mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-04-19 12:57:19 +00:00
Add hasp_use_psram and LV_VDB_SIZE
This commit is contained in:
parent
182a98644b
commit
511540efd9
@ -101,51 +101,57 @@ static inline void gui_init_lvgl()
|
||||
lv_log_register_print_cb(debugLvglLogEvent);
|
||||
#endif
|
||||
|
||||
static lv_color_t *guiVdbBuffer1, *guiVdbBuffer2 = NULL;
|
||||
|
||||
/* Create the Virtual Device Buffers */
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
// #if defined(ARDUINO_ARCH_ESP32)
|
||||
//
|
||||
// #ifdef USE_DMA_TO_TFT
|
||||
// // DMA: len must be less than 32767
|
||||
// const size_t guiVDBsize = 15 * 1024u; // 30 KBytes
|
||||
// guiVdbBuffer1 = (lv_color_t*)heap_caps_calloc(guiVDBsize, sizeof(lv_color_t), MALLOC_CAP_DMA);
|
||||
// // guiVdbBuffer2 = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_DMA);
|
||||
// // lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
|
||||
// #else
|
||||
// const size_t guiVDBsize = 8 * 1024u; // 32 KBytes
|
||||
|
||||
#ifdef USE_DMA_TO_TFT
|
||||
// DMA: len must be less than 32767
|
||||
const size_t guiVDBsize = 15 * 1024u; // 30 KBytes
|
||||
guiVdbBuffer1 = (lv_color_t*)heap_caps_calloc(guiVDBsize, sizeof(lv_color_t), MALLOC_CAP_DMA);
|
||||
// guiVdbBuffer2 = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_DMA);
|
||||
// lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
|
||||
#else
|
||||
const size_t guiVDBsize = 16 * 1024u; // 32 KBytes
|
||||
// if(0 && psramFound()) {
|
||||
// guiVdbBuffer1 = (lv_color_t*)ps_calloc(guiVDBsize, sizeof(lv_color_t)); // too slow for VDB
|
||||
// } else {
|
||||
// guiVdbBuffer1 = (lv_color_t*)calloc(guiVDBsize, sizeof(lv_color_t));
|
||||
// }
|
||||
|
||||
if(0 && psramFound()) {
|
||||
guiVdbBuffer1 = (lv_color_t*)ps_calloc(guiVDBsize, sizeof(lv_color_t)); // too slow for VDB
|
||||
} else {
|
||||
guiVdbBuffer1 = (lv_color_t*)calloc(guiVDBsize, sizeof(lv_color_t));
|
||||
}
|
||||
// #endif
|
||||
|
||||
#endif
|
||||
// // static lv_color_t * guiVdbBuffer2 = (lv_color_t *)malloc(sizeof(lv_color_t) * guiVDBsize);
|
||||
// // lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
|
||||
|
||||
// static lv_color_t * guiVdbBuffer2 = (lv_color_t *)malloc(sizeof(lv_color_t) * guiVDBsize);
|
||||
// lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
|
||||
// #elif defined(ARDUINO_ARCH_ESP8266)
|
||||
// /* allocate on heap */
|
||||
// // static lv_color_t guiVdbBuffer1[2 * 512u]; // 4 KBytes
|
||||
// // size_t guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(guiVdbBuffer1[0]);
|
||||
// // lv_disp_buf_init(&disp_buf, guiVdbBuffer1, NULL, guiVDBsize);
|
||||
|
||||
#elif defined(ARDUINO_ARCH_ESP8266)
|
||||
/* allocate on heap */
|
||||
// static lv_color_t guiVdbBuffer1[2 * 512u]; // 4 KBytes
|
||||
// size_t guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(guiVdbBuffer1[0]);
|
||||
// lv_disp_buf_init(&disp_buf, guiVdbBuffer1, NULL, guiVDBsize);
|
||||
// const size_t guiVDBsize = 2 * 512u; // 4 KBytes * 2
|
||||
// guiVdbBuffer1 = (lv_color_t*)malloc(sizeof(lv_color_t) * guiVDBsize);
|
||||
|
||||
const size_t guiVDBsize = 2 * 512u; // 4 KBytes * 2
|
||||
guiVdbBuffer1 = (lv_color_t*)malloc(sizeof(lv_color_t) * guiVDBsize);
|
||||
// #elif defined(WINDOWS) || defined(POSIX)
|
||||
// const size_t guiVDBsize = LV_HOR_RES_MAX * 10;
|
||||
// // static lv_color_t guiVdbBuffer1[guiVDBsize]; /*Declare a buffer for 10 lines*/
|
||||
// guiVdbBuffer1 = (lv_color_t*)calloc(guiVDBsize, sizeof(lv_color_t));
|
||||
|
||||
#elif defined(WINDOWS) || defined(POSIX)
|
||||
const size_t guiVDBsize = LV_HOR_RES_MAX * 10;
|
||||
// static lv_color_t guiVdbBuffer1[guiVDBsize]; /*Declare a buffer for 10 lines*/
|
||||
guiVdbBuffer1 = (lv_color_t*)calloc(guiVDBsize, sizeof(lv_color_t));
|
||||
// #else
|
||||
// static lv_color_t guiVdbBuffer1[16 * 512u]; // 16 KBytes
|
||||
// // static lv_color_t guiVdbBuffer2[16 * 512u]; // 16 KBytes
|
||||
// size_t guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(guiVdbBuffer1[0]);
|
||||
// // lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
|
||||
// #endif
|
||||
|
||||
#else
|
||||
static lv_color_t guiVdbBuffer1[16 * 512u]; // 16 KBytes
|
||||
// static lv_color_t guiVdbBuffer2[16 * 512u]; // 16 KBytes
|
||||
size_t guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(guiVdbBuffer1[0]);
|
||||
// lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
|
||||
#endif
|
||||
/* Dynamic VDB allocation */
|
||||
const size_t guiVDBsize = LV_VDB_SIZE / 2;
|
||||
static lv_color_t* guiVdbBuffer1 = (lv_color_t*)malloc(sizeof(lv_color_t) * guiVDBsize);
|
||||
|
||||
/* Static VDB allocation */
|
||||
// static lv_color_t guiVdbBuffer1[LV_VDB_SIZE * 512u];
|
||||
// const size_t guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(lv_color_t);
|
||||
|
||||
/* Initialize VDB */
|
||||
if(guiVdbBuffer1 && guiVDBsize > 0) {
|
||||
@ -238,7 +244,7 @@ static inline void gui_init_images()
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
if(psramFound()) lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE_PSRAM);
|
||||
if(hasp_use_psram()) lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE_PSRAM);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -248,7 +254,7 @@ static inline void gui_init_freetype()
|
||||
// #ifdef 1 || USE_LVGL_FREETYPE
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
if(lv_freetype_init(USE_LVGL_FREETYPE_MAX_FACES, USE_LVGL_FREETYPE_MAX_SIZES,
|
||||
psramFound() ? USE_LVGL_FREETYPE_MAX_BYTES_PSRAM : USE_LVGL_FREETYPE_MAX_BYTES)) {
|
||||
hasp_use_psram() ? USE_LVGL_FREETYPE_MAX_BYTES_PSRAM : USE_LVGL_FREETYPE_MAX_BYTES)) {
|
||||
LOG_VERBOSE(TAG_FONT, F("FreeType v%d.%d.%d " D_SERVICE_STARTED), FREETYPE_MAJOR, FREETYPE_MINOR,
|
||||
FREETYPE_PATCH);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user