Format config partition if mount failed

This commit is contained in:
Thomas Basler 2022-06-15 22:07:30 +02:00
parent e3ded34020
commit b893257696

View File

@ -20,8 +20,13 @@ void setup()
// Initialize file system // Initialize file system
Serial.print(F("Initialize FS... ")); Serial.print(F("Initialize FS... "));
if (!LittleFS.begin()) { if (!LittleFS.begin(false)) { // Do not format if mount failed
Serial.println(F("failed")); Serial.print(F("failed... trying to format..."));
if (!LittleFS.begin(true)) {
Serial.print("success");
} else {
Serial.print("failed");
}
} else { } else {
Serial.println(F("done")); Serial.println(F("done"));
} }