diff --git a/wled00/data/index.js b/wled00/data/index.js index 84b25618..168a5e2a 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -3443,7 +3443,8 @@ function reportUpgradeEvent(info, oldVersion) { }; // Add optional fields if available - if (infoData.psram !== undefined) upgradeData.psramSize = Math.round(infoData.psram / (1024 * 1024)); // convert bytes to MB + if (infoData.psramPresent !== undefined) upgradeData.psramPresent = infoData.psramPresent; // Whether device has PSRAM + if (infoData.psramSize !== undefined) upgradeData.psramSize = infoData.psramSize; // Total PSRAM size in MB // Note: partitionSizes not currently available in /json/info endpoint // Make AJAX call to postUpgradeEvent API diff --git a/wled00/json.cpp b/wled00/json.cpp index 08468df5..f2308013 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -839,8 +839,16 @@ void serializeInfo(JsonObject root) #endif root[F("freeheap")] = getFreeHeapSize(); - #if defined(BOARD_HAS_PSRAM) - root[F("psram")] = ESP.getFreePsram(); + #ifdef ARDUINO_ARCH_ESP32 + // Report PSRAM information + bool hasPsram = psramFound(); + root[F("psramPresent")] = hasPsram; + if (hasPsram) { + #if defined(BOARD_HAS_PSRAM) + root[F("psram")] = ESP.getFreePsram(); // Free PSRAM in bytes (backward compatibility) + #endif + root[F("psramSize")] = ESP.getPsramSize() / (1024UL * 1024UL); // Total PSRAM size in MB + } #endif root[F("uptime")] = millis()/1000 + rolloverMillis*4294967;