File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -3443,10 +3443,7 @@ function reportUpgradeEvent(info, oldVersion) {
34433443 } ;
34443444
34453445 // Add optional fields if available
3446- if ( infoData . psrSz !== undefined ) {
3447- upgradeData . psramSize = infoData . psrSz ; // Total PSRAM size in MB
3448- upgradeData . psramUsed = ( infoData . psram !== undefined ) ;
3449- }
3446+ if ( infoData . psrSz !== undefined ) upgradeData . psramSize = infoData . psrSz ; // Total PSRAM size in MB; can be 0
34503447
34513448 // Note: partitionSizes not currently available in /json/info endpoint
34523449
Original file line number Diff line number Diff line change @@ -839,15 +839,12 @@ void serializeInfo(JsonObject root)
839839#endif
840840
841841 root[F (" freeheap" )] = getFreeHeapSize ();
842- #ifdef ARDUINO_ARCH_ESP32
842+ #if defined( ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM)
843843 // Report PSRAM information
844- size_t psramSize = ESP.getPsramSize (); // returns 0 if no psram
845- if (psramSize > 0 ) {
846- #if defined(BOARD_HAS_PSRAM)
847- root[F (" psram" )] = ESP.getFreePsram (); // Free PSRAM in bytes (backward compatibility)
848- #endif
849- root[F (" psrSz" )] = 1 + ((psramSize - 1 ) / (1024U * 1024U )); // Total PSRAM size in MB, round up to correct for allocator overhead
850- }
844+ // Free PSRAM in bytes (backward compatibility)
845+ root[F (" psram" )] = ESP.getFreePsram ();
846+ // Total PSRAM size in MB, round up to correct for allocator overhead
847+ root[F (" psrSz" )] = (ESP.getPsramSize () + (1024U * 1024U - 1 )) / (1024U * 1024U );
851848 #endif
852849 root[F (" uptime" )] = millis ()/1000 + rolloverMillis*4294967 ;
853850
You can’t perform that action at this time.
0 commit comments