diff --git a/data/index.html b/data/index.html
new file mode 100644
index 0000000..92cddf1
--- /dev/null
+++ b/data/index.html
@@ -0,0 +1,40 @@
+
+
+
+
+ ESP Wi-Fi Manager
+
+
+
+
+
+
+
+
LORA SA ESP32 CONFIG
+
+
+
+
+
diff --git a/data/style.css b/data/style.css
new file mode 100644
index 0000000..491d8c4
--- /dev/null
+++ b/data/style.css
@@ -0,0 +1,118 @@
+html {
+ font-family: Arial, Helvetica, sans-serif;
+ display: inline-block;
+ text-align: center;
+}
+
+h1 {
+ font-size: 1.8rem;
+ color: white;
+}
+
+p {
+ font-size: 1.4rem;
+}
+
+.topnav {
+ overflow: hidden;
+ background-color: #0A1128;
+}
+
+body {
+ margin: 0;
+}
+
+.content {
+ padding: 5%;
+}
+
+.card-grid {
+ max-width: 800px;
+ margin: 0 auto;
+ display: grid;
+ grid-gap: 2rem;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+}
+
+.card {
+ background-color: white;
+ box-shadow: 2px 2px 12px 1px rgba(140, 140, 140, .5);
+}
+
+.card-title {
+ font-size: 1.2rem;
+ font-weight: bold;
+ color: #034078
+}
+
+input[type=submit] {
+ border: none;
+ color: #FEFCFB;
+ background-color: #034078;
+ padding: 15px 15px;
+ text-align: center;
+ text-decoration: none;
+ display: inline-block;
+ font-size: 16px;
+ width: 100px;
+ margin-right: 10px;
+ border-radius: 4px;
+ transition-duration: 0.4s;
+}
+
+input[type=submit]:hover {
+ background-color: #1282A2;
+}
+
+input[type=text],
+input[type=number],
+select {
+ width: 50%;
+ padding: 12px 20px;
+ margin: 18px;
+ display: inline-block;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ box-sizing: border-box;
+}
+
+label {
+ font-size: 1.2rem;
+}
+
+.value {
+ font-size: 1.2rem;
+ color: #1282A2;
+}
+
+.state {
+ font-size: 1.2rem;
+ color: #1282A2;
+}
+
+button {
+ border: none;
+ color: #FEFCFB;
+ padding: 15px 32px;
+ text-align: center;
+ font-size: 16px;
+ width: 100px;
+ border-radius: 4px;
+ transition-duration: 0.4s;
+}
+
+.button-on {
+ background-color: #034078;
+}
+
+.button-on:hover {
+ background-color: #1282A2;
+}
+
+.button-off {
+ background-color: #858585;
+}
+
+.button-off:hover {
+ background-color: #252524;
+}
diff --git a/data/text.txt b/data/text.txt
new file mode 100644
index 0000000..e69de29
diff --git a/include/File.h b/include/File.h
new file mode 100644
index 0000000..d726c40
--- /dev/null
+++ b/include/File.h
@@ -0,0 +1,43 @@
+#include "FS.h"
+#include
+
+String readFile(fs::FS &fs, const char *path)
+{
+ Serial.printf("Reading file: %s\r\n", path);
+
+ File file = fs.open(path);
+ if (!file || file.isDirectory())
+ {
+ Serial.println("- failed to open file for reading");
+ return String("");
+ }
+ String content;
+ Serial.println("- read from file:");
+ while (file.available())
+ {
+ content = file.readStringUntil('\n');
+ }
+ file.close();
+ return content;
+}
+
+void writeFile(fs::FS &fs, const char *path, const char *message)
+{
+ Serial.printf("Writing file: %s\r\n", path);
+
+ File file = fs.open(path, FILE_WRITE);
+ if (!file)
+ {
+ Serial.println("- failed to open file for writing");
+ return;
+ }
+ if (file.print(message))
+ {
+ Serial.println("- file written");
+ }
+ else
+ {
+ Serial.println("- write failed");
+ }
+ file.close();
+}
diff --git a/platformio.ini b/platformio.ini
index 32ddad0..2868df9 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -26,12 +26,15 @@ framework = arduino
upload_speed = 921600
monitor_speed = 115200
board_build.f_cpu = 240000000
+board_build.filesystem = littlefs
lib_deps =
ropg/Heltec_ESP32_LoRa_v3@^0.9.1
bblanchon/ArduinoJson@^7.2.0
+ ESP Async WebServer
build_flags =
-DHELTEC_POWER_BUTTON
-DHELTEC
+
[env:heltec_wifi_lora_32_V3_433]
platform = espressif32
diff --git a/src/main.cpp b/src/main.cpp
index a3d9b44..20fa879 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -27,9 +27,18 @@
#ifdef HELTEC
#include
#endif
+#include "FS.h"
+#include
+#include
+#include
+#include
#include
#include
+#include "WIFI_SERVER.h"
+
+#define FORMAT_LITTLEFS_IF_FAILED true
+
// #define OSD_ENABLED true
// #define WIFI_SCANNING_ENABLED true
// #define BT_SCANNING_ENABLED true
@@ -548,6 +557,7 @@ void drone_sound_alarm(void *arg, Event &e);
void setup(void)
{
+
#ifdef LILYGO
setupBoards(); // true for disable U8g2 display library
delay(500);
@@ -580,6 +590,7 @@ void setup(void)
pinMode(BUZZER_PIN, OUTPUT);
pinMode(REB_PIN, OUTPUT);
heltec_setup();
+ serverStart();
#ifdef JOYSTICK_ENABLED
calibrate_joy();
pinMode(JOY_BTN_PIN, INPUT_PULLUP);
@@ -600,6 +611,14 @@ void setup(void)
}
init_radio();
+
+ if (!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED))
+ {
+ Serial.println("LittleFS Mount Failed");
+ }
+
+ // writeFile(LittleFS, "/text.txt", "{WIFI:{name:\"sdfsdf\", Password:\"sdfsdf\"}");
+ Serial.println(readFile(LittleFS, "/text.txt"));
#ifndef LILYGO
vbat = heltec_vbat();
both.printf("V battery: %.2fV (%d%%)\n", vbat, heltec_battery_percent(vbat));