Fix SPIFFS filesystem

Fix enabling SPIFFS filesystem (#10121)
This commit is contained in:
Theo Arends 2020-12-16 12:01:10 +01:00
parent a0250055ef
commit 88b3de0138
4 changed files with 15 additions and 11 deletions

View File

@ -2068,6 +2068,9 @@ void CmndDriver(void)
void CmndInfo(void) {
NvsInfo();
#ifdef USE_TFS
TfsInfo();
#endif
ResponseCmndDone();
}

View File

@ -194,8 +194,8 @@ void QPCWrite(const void *pSettings, unsigned nSettingsLen) {
void NvsInfo(void) {
nvs_stats_t nvs_stats;
nvs_get_stats(NULL, &nvs_stats);
AddLog_P(LOG_LEVEL_INFO, PSTR("INF: NVS Used %d, Free %d, Total %d, Namspaces %d"),
nvs_stats.used_entries, nvs_stats.free_entries, nvs_stats.total_entries, nvs_stats.namespace_count);
AddLog_P(LOG_LEVEL_INFO, PSTR("NVS: Used %d/%d entries, NameSpaces %d"),
nvs_stats.used_entries, nvs_stats.total_entries, nvs_stats.namespace_count);
}
void ZigbeeErase(unsigned nSettingsLen) {

View File

@ -23,15 +23,9 @@
#ifdef ESP32
#define USE_TFS
#ifdef USE_SCRIPT
#undef USE_TFS
#endif // USE_SCRIPT
#ifdef USE_TFS
//#define USE_LITTLEFS // LittleFS not tested yet
//#define USE_LITTLEFS // LittleFS not tested yet as currently ESP8266 only
//#define USE_FFAT // FFat minimal 983k partition (4096 sector size) - tested
#define USE_SPIFFS // SPIFFS - tested
@ -64,7 +58,6 @@ bool TfsInit(void) {
}
}
AddLog_P(LOG_LEVEL_INFO, PSTR("TFS: Mounted"));
// TfsInfo();
FsMounted = 2; // true
return true;
}
@ -130,10 +123,12 @@ bool TfsLoadFile(const char *fname, uint8_t *buf, uint32_t len) {
}
void TfsInfo(void) {
if (!TfsInit()) { return; }
uint32_t total_bytes = TASMOTA_FS.totalBytes();
#ifdef USE_SPIFFS
uint32_t used_bytes = TASMOTA_FS.usedBytes();
#endif // USE_SPIFFS
uint32_t total_bytes = TASMOTA_FS.totalBytes();
#ifdef USE_FFAT
uint32_t used_bytes = total_bytes - TASMOTA_FS.freeBytes();
#endif // USE_FFAT

View File

@ -107,6 +107,12 @@ String EthernetMacAddress(void);
#define ARDUINO_CORE_RELEASE ARDUINO_ESP32_RELEASE
#endif // ARDUINO_ESP32_RELEASE
#define USE_TFS
#ifdef USE_SCRIPT
#undef USE_TFS
#endif // USE_SCRIPT
// Hardware has no ESP32
#undef USE_TUYA_DIMMER
#undef USE_PWM_DIMMER