From a3302689607ed1eedb94521d44bd8f0cf5eb43ea Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 17 Oct 2024 15:28:16 +0200 Subject: [PATCH] debugging - LittleFS causes ESP32 D1 Mini to crash - no idea why when calling LittleFS.format() esp32 d1 mini crashes ``` assert failed: esp_littlefs_format esp_littlefs.c:474 (partition_label) Backtrace: 0x40083571:0x3ffb2040 0x40088365:0x3ffb2060 0x4008d2bd:0x3ffb2080 0x400e1c83:0x3ffb21b0 0x400d2ba9:0x3ffb21f0 0x400d1a0a:0x3ffb2210 0x400d4d3a:0x3ffb2290 ``` --- Arduino/CanGrow/CanGrow.ino | 19 +++++++++++++++++-- Arduino/CanGrow/include/CanGrow.h | 1 + Arduino/CanGrow/include/CanGrow_Version.h | 5 ----- 3 files changed, 18 insertions(+), 7 deletions(-) delete mode 100644 Arduino/CanGrow/include/CanGrow_Version.h diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino index d126f5b..0c3e3c5 100644 --- a/Arduino/CanGrow/CanGrow.ino +++ b/Arduino/CanGrow/CanGrow.ino @@ -59,10 +59,12 @@ #include // https://github.com/PaulStoffregen/Time #include +#include "FS.h" // arduino-core for esp8266 and esp32 #include "LittleFS.h" + void setup() { // define output for onboard LED/WIPE pin pinMode(PinWIPE, OUTPUT); @@ -93,13 +95,26 @@ void setup() { } delay(333); } - // set back to HIGH because thats the default + + #ifdef ESP8266 + // set back to HIGH because thats the default on esp8266 digitalWrite(PinWIPE, HIGH); - //delay(2000); + #endif + #ifdef ESP32 + // set back to HIGH because thats the default esp32 + digitalWrite(PinWIPE, LOW); + #endif + // read status from PinWIPE to WIPE // when PinWIPE is set to LOW, format LittleFS + + #ifdef ESP8266 if(digitalRead(PinWIPE) == LOW) { + #endif + #ifdef ESP32 + if(digitalRead(PinWIPE) == HIGH) { + #endif Serial.println("!! formatting LittleFS !!"); LittleFS.format(); Panic(); diff --git a/Arduino/CanGrow/include/CanGrow.h b/Arduino/CanGrow/include/CanGrow.h index e281ab0..a45efa3 100644 --- a/Arduino/CanGrow/include/CanGrow.h +++ b/Arduino/CanGrow/include/CanGrow.h @@ -30,6 +30,7 @@ #include "CanGrow_Version.h" +//#define FORMAT_LITTLEFS_IF_FAILED false const char* configfile = "config.json"; #ifdef ESP8266 diff --git a/Arduino/CanGrow/include/CanGrow_Version.h b/Arduino/CanGrow/include/CanGrow_Version.h deleted file mode 100644 index f5e5a73..0000000 --- a/Arduino/CanGrow/include/CanGrow_Version.h +++ /dev/null @@ -1,5 +0,0 @@ -/* CanGrow_Version.h gets generated from cangrow.sh */ - -const char* CanGrowVer = "0.2-dev"; -const char* CanGrowBuild = "529bd7e-20241017010523"; -