diff --git a/tasmota/support_esp32.ino b/tasmota/support_esp32.ino index 0554129e8..79821806b 100644 --- a/tasmota/support_esp32.ino +++ b/tasmota/support_esp32.ino @@ -86,6 +86,11 @@ uint32_t FlashWriteMaxSector(void) { uint8_t* FlashDirectAccess(void) { return (uint8_t*)(0x40200000 + (FlashWriteStartSector() * SPI_FLASH_SEC_SIZE)); } + +void *special_malloc(uint32_t size) { + return malloc(size); +} + #endif /*********************************************************************************************\ @@ -414,4 +419,13 @@ uint8_t* FlashDirectAccess(void) { return data; } -#endif // ESP32 \ No newline at end of file + +void *special_malloc(uint32_t size) { + if (psramFound()) { + return heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); + } else { + return malloc(size); + } +} + +#endif // ESP32