Add hasPSRAM and psramSize fields to /info endpoint

- Added hasPSRAM boolean field indicating if hardware has PSRAM
- Added psramSize field with total PSRAM size in MB
- Kept existing psram field for backward compatibility (free PSRAM in bytes)
- All fields only included for ESP32 architecture
- Tests passed and firmware builds successfully

Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-08 18:55:26 +00:00
parent e074d19593
commit 2a53f415ea

View File

@@ -839,8 +839,16 @@ void serializeInfo(JsonObject root)
#endif #endif
root[F("freeheap")] = getFreeHeapSize(); root[F("freeheap")] = getFreeHeapSize();
#if defined(BOARD_HAS_PSRAM) #ifdef ARDUINO_ARCH_ESP32
root[F("psram")] = ESP.getFreePsram(); // Report PSRAM information
bool hasPsram = psramFound();
root[F("hasPSRAM")] = 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() / (1024 * 1024); // Total PSRAM size in MB
}
#endif #endif
root[F("uptime")] = millis()/1000 + rolloverMillis*4294967; root[F("uptime")] = millis()/1000 + rolloverMillis*4294967;