diff --git a/data_embed/index.html b/data_embed/index.html index 255487c..7b64e65 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -1475,7 +1475,7 @@
WiFi Active (Leave it Active for WiFi and WiFiAP normal use. Caution: Not Active means No WebUI Configuration, so ONLY deactivate it on Remote Digirepeater Mode) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 3d13ab0..a1d4178 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -123,7 +123,7 @@ void setup() { } void loop() { - WIFI_Utils::checkIfAutoAPShouldPowerOff(); + WIFI_Utils::checkAutoAPTimeout(); if (isUpdatingOTA) { ElegantOTA.loop(); @@ -136,7 +136,7 @@ void loop() { thirdLine = Utils::getLocalIP(); - WIFI_Utils::checkWiFi(); // Always use WiFi, not related to IGate/Digi mode + WIFI_Utils::checkWiFi(); #ifdef HAS_A7670 if (Config.aprs_is.active && !modemLoggedToAPRSIS) A7670_Utils::APRS_IS_connect(); diff --git a/src/aprs_is_utils.cpp b/src/aprs_is_utils.cpp index c7e2ff0..79f0233 100644 --- a/src/aprs_is_utils.cpp +++ b/src/aprs_is_utils.cpp @@ -71,7 +71,7 @@ namespace APRS_IS_Utils { if (WiFi.status() == WL_CONNECTED) { wifiState = "OK"; } else { - if (backUpDigiMode) { + if (backUpDigiMode || !Config.wifiAutoAP.active) { wifiState = "--"; } else { wifiState = "AP"; diff --git a/src/tnc_utils.cpp b/src/tnc_utils.cpp index e68e26f..c47f879 100644 --- a/src/tnc_utils.cpp +++ b/src/tnc_utils.cpp @@ -22,7 +22,7 @@ String inputSerialBuffer = ""; namespace TNC_Utils { void setup() { - if (Config.tnc.enableServer) { + if (Config.tnc.enableServer && Config.wifiAutoAP.active) { tncServer.stop(); tncServer.begin(); } @@ -133,12 +133,14 @@ namespace TNC_Utils { } void loop() { - if (Config.tnc.enableServer) { - checkNewClients(); - readFromClients(); - } - if (Config.tnc.enableSerial) { - readFromSerial(); + if (Config.wifiAutoAP.active) { + if (Config.tnc.enableServer) { + checkNewClients(); + readFromClients(); + } + if (Config.tnc.enableSerial) { + readFromSerial(); + } } } } \ No newline at end of file diff --git a/src/utils.cpp b/src/utils.cpp index eb40320..4b910ae 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -70,7 +70,9 @@ namespace Utils { } String getLocalIP() { - if (!WiFiConnected) { + if (!Config.wifiAutoAP.active) { + return "** WiFi AP Killed **"; + } else if (!WiFiConnected) { return "IP : 192.168.4.1"; } else if (backUpDigiMode) { return "- BACKUP DIGI MODE -"; diff --git a/src/web_utils.cpp b/src/web_utils.cpp index 33aadcf..cf88b1e 100644 --- a/src/web_utils.cpp +++ b/src/web_utils.cpp @@ -259,23 +259,25 @@ namespace WEB_Utils { } void setup() { - server.on("/", HTTP_GET, handleHome); - server.on("/status", HTTP_GET, handleStatus); - server.on("/received-packets.json", HTTP_GET, handleReceivedPackets); - server.on("/configuration.json", HTTP_GET, handleReadConfiguration); - server.on("/configuration.json", HTTP_POST, handleWriteConfiguration); - server.on("/action", HTTP_POST, handleAction); - server.on("/style.css", HTTP_GET, handleStyle); - server.on("/script.js", HTTP_GET, handleScript); - server.on("/bootstrap.css", HTTP_GET, handleBootstrapStyle); - server.on("/bootstrap.js", HTTP_GET, handleBootstrapScript); - server.on("/favicon.png", HTTP_GET, handleFavicon); - - OTA_Utils::setup(&server); // Include OTA Updater for WebServer - - server.onNotFound(handleNotFound); - - server.begin(); + if (Config.wifiAutoAP.active) { + server.on("/", HTTP_GET, handleHome); + server.on("/status", HTTP_GET, handleStatus); + server.on("/received-packets.json", HTTP_GET, handleReceivedPackets); + server.on("/configuration.json", HTTP_GET, handleReadConfiguration); + server.on("/configuration.json", HTTP_POST, handleWriteConfiguration); + server.on("/action", HTTP_POST, handleAction); + server.on("/style.css", HTTP_GET, handleStyle); + server.on("/script.js", HTTP_GET, handleScript); + server.on("/bootstrap.css", HTTP_GET, handleBootstrapStyle); + server.on("/bootstrap.js", HTTP_GET, handleBootstrapScript); + server.on("/favicon.png", HTTP_GET, handleFavicon); + + OTA_Utils::setup(&server); // Include OTA Updater for WebServer + + server.onNotFound(handleNotFound); + + server.begin(); + } } } \ No newline at end of file diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp index ca3a472..efcdc34 100644 --- a/src/wifi_utils.cpp +++ b/src/wifi_utils.cpp @@ -23,33 +23,35 @@ uint32_t lastBackupDigiTime = millis(); namespace WIFI_Utils { void checkWiFi() { - if (backUpDigiMode) { - uint32_t WiFiCheck = millis() - lastBackupDigiTime; - if (WiFi.status() != WL_CONNECTED && WiFiCheck >= 15 * 60 * 1000) { - Serial.println("*** Stoping BackUp Digi Mode ***"); - backUpDigiMode = false; - wifiCounter = 0; - } else if (WiFi.status() == WL_CONNECTED) { - Serial.println("*** WiFi Reconnect Success (Stoping Backup Digi Mode) ***"); - backUpDigiMode = false; - wifiCounter = 0; + if (Config.wifiAutoAP.active) { + if (backUpDigiMode) { + uint32_t WiFiCheck = millis() - lastBackupDigiTime; + if (WiFi.status() != WL_CONNECTED && WiFiCheck >= 15 * 60 * 1000) { + Serial.println("*** Stoping BackUp Digi Mode ***"); + backUpDigiMode = false; + wifiCounter = 0; + } else if (WiFi.status() == WL_CONNECTED) { + Serial.println("*** WiFi Reconnect Success (Stoping Backup Digi Mode) ***"); + backUpDigiMode = false; + wifiCounter = 0; + } } - } - if (!backUpDigiMode && (WiFi.status() != WL_CONNECTED) && ((millis() - previousWiFiMillis) >= 30 * 1000) && !WiFiAutoAPStarted) { - Serial.print(millis()); - Serial.println("Reconnecting to WiFi..."); - WiFi.disconnect(); - WIFI_Utils::startWiFi();//WiFi.reconnect(); - previousWiFiMillis = millis(); + if (!backUpDigiMode && (WiFi.status() != WL_CONNECTED) && ((millis() - previousWiFiMillis) >= 30 * 1000) && !WiFiAutoAPStarted) { + Serial.print(millis()); + Serial.println("Reconnecting to WiFi..."); + WiFi.disconnect(); + WIFI_Utils::startWiFi();//WiFi.reconnect(); + previousWiFiMillis = millis(); - if (Config.backupDigiMode) { - wifiCounter++; - } - if (wifiCounter >= 2) { - Serial.println("*** Starting BackUp Digi Mode ***"); - backUpDigiMode = true; - lastBackupDigiTime = millis(); + if (Config.backupDigiMode) { + wifiCounter++; + } + if (wifiCounter >= 2) { + Serial.println("*** Starting BackUp Digi Mode ***"); + backUpDigiMode = true; + lastBackupDigiTime = millis(); + } } } } @@ -131,7 +133,7 @@ namespace WIFI_Utils { } } - void checkIfAutoAPShouldPowerOff() { + void checkAutoAPTimeout() { if (WiFiAutoAPStarted && Config.wifiAutoAP.timeout > 0) { if (WiFi.softAPgetStationNum() > 0) { WiFiAutoAPTime = 0; diff --git a/src/wifi_utils.h b/src/wifi_utils.h index b7eb4a3..22cf1a5 100644 --- a/src/wifi_utils.h +++ b/src/wifi_utils.h @@ -9,7 +9,7 @@ namespace WIFI_Utils { void checkWiFi(); void startAutoAP(); void startWiFi(); - void checkIfAutoAPShouldPowerOff(); + void checkAutoAPTimeout(); void setup(); }