Files
IoTManager/include/FileSystem.h
Yuri Trikoz 0d6d1a7f6c FSInfo
2020-12-18 04:39:44 +03:00

36 lines
847 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "Consts.h"
#define FILE_READ "r"
#define FILE_WRITE "w"
#define FILE_APPEND "a"
#if USE_LITTLEFS
#include <LittleFS.h>
extern FS LittleFS;
using littlefs_impl::LittleFSConfig;
extern FS *filesystem;
#define FileFS LittleFS
#define FS_NAME "LittleFS"
#else
extern FS *filesystem;
#define FileFS SPIFFS
#define FS_NAME "SPIFFS"
#endif
/*
* Информация о ФС
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;
*/
bool getInfo(FSInfo& info) {
return FileFS.info(info);
}