test for Killed Wifi Active

This commit is contained in:
richonguzman 2024-10-06 23:23:22 -03:00
parent df9060d906
commit 58d8736969
8 changed files with 60 additions and 52 deletions

View File

@ -1475,7 +1475,7 @@
<label
for="wifi.autoAP.active"
class="form-label"
>WiFi AP Active<small> (Caution: Not Active means No WebUI Configuration)</small></label
>WiFi Active<small> (Leave it Active for WiFi and WiFiAP normal use. <strong>Caution:</strong> Not Active means No WebUI Configuration, so <strong>ONLY</strong> deactivate it on Remote Digirepeater Mode)</small></label
>
</div>
</div>

View File

@ -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();

View File

@ -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";

View File

@ -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,6 +133,7 @@ namespace TNC_Utils {
}
void loop() {
if (Config.wifiAutoAP.active) {
if (Config.tnc.enableServer) {
checkNewClients();
readFromClients();
@ -142,3 +143,4 @@ namespace TNC_Utils {
}
}
}
}

View File

@ -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 -";

View File

@ -259,6 +259,7 @@ namespace WEB_Utils {
}
void setup() {
if (Config.wifiAutoAP.active) {
server.on("/", HTTP_GET, handleHome);
server.on("/status", HTTP_GET, handleStatus);
server.on("/received-packets.json", HTTP_GET, handleReceivedPackets);
@ -277,5 +278,6 @@ namespace WEB_Utils {
server.begin();
}
}
}

View File

@ -23,6 +23,7 @@ uint32_t lastBackupDigiTime = millis();
namespace WIFI_Utils {
void checkWiFi() {
if (Config.wifiAutoAP.active) {
if (backUpDigiMode) {
uint32_t WiFiCheck = millis() - lastBackupDigiTime;
if (WiFi.status() != WL_CONNECTED && WiFiCheck >= 15 * 60 * 1000) {
@ -53,6 +54,7 @@ namespace WIFI_Utils {
}
}
}
}
void startAutoAP() {
WiFi.mode(WIFI_MODE_NULL);
@ -131,7 +133,7 @@ namespace WIFI_Utils {
}
}
void checkIfAutoAPShouldPowerOff() {
void checkAutoAPTimeout() {
if (WiFiAutoAPStarted && Config.wifiAutoAP.timeout > 0) {
if (WiFi.softAPgetStationNum() > 0) {
WiFiAutoAPTime = 0;

View File

@ -9,7 +9,7 @@ namespace WIFI_Utils {
void checkWiFi();
void startAutoAP();
void startWiFi();
void checkIfAutoAPShouldPowerOff();
void checkAutoAPTimeout();
void setup();
}