Skip to content

Commit

Permalink
Use min_spiffs partition for esp32 and format flash on fail
Browse files Browse the repository at this point in the history
  • Loading branch information
sidoh committed Oct 19, 2024
1 parent 3e5d055 commit 7e3c64f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ build_flags = ${base.build_flags} -D FIRMWARE_VARIANT=d1_mini_PRO
extends = esp32
board = esp32doit-devkit-v1
build_flags = ${base.build_flags} -D FIRMWARE_VARIANT=esp32
board_build.partitions = default.csv
board_build.partitions = min_spiffs.csv

[env:debug]
extends = env:d1_mini
Expand Down
13 changes: 10 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,16 @@ void setup() {
String ssid = "ESP" + String(getESPId());

// load up our persistent settings from the file system
if (! ProjectFS.begin()) {
Serial.println(F("Failed to mount file system"));
}
// ESP8266 doesn't support the formatOnFail parameter
#ifdef ESP8266
if (! ProjectFS.begin()) {
Serial.println(F("Failed to mount file system"));
}
#else
if (! ProjectFS.begin(true)) {
Serial.println(F("Failed to mount file system"));
}
#endif

Settings::load(settings);
ESPMH_SETUP_WIFI(settings);
Expand Down

0 comments on commit 7e3c64f

Please sign in to comment.