diff --git a/src/hasp_gui.cpp b/src/hasp_gui.cpp index 452d6cba..25ed323a 100644 --- a/src/hasp_gui.cpp +++ b/src/hasp_gui.cpp @@ -66,52 +66,13 @@ static inline void gui_init_lvgl() #endif /* Create the Virtual Device Buffers */ - // #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 - - // 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 - - // // 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); - - // 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)); - - // #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 / sizeof(lv_color_t); +#ifdef ESP32 + static lv_color_t* guiVdbBuffer1 = + (lv_color_t*)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); +#else static lv_color_t* guiVdbBuffer1 = (lv_color_t*)malloc(sizeof(lv_color_t) * guiVDBsize); +#endif /* Static VDB allocation */ // static lv_color_t guiVdbBuffer1[LV_VDB_SIZE * 512u]; diff --git a/user_setups/esp32s3/sunton-esp32-s3-tft.ini b/user_setups/esp32s3/sunton-esp32-s3-tft.ini index dd35456e..e2a212d5 100644 --- a/user_setups/esp32s3/sunton-esp32-s3-tft.ini +++ b/user_setups/esp32s3/sunton-esp32-s3-tft.ini @@ -130,6 +130,7 @@ extends = sunton-esp32-s3-tft, esp32s3_16mb_v2 build_flags = ${sunton-esp32-s3-tft.build_flags} -D HASP_MODEL="Sunton ESP32-8048S043C" + -D LV_VDB_SIZE=76800 ; 10% of full framebuffer -D TFT_WIDTH=800 -D TFT_HEIGHT=480 ; Bus Setttings @@ -166,6 +167,7 @@ extends = sunton-esp32-s3-tft, esp32s3_16mb_v2 build_flags = ${sunton-esp32-s3-tft.build_flags} -D HASP_MODEL="Sunton ESP32-8048S050C" + -D LV_VDB_SIZE=76800 ; 10% of full framebuffer -D TFT_WIDTH=800 -D TFT_HEIGHT=480 ; Bus Setttings @@ -202,6 +204,7 @@ extends = sunton-esp32-s3-tft, esp32s3_16mb_v2 build_flags = ${sunton-esp32-s3-tft.build_flags} -D HASP_MODEL="Sunton ESP32-8048S070C" + -D LV_VDB_SIZE=76800 ; 10% of full framebuffer -D TFT_WIDTH=800 -D TFT_HEIGHT=480 ; Bus Settings