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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user