32 broken

This commit is contained in:
Yuri Trikoz
2020-06-22 03:11:02 +03:00
parent 40688130fd
commit 092bec7dde
34 changed files with 1308 additions and 341 deletions

View File

@@ -1,18 +1,15 @@
#include "Utils/FileUtils.h"
#include "Utils/PrintMessage.h"
static const char* MODULE = "FS";
void printError(const String str) {
Serial.printf("[E] [%s] %s\n", MODULE, str.c_str());
}
const String filepath(const String& filename) {
return filename.startsWith("/") ? filename : "/" + filename;
}
bool fileSystemInit() {
if (!LittleFS.begin()) {
printError("init");
pm.error("init");
return false;
}
return true;
@@ -20,14 +17,14 @@ bool fileSystemInit() {
void removeFile(const String filename) {
if (!LittleFS.remove(filepath(filename))) {
printError("remove " + filename);
pm.error("remove " + filename);
}
}
File seekFile(const String filename, size_t position) {
auto file = LittleFS.open(filepath(filename), "r");
if (!file) {
printError("open " + filename);
pm.error("open " + filename);
}
// поставим курсор в начало файла
file.seek(position, SeekSet);