From 38a58532c753c067c2d752d335dc8613ade529a0 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Wed, 6 Jan 2021 10:51:22 +0100 Subject: [PATCH] ffsp flash system pointer --- tasmota/xdrv_98_filesystem.ino | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tasmota/xdrv_98_filesystem.ino b/tasmota/xdrv_98_filesystem.ino index 6e76d210d..3aad95a5a 100644 --- a/tasmota/xdrv_98_filesystem.ino +++ b/tasmota/xdrv_98_filesystem.ino @@ -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; }