mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 14:42:18 +03:00
версия 420
This commit is contained in:
@@ -290,4 +290,37 @@ String FileList(String path) {
|
||||
output += "]";
|
||||
return output;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
bool getInfo(FSInfo& info) {
|
||||
return FileFS.info(info);
|
||||
}
|
||||
// Информация о ФС
|
||||
void getFSInfo() {
|
||||
FSInfo buf;
|
||||
if (getInfo(buf)) {
|
||||
size_t totalBytes = buf.totalBytes; // всего
|
||||
size_t usedBytes = buf.usedBytes; // использовано
|
||||
// size_t maxOpenFiles = buf.maxOpenFiles; // лимит на открые файлы
|
||||
// size_t blockSize = buf.blockSize;
|
||||
// size_t pageSize = buf.pageSize;
|
||||
// size_t maxPathLength = buf.maxPathLength; // лимит на пути и имена файлов
|
||||
size_t freeBytes = totalBytes - usedBytes;
|
||||
float freePer = ((float)freeBytes / totalBytes) * 100;
|
||||
jsonWriteStr(errorsHeapJson, F("freeBytes"), String(freePer) + "% (" + prettyBytes(freeBytes) + ")");
|
||||
} else {
|
||||
SerialPrint("E", F("FS"), F("FS info error"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ESP32)
|
||||
void getFSInfo() {
|
||||
size_t totalBytes = FileFS.totalBytes(); // всего
|
||||
size_t usedBytes = FileFS.usedBytes(); // использовано
|
||||
size_t freeBytes = totalBytes - usedBytes;
|
||||
float freePer = ((float)freeBytes / totalBytes) * 100;
|
||||
jsonWriteStr(errorsHeapJson, F("freeBytes"), String(freePer) + "% (" + prettyBytes(freeBytes) + ")");
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user