2020-12-18 23:52:35 +01:00
|
|
|
|
#include "FileSystem.h"
|
|
|
|
|
|
#include "Global.h"
|
|
|
|
|
|
|
|
|
|
|
|
void getFSInfo() {
|
|
|
|
|
|
// Информация о ФС
|
2020-12-19 00:10:45 +01:00
|
|
|
|
//size_t totalBytes; // всего
|
|
|
|
|
|
//size_t usedBytes; // использовано
|
|
|
|
|
|
//size_t maxOpenFiles; // лимит на открые файлы
|
|
|
|
|
|
//size_t maxPathLength; // лимит на полное пути + имя файла
|
2020-12-18 23:52:35 +01:00
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|