diff --git a/wled00/wled.cpp b/wled00/wled.cpp index e6b62c1a..9a1bca40 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -349,7 +349,7 @@ void WLED::loop() //DEBUG_PRINT(F("Total PSRAM: ")); DEBUG_PRINT(ESP.getPsramSize()/1024); DEBUG_PRINTLN("kB"); DEBUG_PRINT(F("Free PSRAM : ")); DEBUG_PRINT(ESP.getFreePsram()/1024); DEBUG_PRINTLN("kB"); DEBUG_PRINT(F("Avail PSRAM: ")); DEBUG_PRINT(ESP.getMaxAllocPsram()/1024); DEBUG_PRINTLN("kB"); - DEBUG_PRINT(F("PSRAM in use:")); DEBUG_PRINT(ESP.getPsramSize() - ESP.getFreePsram()); DEBUG_PRINTLN(F(" Bytes")); + DEBUG_PRINT(F("PSRAM in use:")); DEBUG_PRINT(int(ESP.getPsramSize() - ESP.getFreePsram())); DEBUG_PRINTLN(F(" Bytes")); } else { //DEBUG_PRINTLN(F("No PSRAM")); @@ -640,9 +640,14 @@ void WLED::setup() pinManager.allocatePin(2, true, PinOwner::DMX); #endif -#if defined(ALL_JSON_TO_PSRAM) && (defined(WLED_USE_PSRAM_JSON) || defined(WLED_USE_PSRAM)) - USER_PRINTLN(F("JSON gabage collection (initial).")); - doc.garbageCollect(); // WLEDMM experimental - this seems to move the complete doc[] into PSRAM +#if defined(ALL_JSON_TO_PSRAM) && defined(BOARD_HAS_PSRAM) && (defined(WLED_USE_PSRAM_JSON) || defined(WLED_USE_PSRAM)) + if (psramFound()) { + DEBUG_PRINT(F("\nfree heap ")); DEBUG_PRINTLN(ESP.getFreeHeap()); + USER_PRINTLN(F("JSON gabage collection (initial).")); + doc.garbageCollect(); // WLEDMM experimental - this seems to move the complete doc[] into PSRAM + USER_PRINT(F("PSRAM in use:")); USER_PRINT(int(ESP.getPsramSize() - ESP.getFreePsram())); USER_PRINTLN(F(" Bytes.")); + DEBUG_PRINT(F("free heap ")); DEBUG_PRINTLN(ESP.getFreeHeap()); + } #endif // WLEDMM experimental: support for single neoPixel on Adafruit boards diff --git a/wled00/wled.h b/wled00/wled.h index b38c42e9..3e5f76e5 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2410270 +#define VERSION 2410300 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ @@ -814,7 +814,7 @@ WLED_GLOBAL int8_t spi_sclk _INIT(HW_PIN_CLOCKSPI); #ifndef WLED_DEFINE_GLOBAL_VARS WLED_GLOBAL PSRAMDynamicJsonDocument doc; #else - #if defined(CONFIG_IDF_TARGET_ESP32S2) || !defined(BOARD_HAS_PSRAM) + #if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) || !defined(BOARD_HAS_PSRAM) WLED_GLOBAL PSRAMDynamicJsonDocument doc(JSON_BUFFER_SIZE); // S2 has very small RAM - lets not push our luck too far #else WLED_GLOBAL PSRAMDynamicJsonDocument doc(JSON_BUFFER_SIZE * 2 ); // initially "doc" is allocated in RAM, and later pushed into PSRAM when the drivers is ready