Merge pull request #642 from mc-hamster/master

#635 - Added memory usage statistics
1.2-legacy
Jm Casler 2021-01-17 04:52:03 -08:00 zatwierdzone przez GitHub
commit 84b9028ecb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -1169,6 +1169,16 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
res->println("},");
res->println("\"memory\": {");
res->printf("\"heap_total\": %u,\n", ESP.getHeapSize());
res->printf("\"heap_free\": %u,\n", ESP.getFreeHeap());
res->printf("\"psram_total\": %s,\n", ESP.getPsramSize());
res->printf("\"psram_free\": %s,\n", ESP.getFreePsram());
res->print("\"spiffs_total\" : " + String(SPIFFS.totalBytes()) + ",");
res->print("\"spiffs_used\" : " + String(SPIFFS.usedBytes()) + ",");
res->print("\"spiffs_free\" : " + String(SPIFFS.totalBytes() - SPIFFS.usedBytes()));
res->println("},");
res->println("\"power\": {");
#define BoolToString(x) ((x) ? "true" : "false")
res->printf("\"battery_percent\": %u,\n", powerStatus->getBatteryChargePercent());