Fix potential overflow in PSRAM size calculation

- Changed division from (1024 * 1024) to (1024UL * 1024UL)
- Ensures proper unsigned long type to prevent overflow issues
- All tests pass 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 19:05:32 +00:00
parent 4684e092a8
commit b4d3a279e3
2 changed files with 2 additions and 1 deletions

View File

@@ -847,7 +847,7 @@ void serializeInfo(JsonObject root)
#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
root[F("psramSize")] = ESP.getPsramSize() / (1024UL * 1024UL); // Total PSRAM size in MB
}
#endif
root[F("uptime")] = millis()/1000 + rolloverMillis*4294967;