mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-19 03:34:48 +01:00
test for Killed Wifi Active
This commit is contained in:
parent
df9060d906
commit
58d8736969
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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 -";
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
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
|
||||
OTA_Utils::setup(&server); // Include OTA Updater for WebServer
|
||||
|
||||
server.onNotFound(handleNotFound);
|
||||
server.onNotFound(handleNotFound);
|
||||
|
||||
server.begin();
|
||||
server.begin();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace WIFI_Utils {
|
|||
void checkWiFi();
|
||||
void startAutoAP();
|
||||
void startWiFi();
|
||||
void checkIfAutoAPShouldPowerOff();
|
||||
void checkAutoAPTimeout();
|
||||
void setup();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue