From 6510a72789f9b3e5754c23ca90788292e21f71c3 Mon Sep 17 00:00:00 2001 From: Raomin Date: Mon, 25 May 2020 01:41:45 +0200 Subject: [PATCH] apply PR comments --- interface/src/system/SystemStatusForm.tsx | 12 ++++++------ lib/framework/SystemStatus.cpp | 12 ++---------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/interface/src/system/SystemStatusForm.tsx b/interface/src/system/SystemStatusForm.tsx index 25cf1f1..88fc7aa 100644 --- a/interface/src/system/SystemStatusForm.tsx +++ b/interface/src/system/SystemStatusForm.tsx @@ -27,8 +27,8 @@ interface SystemStatusFormState { type SystemStatusFormProps = AuthenticatedContextProps & RestFormProps; -function asNum(num: number){ - return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "); +function formatNumber(num: number){ + return new Intl.NumberFormat().format(num); } @@ -73,7 +73,7 @@ class SystemStatusForm extends Component - + @@ -82,7 +82,7 @@ class SystemStatusForm extends Component - + @@ -91,7 +91,7 @@ class SystemStatusForm extends Component - + @@ -99,7 +99,7 @@ class SystemStatusForm extends Component - + diff --git a/lib/framework/SystemStatus.cpp b/lib/framework/SystemStatus.cpp index f126e7b..0750184 100644 --- a/lib/framework/SystemStatus.cpp +++ b/lib/framework/SystemStatus.cpp @@ -1,6 +1,5 @@ #include #ifdef ESP32 -#include #include #elif defined(ESP8266) #include @@ -30,15 +29,8 @@ void SystemStatus::systemStatus(AsyncWebServerRequest* request) { root["sdk_version"] = ESP.getSdkVersion(); root["flash_chip_size"] = ESP.getFlashChipSize(); root["flash_chip_speed"] = ESP.getFlashChipSpeed(); -#ifdef ESP32 - if (esp_spiffs_mounted(NULL)) { - root["spiffs_used"] = SPIFFS.usedBytes(); - root["spiffs_size"] = SPIFFS.totalBytes(); - } -#elif !defined(PROGMEM_WWW) //couldn't find an esp8266 alternative to esp_spiffs_mounted() - root["spiffs_used"] = SPIFFS.usedBytes(); - root["spiffs_size"] = SPIFFS.totalBytes(); -#endif + root["spiffs_used"] = SPIFFS.usedBytes(); + root["spiffs_size"] = SPIFFS.totalBytes(); response->setLength(); request->send(response); }