memory remain

This commit is contained in:
Dmitry Borisenko
2020-12-18 23:52:35 +01:00
parent 433d28a785
commit 17162a2d85
6 changed files with 36 additions and 18 deletions

22
src/FileSystem.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include "FileSystem.h"
#include "Global.h"
void getFSInfo() {
// Информация о ФС
size_t totalBytes; // всего
size_t usedBytes; // использовано
size_t maxOpenFiles; // лимит на открые файлы
size_t maxPathLength; // лимит на полное пути + имя файла
FSInfo buf;
getInfo(buf);
size_t freeBytes = buf.totalBytes - buf.usedBytes;
float freePer = buf.usedBytes / buf.totalBytes * 100;
jsonWriteInt(configSetupJson, F("freeBytes"), freeBytes);
jsonWriteFloat(configSetupJson, F("freePer"), freePer);
}
bool getInfo(FSInfo& info) {
return FileFS.info(info);
}

View File

@@ -22,6 +22,7 @@
#include "items/vSensorUltrasonic.h"
#include "Telegram.h"
#include "SoftUART.h"
#include "FileSystem.h"
void not_async_actions();
@@ -66,9 +67,8 @@ void setup() {
#ifdef SSDP_ENABLED
SsdpInit();
#endif
getFSInfo();
//esp_log_level_set("esp_littlefs", ESP_LOG_NONE);
just_load = false;
initialized = true;
}