diff --git a/src/core/display.cpp b/src/core/display.cpp index 29ac8a46..5fb60df1 100644 --- a/src/core/display.cpp +++ b/src/core/display.cpp @@ -816,12 +816,13 @@ bool showJpeg(FS fs, String filename, int x, int y) { #include #define NORMAL_SPEED +#define GIF_BUFFER_SIZE 100 //#define USE_DMA #ifdef USE_DMA - uint16_t usTemp[2][SAFE_STACK_BUFFER_SIZE]; // Global to support DMA use + uint16_t usTemp[2][GIF_BUFFER_SIZE]; // Global to support DMA use #else - uint16_t usTemp[1][SAFE_STACK_BUFFER_SIZE]; // Global to support DMA use + uint16_t usTemp[1][GIF_BUFFER_SIZE]; // Global to support DMA use #endif bool dmaBuf = 0; @@ -864,7 +865,7 @@ void GIFDraw(GIFDRAW *pDraw) { c = ucTransparent - 1; d = &usTemp[0][0]; - while (c != ucTransparent && s < pEnd && iCount < SAFE_STACK_BUFFER_SIZE ) + while (c != ucTransparent && s < pEnd && iCount < GIF_BUFFER_SIZE ) { c = *s++; if (c == ucTransparent) // done, stop @@ -904,10 +905,10 @@ void GIFDraw(GIFDRAW *pDraw) // Unroll the first pass to boost DMA performance // Translate the 8-bit pixels through the RGB565 palette (already byte reversed) - if (iWidth <= SAFE_STACK_BUFFER_SIZE) + if (iWidth <= GIF_BUFFER_SIZE) for (iCount = 0; iCount < iWidth; iCount++) usTemp[dmaBuf][iCount] = usPalette[*s++]; else - for (iCount = 0; iCount < SAFE_STACK_BUFFER_SIZE; iCount++) usTemp[dmaBuf][iCount] = usPalette[*s++]; + for (iCount = 0; iCount < GIF_BUFFER_SIZE; iCount++) usTemp[dmaBuf][iCount] = usPalette[*s++]; #ifdef USE_DMA // 71.6 fps (ST7796 84.5 fps) tft.dmaWait(); @@ -924,10 +925,10 @@ void GIFDraw(GIFDRAW *pDraw) while (iWidth > 0) { // Translate the 8-bit pixels through the RGB565 palette (already byte reversed) - if (iWidth <= SAFE_STACK_BUFFER_SIZE) + if (iWidth <= GIF_BUFFER_SIZE) for (iCount = 0; iCount < iWidth; iCount++) usTemp[dmaBuf][iCount] = usPalette[*s++]; else - for (iCount = 0; iCount < SAFE_STACK_BUFFER_SIZE; iCount++) usTemp[dmaBuf][iCount] = usPalette[*s++]; + for (iCount = 0; iCount < GIF_BUFFER_SIZE; iCount++) usTemp[dmaBuf][iCount] = usPalette[*s++]; #ifdef USE_DMA tft.dmaWait(); @@ -945,7 +946,7 @@ void * GIFOpenFile(const char *fname, int32_t *pSize) { static File FSGifFile; // MEMO: declared static to survive return if(SD.exists(fname)) FSGifFile = SD.open(fname); - if(LittleFS.exists(fname)) FSGifFile = LittleFS.open(fname); + else if(LittleFS.exists(fname)) FSGifFile = LittleFS.open(fname); if (FSGifFile) { *pSize = FSGifFile.size(); return (void *)&FSGifFile; @@ -994,7 +995,8 @@ int32_t GIFSeekFile(GIFFILE *pFile, int32_t iPosition) } bool showGIF(FS fs, String filename, int x, int y) { -#if defined(CONFIG_IDF_TARGET_ESP32S3) +//#if defined(CONFIG_IDF_TARGET_ESP32S3) +#if defined(CARDPUTER) if(!fs.exists(filename)) return false; static AnimatedGIF gif; // MEMO: triggers stack canary if not static