Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[env:esp32dev]
custom_project_name = BLLEDController
custom_project_codename = Balder
custom_version = 1.0.0.nightly.220525.2 ; for github release name the release VX.Y.Z X=(Incerase when Modifications oder new functions Break the API/webUI) Y=(Incerase for add oder modify changes that not breake the API/webUI until X incearase) Z=(Incerase for bugfix releases until minor is incerase)
custom_version = 1.0.0.nightly.240525.1 ; for github release name the release VX.Y.Z X=(Incerase when Modifications oder new functions Break the API/webUI) Y=(Incerase for add oder modify changes that not breake the API/webUI until X incearase) Z=(Incerase for bugfix releases until minor is incerase)
platform = espressif32
board = esp32dev
framework = arduino
Expand All @@ -21,6 +21,9 @@ board_build.filesystem = littlefs
build_flags =
-DVERSION=${this.custom_version}
-DSTRVERSION=\""${this.custom_version}"\"
-D CONFIG_ASYNC_TCP_QUEUE_SIZE=64
-D CONFIG_ASYNC_TCP_RUNNING_CORE=1
-D WS_MAX_QUEUED_MESSAGES=128
extra_scripts =
pre:pre_build.py
merge_firmware.py
Expand Down
38 changes: 19 additions & 19 deletions src/blled/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ char *generateRandomString(int length)

void saveFileSystem()
{
Serial.println(F("Saving config"));
LogSerial.println(F("Saving config"));

JsonDocument json;
json["ssid"] = globalVariables.SSID;
Expand Down Expand Up @@ -124,17 +124,17 @@ void saveFileSystem()
File configFile = LittleFS.open(configPath, "w");
if (!configFile)
{
Serial.println(F("Failed to save config"));
LogSerial.println(F("Failed to save config"));
return;
}
serializeJson(json, configFile);
configFile.close();
Serial.println(F("Config Saved"));
LogSerial.println(F("Config Saved"));
}

void loadFileSystem()
{
Serial.println(F("Loading config"));
LogSerial.println(F("Loading config"));

File configFile;
int attempts = 0;
Expand All @@ -146,16 +146,16 @@ void loadFileSystem()
break;
}
attempts++;
Serial.println(F("Failed to open config file, retrying.."));
LogSerial.println(F("Failed to open config file, retrying.."));
delay(2000);
}
if (!configFile)
{
Serial.print(F("Failed to open config file after "));
Serial.print(attempts);
Serial.println(F(" retries"));
LogSerial.print(F("Failed to open config file after "));
LogSerial.print(attempts);
LogSerial.println(F(" retries"));

Serial.println(F("Clearing config"));
LogSerial.println(F("Clearing config"));
// LittleFS.remove(configPath);
saveFileSystem();
return;
Expand Down Expand Up @@ -222,15 +222,15 @@ void loadFileSystem()
printerConfig.frontCoverRGB = hex2rgb(json["frontCoverRGB"], json["frontCoverWW"], json["frontCoverCW"]);
printerConfig.nozzleTempRGB = hex2rgb(json["nozzleTempRGB"], json["nozzleTempWW"], json["nozzleTempCW"]);
printerConfig.bedTempRGB = hex2rgb(json["bedTempRGB"], json["bedTempWW"], json["bedTempCW"]);
Serial.println(F("Loaded config"));
LogSerial.println(F("Loaded config"));
}
else
{
Serial.println(F("Failed loading config"));
Serial.println(F("Clearing config"));
LogSerial.println(F("Failed loading config"));
LogSerial.println(F("Clearing config"));
LittleFS.remove(configPath);

// Serial.println(F("Generating new password"));
// LogSerial.println(F("Generating new password"));
// char* pw = generateRandomString(8);
// strcpy(printerConfig.webpagePassword, pw);
}
Expand All @@ -240,7 +240,7 @@ void loadFileSystem()

void deleteFileSystem()
{
Serial.println(F("Deleting LittleFS"));
LogSerial.println(F("Deleting LittleFS"));
LittleFS.remove(configPath);
}

Expand All @@ -251,17 +251,17 @@ bool hasFileSystem()

void setupFileSystem()
{
Serial.println(F("Mounting LittleFS"));
LogSerial.println(F("Mounting LittleFS"));
if (!LittleFS.begin())
{
Serial.println(F("Failed to mount LittleFS"));
LogSerial.println(F("Failed to mount LittleFS"));
LittleFS.format();
Serial.println(F("Formatting LittleFS"));
Serial.println(F("Restarting Device"));
LogSerial.println(F("Formatting LittleFS"));
LogSerial.println(F("Restarting Device"));
delay(1000);
ESP.restart();
}
Serial.println(F("Mounted LittleFS"));
LogSerial.println(F("Mounted LittleFS"));
};

#endif
Loading