Compare commits

..

No commits in common. "24ba0a09f49a9dd6566d72a785aa8124a1ebb103" and "8e9082f05e8fcf47f2734f88cabb01f34d0460a8" have entirely different histories.

2 changed files with 24 additions and 28 deletions

View File

@ -2,52 +2,48 @@
platform = espressif8266 platform = espressif8266
board = nodemcuv2 board = nodemcuv2
framework = arduino framework = arduino
board_build.filesystem = littlefs
lib_deps = lib_deps =
https://github.com/aZholtikov/ZHNetwork https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server bblanchon/ArduinoJson@^6.19.4
https://github.com/bblanchon/ArduinoJson me-no-dev/ESP Async WebServer@^1.2.3
https://github.com/marvinroger/async-mqtt-client marvinroger/AsyncMqttClient@^0.9.0
[env:ESP8266-OTA] [env:ESP8266-OTA]
platform = espressif8266 platform = espressif8266
board = nodemcuv2 board = nodemcuv2
framework = arduino framework = arduino
board_build.filesystem = littlefs
upload_port = 192.168.1.113 upload_port = 192.168.1.113
upload_protocol = espota upload_protocol = espota
lib_deps = lib_deps =
https://github.com/aZholtikov/ZHNetwork https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server bblanchon/ArduinoJson@^6.19.4
https://github.com/bblanchon/ArduinoJson me-no-dev/ESP Async WebServer@^1.2.3
https://github.com/marvinroger/async-mqtt-client marvinroger/AsyncMqttClient@^0.9.0
[env:ESP32] [env:ESP32]
platform = espressif32 platform = espressif32
board = az-delivery-devkit-v4 board = az-delivery-devkit-v4
framework = arduino framework = arduino
board_build.filesystem = littlefs
lib_deps = lib_deps =
https://github.com/aZholtikov/ZHNetwork https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server bblanchon/ArduinoJson@^6.19.4
https://github.com/bblanchon/ArduinoJson me-no-dev/ESP Async WebServer@^1.2.3
https://github.com/marvinroger/async-mqtt-client marvinroger/AsyncMqttClient@^0.9.0
https://github.com/luc-github/ESP32SSDP luc-github/ESP32SSDP@^1.2.0
[env:ESP32-OTA] [env:ESP32-OTA]
platform = espressif32 platform = espressif32
board = az-delivery-devkit-v4 board = az-delivery-devkit-v4
framework = arduino framework = arduino
board_build.filesystem = littlefs
upload_port = 192.168.1.110 upload_port = 192.168.1.110
upload_protocol = espota upload_protocol = espota
lib_deps = lib_deps =
https://github.com/aZholtikov/ZHNetwork https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server bblanchon/ArduinoJson@^6.19.4
https://github.com/bblanchon/ArduinoJson me-no-dev/ESP Async WebServer@^1.2.3
https://github.com/marvinroger/async-mqtt-client marvinroger/AsyncMqttClient@^0.9.0
https://github.com/luc-github/ESP32SSDP luc-github/ESP32SSDP@^1.2.0

View File

@ -1,8 +1,7 @@
#include "ArduinoJson.h" #include "ArduinoJson.h"
#include "ArduinoOTA.h" #include "ArduinoOTA.h"
#include "ESPAsyncWebServer.h" // https://github.com/aZholtikov/Async-Web-Server #include "ESPAsyncWebServer.h"
#include "AsyncMQTTClient.h" #include "AsyncMQTTClient.h"
#include "LittleFS.h"
#include "Ticker.h" #include "Ticker.h"
#include "ZHNetwork.h" #include "ZHNetwork.h"
#include "ZHConfig.h" #include "ZHConfig.h"
@ -10,6 +9,7 @@
#include "ESP8266SSDP.h" #include "ESP8266SSDP.h"
#endif #endif
#if defined(ESP32) #if defined(ESP32)
#include "SPIFFS.h"
#include "ESP32SSDP.h" #include "ESP32SSDP.h"
#endif #endif
@ -34,7 +34,7 @@ void setupWebServer(void);
void connectToMqtt(void); void connectToMqtt(void);
const String firmware{"1.26"}; const String firmware{"1.25"};
String espnowNetName{"DEFAULT"}; String espnowNetName{"DEFAULT"};
@ -72,7 +72,7 @@ void attributesMessageTimerCallback(void);
void setup() void setup()
{ {
LittleFS.begin(); SPIFFS.begin();
loadConfig(); loadConfig();
@ -433,9 +433,9 @@ String getValue(String data, char separator, uint8_t index)
void loadConfig() void loadConfig()
{ {
if (!LittleFS.exists("/config.json")) if (!SPIFFS.exists("/config.json"))
saveConfig(); saveConfig();
File file = LittleFS.open("/config.json", "r"); File file = SPIFFS.open("/config.json", "r");
String jsonFile = file.readString(); String jsonFile = file.readString();
StaticJsonDocument<1024> json; StaticJsonDocument<1024> json;
deserializeJson(json, jsonFile); deserializeJson(json, jsonFile);
@ -465,7 +465,7 @@ void saveConfig()
json["mqttUserPassword"] = mqttUserPassword; json["mqttUserPassword"] = mqttUserPassword;
json["topicPrefix"] = topicPrefix; json["topicPrefix"] = topicPrefix;
json["system"] = "empty"; json["system"] = "empty";
File file = LittleFS.open("/config.json", "w"); File file = SPIFFS.open("/config.json", "w");
serializeJsonPretty(json, file); serializeJsonPretty(json, file);
file.close(); file.close();
} }
@ -505,7 +505,7 @@ void setupWebServer()
request->send(200, "text/xml", ssdpSend); }); request->send(200, "text/xml", ssdpSend); });
webServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request) webServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
{ request->send(LittleFS, "/index.htm"); }); { request->send(SPIFFS, "/index.htm"); });
webServer.on("/setting", HTTP_GET, [](AsyncWebServerRequest *request) webServer.on("/setting", HTTP_GET, [](AsyncWebServerRequest *request)
{ {
@ -528,8 +528,8 @@ void setupWebServer()
webServer.onNotFound([](AsyncWebServerRequest *request) webServer.onNotFound([](AsyncWebServerRequest *request)
{ {
if (LittleFS.exists(request->url())) if (SPIFFS.exists(request->url()))
request->send(LittleFS, request->url()); request->send(SPIFFS, request->url());
else else
{ {
request->send(404, "text/plain", "File Not Found"); request->send(404, "text/plain", "File Not Found");