ffsp flash system pointer

This commit is contained in:
gemu2015 2021-01-06 10:51:22 +01:00
parent 40a440d5f2
commit 38a58532c7

View File

@ -70,6 +70,8 @@ The driver enabled by #define USE_UFILESYS
// global file system pointer
FS *ufsp;
// flash file system pointer on esp32
FS *ffsp;
char ufs_path[48];
File ufs_upload_file;
@ -83,6 +85,7 @@ uint8_t ufs_type;
void UFSInit(void) {
ufs_type = 0;
ffsp = 0;
// check for fs options,
// 1. check for SD card
// 2. check for littlefs or FAT
@ -104,6 +107,16 @@ void UFSInit(void) {
ufsp = &SD;
#endif // ESP32
ufs_type = UFS_TSDC;
// now detect ffs
ffsp = &LITTLEFS;
if (!LITTLEFS.begin()) {
// ffat is second
ffsp = &FFat;
if (!FFat.begin(true)) {
ffsp = 0;
return;
}
}
return;
}
}
@ -126,10 +139,12 @@ void UFSInit(void) {
return;
}
ufs_type = UFS_TFAT;
ffsp = ufsp;
return;
}
#endif // ESP32
ufs_type = UFS_TLFS;
ffsp = ufsp;
return;
}