mirror of
https://github.com/Genaker/LoraSA.git
synced 2026-08-09 10:23:01 +02:00
compass APP
This commit is contained in:
+29
-27
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user