mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-10-09 03:06:39 +00:00
feat(wio-tracker-l2): internal flash as LittleFS instead of SPIFFS
helpers/esp32/InternalFS.h picks the filesystem: -D ESP32_LITTLEFS mounts LittleFS on the same "spiffs" partition, otherwise SPIFFS as before. Only the L2 LVGL envs set it; every other ESP32 board is unchanged. A settings save drops from ~0.5 s to ~80 ms and the files survive power loss mid-write. No migration: the first boot formats the partition (fresh identity). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -81,7 +81,7 @@ void DataStore::begin() {
|
||||
}
|
||||
|
||||
#if defined(ESP32)
|
||||
#include <SPIFFS.h>
|
||||
#include <helpers/esp32/InternalFS.h>
|
||||
#include <nvs_flash.h>
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
#include <LittleFS.h>
|
||||
@@ -119,7 +119,7 @@ lfs_ssize_t _getLfsUsedBlockCount(FILESYSTEM* fs) {
|
||||
|
||||
uint32_t DataStore::getStorageUsedKb() const {
|
||||
#if defined(ESP32)
|
||||
return SPIFFS.usedBytes() / 1024;
|
||||
return ESP32_FS.usedBytes() / 1024;
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
FSInfo info;
|
||||
info.usedBytes = 0;
|
||||
@@ -137,7 +137,7 @@ uint32_t DataStore::getStorageUsedKb() const {
|
||||
|
||||
uint32_t DataStore::getStorageTotalKb() const {
|
||||
#if defined(ESP32)
|
||||
return SPIFFS.totalBytes() / 1024;
|
||||
return ESP32_FS.totalBytes() / 1024;
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
FSInfo info;
|
||||
info.totalBytes = 0;
|
||||
@@ -198,7 +198,7 @@ bool DataStore::formatFileSystem() {
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
return LittleFS.format();
|
||||
#elif defined(ESP32)
|
||||
bool fs_success = ((fs::SPIFFSFS *)_fs)->format();
|
||||
bool fs_success = ((ESP32_FS_CLASS *)_fs)->format();
|
||||
esp_err_t nvs_err = nvs_flash_erase(); // no need to reinit, will be done by reboot
|
||||
return fs_success && (nvs_err == ESP_OK);
|
||||
#elif defined(SIM_PLATFORM)
|
||||
|
||||
Reference in New Issue
Block a user