Migration from deprecated SPIFFS to LittleFS

Signed-off-by: Oliver Fassbender <git@intrepid.de>
pull/112/head
Oliver Fassbender 2020-07-29 10:14:12 +02:00
parent a9a0348efb
commit e1475afa00
2 changed files with 7 additions and 6 deletions

View File

@ -49,6 +49,7 @@ SOFTWARE.
#include "OctoPrintClient.h" #include "OctoPrintClient.h"
#include "OpenWeatherMapClient.h" #include "OpenWeatherMapClient.h"
#include "WeatherStationFonts.h" #include "WeatherStationFonts.h"
#include "LittleFS.h"
#include "FS.h" #include "FS.h"
#include "SH1106Wire.h" #include "SH1106Wire.h"
#include "SSD1306Wire.h" #include "SSD1306Wire.h"

View File

@ -198,7 +198,7 @@ static const char COLOR_THEMES[] PROGMEM = "<option>red</option>"
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
SPIFFS.begin(); LittleFS.begin();
delay(10); delay(10);
//New Line to clear from start garbage //New Line to clear from start garbage
@ -435,7 +435,7 @@ void handleSystemReset() {
return server.requestAuthentication(); return server.requestAuthentication();
} }
Serial.println("Reset System Configuration"); Serial.println("Reset System Configuration");
if (SPIFFS.remove(CONFIG)) { if (LittleFS.remove(CONFIG)) {
redirectHome(); redirectHome();
ESP.restart(); ESP.restart();
} }
@ -1114,8 +1114,8 @@ int8_t getWifiQuality() {
void writeSettings() { void writeSettings() {
// Save decoded message to SPIFFS file for playback on power up. // Save decoded message to LittleFS file for playback on power up.
File f = SPIFFS.open(CONFIG, "w"); File f = LittleFS.open(CONFIG, "w");
if (!f) { if (!f) {
Serial.println("File open failed!"); Serial.println("File open failed!");
} else { } else {
@ -1150,12 +1150,12 @@ void writeSettings() {
} }
void readSettings() { void readSettings() {
if (SPIFFS.exists(CONFIG) == false) { if (LittleFS.exists(CONFIG) == false) {
Serial.println("Settings File does not yet exists."); Serial.println("Settings File does not yet exists.");
writeSettings(); writeSettings();
return; return;
} }
File fr = SPIFFS.open(CONFIG, "r"); File fr = LittleFS.open(CONFIG, "r");
String line; String line;
while(fr.available()) { while(fr.available()) {
line = fr.readStringUntil('\n'); line = fr.readStringUntil('\n');