diff --git a/src/main.cpp b/src/main.cpp index f8d89e1ba..eb6dea327 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -439,6 +439,11 @@ void setup() LOG_INFO("\n\n//\\ E S H T /\\ S T / C\n"); +#if defined(ARCH_ESP32) && defined(BOARD_HAS_PSRAM) + // use PSRAM for malloc calls > 256 bytes + heap_caps_malloc_extmem_enable(256); +#endif + #if defined(DEBUG_MUTE) && defined(DEBUG_PORT) DEBUG_PORT.printf("\r\n\r\n//\\ E S H T /\\ S T / C\r\n"); DEBUG_PORT.printf("Version %s for %s from %s\r\n", optstr(APP_VERSION), optstr(APP_ENV), optstr(APP_REPO)); diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 05f47d7f4..54a34fd35 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -37,8 +37,8 @@ static MemoryDynamic dynamicPool; Allocator &packetPool = dynamicPool; -#elif defined(ARCH_STM32WL) -// On STM32 there isn't enough heap left over for the rest of the firmware if we allocate this statically. +#elif defined(ARCH_STM32WL) || defined(BOARD_HAS_PSRAM) +// On STM32 and boards with PSRAM, there isn't enough heap left over for the rest of the firmware if we allocate this statically. // For now, make it dynamic again. #define MAX_PACKETS \ (MAX_RX_TOPHONE + MAX_RX_FROMRADIO + 2 * MAX_TX_QUEUE + \