Compare commits

..

No commits in common. "4d8146e64b9d90d366796dd4e51e94eb14b32a4e" and "bcda1c9ea5354d1c3efbedb117a0adf2ebe589a8" have entirely different histories.

2 changed files with 12 additions and 19 deletions

View File

@ -2,24 +2,20 @@
platform = espressif8266
board = esp12e
framework = arduino
board_build.filesystem = littlefs
board_build.ldscript = eagle.flash.4m2m.ld
lib_deps =
https://github.com/aZholtikov/ZHNetwork
https://github.com/aZholtikov/ZHConfig
https://github.com/aZholtikov/Async-Web-Server
https://github.com/bblanchon/ArduinoJson
bblanchon/ArduinoJson@^6.19.4
me-no-dev/ESP Async WebServer@^1.2.3
[env:ESP-12E-OTA]
platform = espressif8266
board = esp12e
framework = arduino
board_build.filesystem = littlefs
board_build.ldscript = eagle.flash.4m2m.ld
upload_port = 192.168.4.1
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
bblanchon/ArduinoJson@^6.19.4
me-no-dev/ESP Async WebServer@^1.2.3

View File

@ -1,7 +1,6 @@
#include "ArduinoJson.h"
#include "ArduinoOTA.h"
#include "ESPAsyncWebServer.h" // https://github.com/aZholtikov/Async-Web-Server
#include "LittleFS.h"
#include "ESPAsyncWebServer.h"
#include "Ticker.h"
#include "ZHNetwork.h"
#include "ZHConfig.h"
@ -84,7 +83,7 @@ void setup()
{
analogWriteRange(255);
LittleFS.begin();
SPIFFS.begin();
loadConfig();
@ -199,7 +198,6 @@ void onConfirmReceiving(const uint8_t *target, const uint16_t id, const bool sta
{
espnow_message_t message = espnowMessage[i];
if (message.id == id)
{
if (status)
espnowMessage.erase(espnowMessage.begin() + i);
else
@ -207,15 +205,14 @@ void onConfirmReceiving(const uint8_t *target, const uint16_t id, const bool sta
message.id = myNet.sendUnicastMessage(message.message, gatewayMAC, true);
espnowMessage.at(i) = message;
}
}
}
}
void loadConfig()
{
if (!LittleFS.exists("/config.json"))
if (!SPIFFS.exists("/config.json"))
saveConfig();
File file = LittleFS.open("/config.json", "r");
File file = SPIFFS.open("/config.json", "r");
String jsonFile = file.readString();
StaticJsonDocument<512> json;
deserializeJson(json, jsonFile);
@ -255,7 +252,7 @@ void saveConfig()
json["green"] = green;
json["blue"] = blue;
json["system"] = "empty";
File file = LittleFS.open("/config.json", "w");
File file = SPIFFS.open("/config.json", "w");
serializeJsonPretty(json, file);
file.close();
}
@ -263,7 +260,7 @@ void saveConfig()
void setupWebServer()
{
webServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
{ request->send(LittleFS, "/index.htm"); });
{ request->send(SPIFFS, "/index.htm"); });
webServer.on("/setting", HTTP_GET, [](AsyncWebServerRequest *request)
{
@ -285,8 +282,8 @@ void setupWebServer()
webServer.onNotFound([](AsyncWebServerRequest *request)
{
if (LittleFS.exists(request->url()))
request->send(LittleFS, request->url());
if (SPIFFS.exists(request->url()))
request->send(SPIFFS, request->url());
else
{
request->send(404, "text/plain", "File Not Found");