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:
@@ -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("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
|
||||
root[F("uptime")] = millis()/1000 + rolloverMillis*4294967;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user