Skip to content

Commit

Permalink
Version 1.26
Browse files Browse the repository at this point in the history
Changed FS from SPIFFS to LittleFS.
  • Loading branch information
aZholtikov committed Feb 4, 2023
1 parent eebaca3 commit 24ba0a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
12 changes: 8 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,52 @@
platform = espressif8266
board = nodemcuv2
framework = arduino
board_build.filesystem = littlefs
lib_deps =
https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server
https://github.com/bblanchon/ArduinoJson
https://github.com/me-no-dev/ESPAsyncWebServer
https://github.com/marvinroger/async-mqtt-client

[env:ESP8266-OTA]
platform = espressif8266
board = nodemcuv2
framework = arduino
board_build.filesystem = littlefs
upload_port = 192.168.1.113
upload_protocol = espota
lib_deps =
https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server
https://github.com/bblanchon/ArduinoJson
https://github.com/me-no-dev/ESPAsyncWebServer
https://github.com/marvinroger/async-mqtt-client

[env:ESP32]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
board_build.filesystem = littlefs
lib_deps =
https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server
https://github.com/bblanchon/ArduinoJson
https://github.com/me-no-dev/ESPAsyncWebServer
https://github.com/marvinroger/async-mqtt-client
https://github.com/luc-github/ESP32SSDP

[env:ESP32-OTA]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
board_build.filesystem = littlefs
upload_port = 192.168.1.110
upload_protocol = espota
lib_deps =
https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server
https://github.com/bblanchon/ArduinoJson
https://github.com/me-no-dev/ESPAsyncWebServer
https://github.com/marvinroger/async-mqtt-client
https://github.com/luc-github/ESP32SSDP
20 changes: 10 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include "ArduinoJson.h"
#include "ArduinoOTA.h"
#include "ESPAsyncWebServer.h"
#include "ESPAsyncWebServer.h" // https://github.com/aZholtikov/Async-Web-Server
#include "AsyncMQTTClient.h"
#include "LittleFS.h"
#include "Ticker.h"
#include "ZHNetwork.h"
#include "ZHConfig.h"
#if defined(ESP8266)
#include "ESP8266SSDP.h"
#endif
#if defined(ESP32)
#include "SPIFFS.h"
#include "ESP32SSDP.h"
#endif

Expand All @@ -34,7 +34,7 @@ void setupWebServer(void);

void connectToMqtt(void);

const String firmware{"1.25"};
const String firmware{"1.26"};

String espnowNetName{"DEFAULT"};

Expand Down Expand Up @@ -72,7 +72,7 @@ void attributesMessageTimerCallback(void);

void setup()
{
SPIFFS.begin();
LittleFS.begin();

loadConfig();

Expand Down Expand Up @@ -433,9 +433,9 @@ String getValue(String data, char separator, uint8_t index)

void loadConfig()
{
if (!SPIFFS.exists("/config.json"))
if (!LittleFS.exists("/config.json"))
saveConfig();
File file = SPIFFS.open("/config.json", "r");
File file = LittleFS.open("/config.json", "r");
String jsonFile = file.readString();
StaticJsonDocument<1024> json;
deserializeJson(json, jsonFile);
Expand Down Expand Up @@ -465,7 +465,7 @@ void saveConfig()
json["mqttUserPassword"] = mqttUserPassword;
json["topicPrefix"] = topicPrefix;
json["system"] = "empty";
File file = SPIFFS.open("/config.json", "w");
File file = LittleFS.open("/config.json", "w");
serializeJsonPretty(json, file);
file.close();
}
Expand Down Expand Up @@ -505,7 +505,7 @@ void setupWebServer()
request->send(200, "text/xml", ssdpSend); });

webServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
{ request->send(SPIFFS, "/index.htm"); });
{ request->send(LittleFS, "/index.htm"); });

webServer.on("/setting", HTTP_GET, [](AsyncWebServerRequest *request)
{
Expand All @@ -528,8 +528,8 @@ void setupWebServer()

webServer.onNotFound([](AsyncWebServerRequest *request)
{
if (SPIFFS.exists(request->url()))
request->send(SPIFFS, request->url());
if (LittleFS.exists(request->url()))
request->send(LittleFS, request->url());
else
{
request->send(404, "text/plain", "File Not Found");
Expand Down

0 comments on commit 24ba0a0

Please sign in to comment.