From 9c9d7e0eef35f786fab67cdfaf188c18c5949495 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Thu, 31 Dec 2020 16:41:58 +0100 Subject: [PATCH] spiffs --- tasmota/xdrv_98_filesystem.ino | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tasmota/xdrv_98_filesystem.ino b/tasmota/xdrv_98_filesystem.ino index 5ea685109..3615ebbaa 100644 --- a/tasmota/xdrv_98_filesystem.ino +++ b/tasmota/xdrv_98_filesystem.ino @@ -105,7 +105,7 @@ void UFSInit(void) { #else ufsp = &SD; #endif - ufs_type = 1; + ufs_type = UFS_TSDC; return; } } @@ -119,10 +119,17 @@ void UFSInit(void) { #else ufsp = &FFat; if (!FFat.begin(true)) { + if (!SPIFFS.begin(true)) { + return; + } + ufsp = &SPIFFS; + ufs_type = UFS_TSPIFFS; return; } + + #endif - ufs_type = 2; + ufs_type = UFS_TFAT; return; } @@ -159,9 +166,14 @@ uint32_t result = 0; #endif break; case UFS_TSPIFFS: + if (sel == 0) { + result = SPIFFS.totalBytes(); + } else { + result = SPIFFS.totalBytes() - SPIFFS.usedBytes(); + } break; } - return result / 10000; + return result / 1000; } #if USE_LONG_FILE_NAMES>0 @@ -373,6 +385,10 @@ uint8_t UFS_DownloadFile(char *file) { File download_file; WiFiClient download_Client; + AddLog_P(LOG_LEVEL_INFO, PSTR("file not found %s"),file); + + if (*file == '/') file++; + if (!ufsp->exists(file)) { AddLog_P(LOG_LEVEL_INFO, PSTR("file not found")); return 0;