Explicitly set LittleFS for uploadfs; log filesystem contents on boot

This commit is contained in:
2026-06-29 01:03:08 +02:00
parent 392e3ec953
commit 8cff7a4f1c
2 changed files with 11 additions and 2 deletions
+2 -1
View File
@@ -25,7 +25,8 @@ board = esp32dev
framework = arduino
platform = espressif32
monitor_speed = 115200
lib_deps =
board_build.filesystem = littlefs
lib_deps =
tzapu/WiFiManager @ ^2.0.17
bblanchon/ArduinoJson @ ^7.4.3
knolleary/PubSubClient @ ^2.8
+9 -1
View File
@@ -461,7 +461,15 @@ static void applyFactoryResetIfNeeded(int count) {
void setup() {
Serial.begin(115200);
Serial.println("\n\n=== ESP32 Device boot ===");
LittleFS.begin(true);
if (!LittleFS.begin(false)) {
Serial.println("[FS] mount failed, formatting...");
LittleFS.begin(true);
} else {
Serial.println("[FS] mounted OK");
File root = LittleFS.open("/");
File f = root.openNextFile();
while (f) { Serial.printf("[FS] %s (%u bytes)\n", f.name(), f.size()); f = root.openNextFile(); }
}
loadConfig();
hostnameParam.setValue(hostname, sizeof(hostname) - 1);