Skip to content

Commit

Permalink
Fixes for non-ESP32 boards
Browse files Browse the repository at this point in the history
  • Loading branch information
troyhacks committed Nov 26, 2024
1 parent db0c249 commit 79a99d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions wled00/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){
return true;
}*/

#ifdef ESP32
if (psramFound()) {
if (path.endsWith("/presets.json")) {
size_t psize;
Expand All @@ -518,6 +519,7 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){
}
}
}
#endif

if(WLED_FS.exists(path) || WLED_FS.exists(path + ".gz")) {
request->send(WLED_FS, path, String(), request->hasArg(F("download")));
Expand Down
2 changes: 2 additions & 0 deletions wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@ void serializeInfo(JsonObject root)
root[F("freestack")] = uxTaskGetStackHighWaterMark(NULL); //WLEDMM
root[F("minfreeheap")] = ESP.getMinFreeHeap();
#endif
#ifdef ESP32
if (psramFound()) {
root[F("tpram")] = ESP.getPsramSize(); //WLEDMM
root[F("psram")] = ESP.getFreePsram();
Expand All @@ -1087,6 +1088,7 @@ void serializeInfo(JsonObject root)
#endif
#endif
}
#endif
// for testing
// root[F("tpram")] = 4194304; //WLEDMM
// root[F("psram")] = 4193000;
Expand Down
5 changes: 4 additions & 1 deletion wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,14 @@ void WLED::setup()
managed_pin_type pins[] = { {16, true}, {17, true} };
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
#endif
#ifdef ESP32
if (psramFound() && ESP.getPsramSize() > 0) {
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");
} else {
DEBUG_PRINTLN(F("PSRAM not used."));
}
#endif

#if defined(ARDUINO_ARCH_ESP32)
if (strncmp("ESP32-PICO", ESP.getChipModel(), 10) == 0) { // WLEDMM detect pico board at runtime
Expand All @@ -641,14 +643,15 @@ void WLED::setup()
#ifdef WLED_ENABLE_DMX //reserve GPIO2 as hardcoded DMX pin
pinManager.allocatePin(2, true, PinOwner::DMX);
#endif

#ifdef ESP32
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
#if 0
Expand Down

0 comments on commit 79a99d5

Please sign in to comment.