mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
read LittleFS.totalBytes only once on start
This commit is contained in:
@@ -24,7 +24,7 @@ void SystemStatus::systemStatus(AsyncWebServerRequest * request) {
|
||||
root["flash_chip_size"] = ESP.getFlashChipSize();
|
||||
root["flash_chip_speed"] = ESP.getFlashChipSpeed();
|
||||
|
||||
root["fs_total"] = LittleFS.totalBytes();
|
||||
root["fs_total"] = emsesp::EMSESP::system_.FStotal();
|
||||
root["fs_used"] = LittleFS.usedBytes();
|
||||
root["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
|
||||
|
||||
|
||||
@@ -373,6 +373,7 @@ void System::start() {
|
||||
if (low_clock_) {
|
||||
setCpuFrequencyMhz(160);
|
||||
}
|
||||
fstotal_ = LittleFS.totalBytes(); // read only once, it takes 500 ms to read
|
||||
#endif
|
||||
|
||||
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
||||
@@ -784,7 +785,7 @@ void System::show_system(uuid::console::Shell & shell) {
|
||||
shell.printfln(F(" SDK version: %s"), ESP.getSdkVersion());
|
||||
shell.printfln(F(" CPU frequency: %lu MHz"), ESP.getCpuFreqMHz());
|
||||
shell.printfln(F(" Free heap: %lu bytes"), (uint32_t)ESP.getFreeHeap());
|
||||
shell.printfln(F(" FS used/total: %lu/%lu (bytes)"), LittleFS.usedBytes(), LittleFS.totalBytes());
|
||||
shell.printfln(F(" FS used/total: %lu/%lu (bytes)"), LittleFS.usedBytes(), FStotal());
|
||||
shell.println();
|
||||
|
||||
shell.println("Network:");
|
||||
|
||||
@@ -220,6 +220,10 @@ class System {
|
||||
void wifi_reconnect();
|
||||
void show_users(uuid::console::Shell & shell);
|
||||
|
||||
uint32_t FStotal() {
|
||||
return fstotal_;
|
||||
}
|
||||
|
||||
private:
|
||||
static uuid::log::Logger logger_;
|
||||
static bool restart_requested_;
|
||||
@@ -293,6 +297,9 @@ class System {
|
||||
int8_t eth_power_;
|
||||
uint8_t eth_phy_addr_;
|
||||
uint8_t eth_clock_mode_;
|
||||
|
||||
uint32_t fstotal_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
Reference in New Issue
Block a user