This commit is contained in:
Yuri Trikoz
2020-12-18 04:39:44 +03:00
parent c4df80e904
commit 0d6d1a7f6c
2 changed files with 37 additions and 1 deletions

View File

@@ -16,7 +16,7 @@
#endif #endif
//===========FileSystem============================================================================================================================================== //===========FileSystem==============================================================================================================================================
#define littlefs_on #define USE_LITTLEFS true
//================================================================================================================================================================== //==================================================================================================================================================================
#define NUM_BUTTONS 6 #define NUM_BUTTONS 6
#define LED_PIN 2 #define LED_PIN 2

36
include/FileSystem.h Normal file
View File

@@ -0,0 +1,36 @@
#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);
}