From d94a7bb064442d3a4bd43c6f8cbb2a9395b0b896 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Sun, 12 Jan 2025 20:28:34 +0100 Subject: [PATCH] Optimised memory use for wifi config --- TEF6686_ESP32.ino | 4 ---- src/comms.cpp | 4 ++++ src/comms.h | 3 +++ src/gui.cpp | 4 ++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 46ac77e..343ec3b 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -648,10 +648,6 @@ void setup() { tft.init(); tft.initDMA(); - webserver.on("/", handleRoot); - webserver.on("/downloadCSV", HTTP_GET, handleDownloadCSV); - webserver.on("/logo.png", handleLogo); - doTheme(); if (displayflip == 0) { diff --git a/src/comms.cpp b/src/comms.cpp index 369fe85..72880cb 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -911,6 +911,9 @@ void tryWiFi() { if (wc.autoConnect()) { Server.begin(); Udp.begin(9031); + webserver.on("/", handleRoot); + webserver.on("/downloadCSV", HTTP_GET, handleDownloadCSV); + webserver.on("/logo.png", handleLogo); webserver.begin(); NTPupdate(); remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient); @@ -927,6 +930,7 @@ void tryWiFi() { } } else { Server.end(); + webserver.stop(); Udp.stop(); WiFi.mode(WIFI_OFF); } diff --git a/src/comms.h b/src/comms.h index 6ebc2e0..2b88539 100644 --- a/src/comms.h +++ b/src/comms.h @@ -150,4 +150,7 @@ extern void startFMDXScan(); extern void cancelDXScan(); extern void printLogbookCSV(); extern void NTPupdate(); +extern void handleRoot(); +extern void handleDownloadCSV(); +extern void handleLogo(); #endif \ No newline at end of file diff --git a/src/gui.cpp b/src/gui.cpp index 2b1e604..c0e3a02 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -5728,6 +5728,10 @@ void DoMenu() { char rabbitearspw [9]; RabbitearsPassword.toCharArray(rabbitearspw, 9); UpdateFonts(1); + if (wifi) { + wifi = false; + tryWiFi(); + } WiFiConnectParam XDRGTK_key_text("Set XDRGTK Password: (max 8 characters)"); WiFiConnectParam XDRGTK_key_input("XDRGTK_key", "Password", key, 9); WiFiConnectParam RabbitearsUser_text("Set rabbitears.info live bandscan user ID");