compass APP

This commit is contained in:
Egor
2025-01-27 20:42:03 -08:00
parent 18b95c75a8
commit 77f7daa333
5 changed files with 542 additions and 29 deletions
+29 -27
View File
@@ -1,11 +1,3 @@
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <LittleFS.h>
#include <WiFi.h>
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);
// Search for parameter in HTTP POST request
const String SSID = "ssid";
const String PASS = "pass";
@@ -21,6 +13,15 @@ const String FEND = "fend";
String ssid = "LoraSA", pass = "1234567890", ip = "192.168.1.100",
gateway = "192.168.1.1", fstart = "", fend = "", smpls = "";
#ifdef WEB_SERVER
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <LittleFS.h>
#include <WiFi.h>
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);
IPAddress localIP;
// Set your Gateway IP address
IPAddress localGateway;
@@ -73,25 +74,6 @@ bool initWiFi()
return true;
}
void writeParameterToFile(String value, String file)
{
// Write file to save value
writeFile(LittleFS, file.c_str(), value.c_str());
}
void writeParameterToParameterFile(String param, String value)
{
String file = String("/" + param + ".txt");
// Write file to save value
writeParameterToFile(value, file.c_str());
}
String readParameterFromParameterFile(String param)
{
String file = String("/" + param + ".txt");
return readFile(LittleFS, file.c_str());
}
void serverServer()
{
// Route for root / web page
@@ -203,3 +185,23 @@ void serverStart()
serverServer();
}
}
#endif
void writeParameterToFile(String value, String file)
{
// Write file to save value
writeFile(LittleFS, file.c_str(), value.c_str());
}
void writeParameterToParameterFile(String param, String value)
{
String file = String("/" + param + ".txt");
// Write file to save value
writeParameterToFile(value, file.c_str());
}
String readParameterFromParameterFile(String param)
{
String file = String("/" + param + ".txt");
return readFile(LittleFS, file.c_str());
}