This commit is contained in:
Dmitry Borisenko
2020-12-19 13:31:38 +01:00
parent fe029a624c
commit 4711af6589
6 changed files with 25 additions and 15 deletions

Binary file not shown.

View File

@@ -51,11 +51,7 @@
},
{
"type": "h4",
"title": "Осталось памяти: {{freeBytes}}"
},
{
"type": "h4",
"title": "Осталось памяти: {{freePer}} %"
"title": "Остаток памяти: {{freeBytes}}"
},
{
"type": "hr"

Binary file not shown.

Binary file not shown.

View File

@@ -3,18 +3,32 @@
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;
if (getInfo(buf)) {
SerialPrint("I", F("FS"), F("Get FS info completed"));
jsonWriteInt(configSetupJson, F("freeBytes"), freeBytes);
jsonWriteFloat(configSetupJson, F("freePer"), freePer);
size_t totalBytes = buf.totalBytes; // всего
size_t usedBytes = buf.usedBytes; // использовано
size_t maxOpenFiles = buf.maxOpenFiles; // лимит на открые файлы
size_t maxPathLength = buf.maxPathLength; // лимит на пути и имена файлов
size_t freeBytes = totalBytes - usedBytes;
float freePer = freeBytes * 100 / totalBytes;
jsonWriteStr(configSetupJson, F("freeBytes"), String(freePer) + "% (" + String(freeBytes) + ")");
SerialPrint("I", F("FS"), "totalBytes=" + String(totalBytes));
SerialPrint("I", F("FS"), "usedBytes=" + String(usedBytes));
SerialPrint("I", F("FS"), "maxOpenFiles=" + String(maxOpenFiles));
SerialPrint("I", F("FS"), "maxPathLength=" + String(maxPathLength));
SerialPrint("I", F("FS"), "freeBytes=" + String(freeBytes));
SerialPrint("I", F("FS"), "freePer=" + String(freePer));
}
else {
SerialPrint("E", F("FS"), F("FS info error"));
}
}
bool getInfo(FSInfo& info) {

View File

@@ -13,7 +13,7 @@ bool fileSystemInit() {
SerialPrint("E", F("FS"), F("FS Init ERROR, may be FS was not flashed"));
return false;
}
SerialPrint("I", F("FS"), F("FS Init"));
SerialPrint("I", F("FS"), F("FS Init completed"));
return true;
}