diff --git a/src/esp_info.cpp b/src/esp_info.cpp index 03f6464..268e67c 100644 --- a/src/esp_info.cpp +++ b/src/esp_info.cpp @@ -48,7 +48,7 @@ void prettyPrintBytes(size_t bytes) { if (bytes < 1024) { Serial.printf("%d b\n", bytes); } else if (bytes < (1024 * 1024)) { - Serial.printf("%.2f kb\n", bytes / 1024.0); + Serial.printf("%.1f kb\n", bytes / 1024.0); } else { Serial.printf("%.2f mb\n", bytes / (1024.0 * 1024)); } @@ -56,41 +56,69 @@ void prettyPrintBytes(size_t bytes) { String formatBytes(size_t bytes) { if (bytes < 1024) return String(bytes) + " b"; - else if (bytes < (1024 * 1024)) return String(bytes / 1024.0, 2) + " kb"; + else if (bytes < (1024 * 1024)) return String(bytes / 1024.0, 1) + " kb"; else return String(bytes / (1024.0 * 1024), 2) + " mb"; } +String getCPUInfo() { + String info = "
Model: " + String(ESP.getChipModel()) + "
"; + info += "Cores: " + String(ESP.getChipCores()) + "
"; + info += "Frequency: " + String(ESP.getCpuFreqMHz()) + " MHz
"; + info += "Internal Temperature: " + String(temperature, 1) + " °C
"; + } + info += "Heap Size: " + formatBytes(ESP.getHeapSize()) + "
"; + info += "Free Heap: " + formatBytes(ESP.getFreeHeap()) + "
"; + info += "Min Free Heap: " + formatBytes(ESP.getMinFreeHeap()) + "
"; + info += "Max Alloc Heap: " + formatBytes(ESP.getMaxAllocHeap()) + "
"; + info += "PSRAM Size: " + formatBytes(ESP.getPsramSize()) + "
"; + info += "Free PSRAM: " + formatBytes(ESP.getFreePsram()) + "
"; + info += "Min Free PSRAM: " + formatBytes(ESP.getMinFreePsram()) + "
"; + info += "Max Alloc PSRAM: " + formatBytes(ESP.getMaxAllocPsram()) + "
"; + info += "Flash Size: " + formatBytes(totalBytes) + "
"; + info += "Used: " + formatBytes(usedBytes) + " (" + String(usagePercent, 1) + "%)
"; + info += "Flash Speed: " + String(ESP.getFlashChipSpeed() / 1000000) + " MHz
"; + info += "Heap Size: " + formatBytes(ESP.getHeapSize()) + "
"; - html += "Free Heap: " + formatBytes(ESP.getFreeHeap()) + "
"; - - html += "PSRAM Size: " + formatBytes(ESP.getPsramSize()) + "
"; - html += "Free PSRAM: " + formatBytes(ESP.getFreePsram()) + "
"; - - html += "Flash Size: " + formatBytes(totalBytes) + "
"; - html += "Used: " + formatBytes(usedBytes) + " (" + String(usagePercent, 1) + "%)
"; - html += "Flash Speed: " + String(ESP.getFlashChipSpeed() / 1000000) + " MHz
"; - - html += "Model: " + String(ESP.getChipModel()) + "
"; - html += "Cores: " + String(ESP.getChipCores()) + "
"; - html += "Frequency: " + String(ESP.getCpuFreqMHz()) + " MHz
"; - - float temperature = readInternalTemperature(); - if (!isnan(temperature)) { - html += "Internal Temperature: " + String(temperature, 2) + " °C
"; -} - - + html += getTemperatureInfo(); + html += getCPUInfo(); + html += getRAMInfo(); + html += getPSRAMInfo(); + html += getFlashInfo(); html += "