Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved to LittleFS due to SPIFFS deprecation #1652

Open
wants to merge 2 commits into
base: feature_asyncwebserver
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/compile_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
fail-fast: false
matrix:
example:
- "examples/Parameters/SPIFFS/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino"
- "examples/Parameters/SPIFFS/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino"
- "examples/Parameters/LittleFS/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino"
- "examples/Parameters/LittleFS/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino"
- "examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino"
- "examples/NonBlocking/AutoConnectNonBlockingwParams/AutoConnectNonBlockingwParams.ino"
- "examples/NonBlocking/AutoConnectNonBlocking/AutoConnectNonBlocking.ino"
Expand Down Expand Up @@ -70,8 +70,8 @@ jobs:
fail-fast: false
matrix:
example:
- "examples/Parameters/SPIFFS/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino"
- "examples/Parameters/SPIFFS/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino"
- "examples/Parameters/LittleFS/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino"
- "examples/Parameters/LittleFS/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino"
- "examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino"
- "examples/NonBlocking/AutoConnectNonBlockingwParams/AutoConnectNonBlockingwParams.ino"
- "examples/NonBlocking/AutoConnectNonBlocking/AutoConnectNonBlocking.ino"
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ script:
- arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,dbg=Serial,lvl=CORE --save-prefs
- build_examples
- arduino --board esp32:esp32:esp32:FlashFreq=80,FlashSize=4M,DebugLevel=info --save-prefs
# some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them
# some examples fail (LittleFS defines differ esp32 vs esp8266) so we exclude them
- build_examples
# - arduino -v --verbose-build --verify $PWD/examples/AutoConnect/AutoConnect.ino

Expand Down
14 changes: 7 additions & 7 deletions WiFiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ bool WiFiManager::WiFi_scanNetworks(bool force,bool async){
force = false;
async = true;
force = _lastscan == 0;
if(force || (millis()-_lastscan > 60000)){
if(force || (millis()-_lastscan > _scancachetime)){
int8_t res;
_startscan = millis();

Expand Down Expand Up @@ -2477,20 +2477,20 @@ bool WiFiManager::erase(bool opt){
#endif
return err == ESP_OK;
}
#elif defined(ESP8266) && defined(spiffs_api_h)
#elif defined(ESP8266) && defined(LittleFS_api_h)
if(opt){
bool ret = false;
if(SPIFFS.begin()){
if(LittleFS.begin()){
#ifdef WM_DEBUG_LEVEL
DEBUG_WM(F("Erasing SPIFFS"));
DEBUG_WM(F("Erasing LittleFS"));
#endif
bool ret = SPIFFS.format();
bool ret = LittleFS.format();
#ifdef WM_DEBUG_LEVEL
DEBUG_WM(DEBUG_VERBOSE,F("spiffs erase: "),ret ? "Success" : "ERROR");
DEBUG_WM(DEBUG_VERBOSE,F("LittleFS erase: "),ret ? "Success" : "ERROR");
#endif
} else{
#ifdef WM_DEBUG_LEVEL
DEBUG_WM(F("[ERROR] Could not start SPIFFS"));
DEBUG_WM(F("[ERROR] Could not start LittleFS"));
#endif
}
return ret;
Expand Down
2 changes: 1 addition & 1 deletion WiFiManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ class WiFiManager
// the refresh button bypasses cache
// no aps found is problematic as scans are always going to want to run, leading to page load delays
boolean _preloadwifiscan = false; // preload wifiscan if true
boolean _asyncScan = false; // perform wifi network scan async
boolean _asyncScan = true; // perform wifi network scan async
unsigned int _scancachetime = 30000; // ms cache time for background scans

boolean _disableIpFields = false; // modify function of setShow_X_Fields(false), forces ip fields off instead of default show if set, eg. _staShowStaticFields=-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager

#ifdef ESP32
#include <SPIFFS.h>
#include <LittleFS.h>
#endif

#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
Expand All @@ -27,17 +27,17 @@ void setup() {
Serial.println();

//clean FS, for testing
//SPIFFS.format();
//LittleFS.format();

//read configuration from FS json
Serial.println("mounting FS...");

if (SPIFFS.begin()) {
if (LittleFS.begin()) {
Serial.println("mounted file system");
if (SPIFFS.exists("/config.json")) {
if (LittleFS.exists("/config.json")) {
//file exists, reading and loading
Serial.println("reading config file");
File configFile = SPIFFS.open("/config.json", "r");
File configFile = LittleFS.open("/config.json", "r");
if (configFile) {
Serial.println("opened config file");
size_t size = configFile.size();
Expand Down Expand Up @@ -143,7 +143,7 @@ void setup() {
json["mqtt_port"] = mqtt_port;
json["api_token"] = api_token;

File configFile = SPIFFS.open("/config.json", "w");
File configFile = LittleFS.open("/config.json", "w");
if (!configFile) {
Serial.println("failed to open config file for writing");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager

#ifdef ESP32
#include <SPIFFS.h>
#include <LittleFS.h>
#endif

#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
Expand Down Expand Up @@ -33,17 +33,17 @@ void setup() {
Serial.println();

//clean FS, for testing
//SPIFFS.format();
//LittleFS.format();

//read configuration from FS json
Serial.println("mounting FS...");

if (SPIFFS.begin()) {
if (LittleFS.begin()) {
Serial.println("mounted file system");
if (SPIFFS.exists("/config.json")) {
if (LittleFS.exists("/config.json")) {
//file exists, reading and loading
Serial.println("reading config file");
File configFile = SPIFFS.open("/config.json", "r");
File configFile = LittleFS.open("/config.json", "r");
if (configFile) {
Serial.println("opened config file");
size_t size = configFile.size();
Expand Down Expand Up @@ -167,7 +167,7 @@ void setup() {
json["gateway"] = WiFi.gatewayIP().toString();
json["subnet"] = WiFi.subnetMask().toString();

File configFile = SPIFFS.open("/config.json", "w");
File configFile = LittleFS.open("/config.json", "w");
if (!configFile) {
Serial.println("failed to open config file for writing");
}
Expand Down