forked from iarv/LoRa_APRS_iGate
WEBUI update
This commit is contained in:
@@ -36,7 +36,8 @@
|
||||
"blacklist": "",
|
||||
"digi": {
|
||||
"mode": 0,
|
||||
"ecoMode": 0
|
||||
"ecoMode": 0,
|
||||
"backupDigiMode": false
|
||||
},
|
||||
"lora": {
|
||||
"rxActive": true,
|
||||
@@ -113,7 +114,6 @@
|
||||
},
|
||||
"other": {
|
||||
"rememberStationTime": 30,
|
||||
"backupDigiMode": false,
|
||||
"rebootMode": false,
|
||||
"rebootModeTime": 6,
|
||||
"startupDelay": 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-bs-theme="auto">
|
||||
<html lang="en" data-bs-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
@@ -36,8 +36,8 @@
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Backup</a>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" id="backup">Download</a>
|
||||
<a class="dropdown-item" href="#" id="restore">Restore</a>
|
||||
<a class="dropdown-item" href="#" id="backup">Download Conf.</a>
|
||||
<a class="dropdown-item" href="#" id="restore">Restore Conf.</a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
@@ -257,7 +257,7 @@
|
||||
name="personalNote"
|
||||
id="personalNote"
|
||||
class="form-control"
|
||||
placeholder="A couple of words"
|
||||
placeholder="Describe here your Station"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 mt-3">
|
||||
@@ -748,6 +748,24 @@
|
||||
<option value="1">Ultra Eco Mode (Sleep till Packet Rx (WiFiAP/WebUI & Display disabled))</option>
|
||||
<option value="2">OFF (Normal Mode - WiFiAP disabled but Serial Output still enabled)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12 mt-3">
|
||||
<div class="form-check form-switch">
|
||||
<div class="form-text">
|
||||
If WiFi/server connection is lost in iGate-only mode, the device switches to Digipeater mode (WIDE1-1) and retries connection every 15 minutes.
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="digi.backupDigiMode"
|
||||
id="digi.backupDigiMode"
|
||||
class="form-check-input"
|
||||
/>
|
||||
<label
|
||||
for="digi.backupDigiMode"
|
||||
class="form-label"
|
||||
>Backup Digipeater Mode</label
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2127,52 +2145,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="row my-5 d-flex align-items-top">
|
||||
<div class="col-lg-3 col-sm-12">
|
||||
<h5>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
fill="currentColor"
|
||||
class="bi bi-heart-pulse-fill"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M1.475 9C2.702 10.84 4.779 12.871 8 15c3.221-2.129 5.298-4.16 6.525-6H12a.5.5 0 0 1-.464-.314l-1.457-3.642-1.598 5.593a.5.5 0 0 1-.945.049L5.889 6.568l-1.473 2.21A.5.5 0 0 1 4 9z"
|
||||
/>
|
||||
<path
|
||||
d="M.88 8C-2.427 1.68 4.41-2 7.823 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C11.59-2 18.426 1.68 15.12 8h-2.783l-1.874-4.686a.5.5 0 0 0-.945.049L7.921 8.956 6.464 5.314a.5.5 0 0 0-.88-.091L3.732 8z"
|
||||
/>
|
||||
</svg>
|
||||
Experimental
|
||||
</h5>
|
||||
<small>You can test new features. <u>Use at your own risk!</u></small>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-12">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="form-check form-switch">
|
||||
<div class="form-text">
|
||||
When "only" iGate Mode loses WiFi, it will change into a Digipeater Mode and after 15 min check if WiFi available and return to "only" iGate Mode.
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="other.backupDigiMode"
|
||||
id="other.backupDigiMode"
|
||||
class="form-check-input"
|
||||
/>
|
||||
<label
|
||||
for="other.backupDigiMode"
|
||||
class="form-label"
|
||||
>Backup Digipeater Mode</label
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer
|
||||
@@ -2227,7 +2199,7 @@
|
||||
<a
|
||||
href="https://cd3eap.aguayoki.cl/"
|
||||
target="_blank"
|
||||
>CD3EAP</a
|
||||
>CA3EAP</a
|
||||
></b
|
||||
>: Settings Page.
|
||||
</p>
|
||||
|
||||
@@ -140,6 +140,7 @@ function loadSettings(settings) {
|
||||
// Digi
|
||||
document.getElementById("digi.mode").value = settings.digi.mode;
|
||||
document.getElementById("digi.ecoMode").value = settings.digi.ecoMode;
|
||||
document.getElementById("digi.backupDigiMode").checked = settings.digi.backupDigiMode;
|
||||
|
||||
// LoRa
|
||||
document.getElementById("lora.rxActive").checked = settings.lora.rxActive;
|
||||
@@ -259,9 +260,6 @@ function loadSettings(settings) {
|
||||
document.getElementById("ntp.server").value = settings.ntp.server;
|
||||
document.getElementById("ntp.gmtCorrection").value = settings.ntp.gmtCorrection;
|
||||
|
||||
// Experimental
|
||||
document.getElementById("other.backupDigiMode").checked = settings.other.backupDigiMode;
|
||||
|
||||
updateImage();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,8 @@ public:
|
||||
class DIGI {
|
||||
public:
|
||||
int mode;
|
||||
int ecoMode; // 0 = Not Active | 1 = Ultra EcoMode | 2 = Not Active (WiFi OFF, Serial ON)
|
||||
int ecoMode; // 0 = Not Active | 1 = Ultra EcoMode | 2 = Not Active (WiFi OFF, Serial ON)
|
||||
bool backupDigiMode;
|
||||
};
|
||||
|
||||
class LoraModule {
|
||||
@@ -172,7 +173,6 @@ public:
|
||||
String callsign;
|
||||
String tacticalCallsign;
|
||||
int rememberStationTime;
|
||||
bool backupDigiMode;
|
||||
bool rebootMode;
|
||||
int rebootModeTime;
|
||||
int startupDelay;
|
||||
|
||||
@@ -67,8 +67,8 @@ ___________________________________________________________________*/
|
||||
#endif
|
||||
|
||||
|
||||
String versionDate = "2026-01-20";
|
||||
String versionNumber = "3.1.7.1";
|
||||
String versionDate = "2026-01-21";
|
||||
String versionNumber = "3.2";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
WiFiClient mqttClient;
|
||||
@@ -86,7 +86,7 @@ WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||
bool isUpdatingOTA = false;
|
||||
uint32_t lastBatteryCheck = 0;
|
||||
|
||||
bool backUpDigiMode = false;
|
||||
bool backupDigiMode = false;
|
||||
bool modemLoggedToAPRSIS = false;
|
||||
|
||||
#ifdef HAS_EPAPER
|
||||
@@ -187,7 +187,7 @@ void loop() {
|
||||
APRS_IS_Utils::processLoRaPacket(packet); // Send received packet to APRSIS
|
||||
}
|
||||
|
||||
if (Config.loramodule.txActive && (Config.digi.mode == 2 || Config.digi.mode == 3 || backUpDigiMode)) { // If Digi enabled
|
||||
if (Config.loramodule.txActive && (Config.digi.mode == 2 || Config.digi.mode == 3 || backupDigiMode)) { // If Digi enabled
|
||||
STATION_Utils::clean25SegBuffer();
|
||||
DIGI_Utils::processLoRaPacket(packet); // Send received packet to Digi
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ extern String fifthLine;
|
||||
extern String sixthLine;
|
||||
extern String seventhLine;
|
||||
extern bool modemLoggedToAPRSIS;
|
||||
extern bool backUpDigiMode;
|
||||
extern bool backupDigiMode;
|
||||
extern String versionNumber;
|
||||
|
||||
uint32_t lastRxTime = millis();
|
||||
@@ -96,7 +96,7 @@ namespace APRS_IS_Utils {
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
wifiState = "OK";
|
||||
} else {
|
||||
if (backUpDigiMode || Config.digi.ecoMode == 1 || Config.digi.ecoMode == 2) {
|
||||
if (backupDigiMode || Config.digi.ecoMode == 1 || Config.digi.ecoMode == 2) {
|
||||
wifiState = "--";
|
||||
} else {
|
||||
wifiState = "AP";
|
||||
@@ -308,13 +308,13 @@ namespace APRS_IS_Utils {
|
||||
aprsIsClient.stop();
|
||||
Config.aprs_is.active = false;
|
||||
} else if (packet.indexOf("verified") != -1 ) {
|
||||
if (Config.backupDigiMode) lastServerCheck = currentTime;
|
||||
if (Config.digi.backupDigiMode) lastServerCheck = currentTime;
|
||||
passcodeValid = true;
|
||||
}
|
||||
}
|
||||
if (passcodeValid) {
|
||||
if (packet.startsWith("#")) {
|
||||
if (Config.backupDigiMode) lastServerCheck = currentTime;
|
||||
if (Config.digi.backupDigiMode) lastServerCheck = currentTime;
|
||||
} else {
|
||||
if (Config.aprs_is.messagesToRF && packet.indexOf("::") > 0) {
|
||||
String Sender = packet.substring(0, packet.indexOf(">"));
|
||||
|
||||
@@ -90,6 +90,7 @@ bool Configuration::writeFile() {
|
||||
#if defined(HAS_A7670)
|
||||
if (digi.ecoMode == 1) data["digi"]["ecoMode"] = 2;
|
||||
#endif
|
||||
data["digi"]["backupDigiMode"] = digi.backupDigiMode;
|
||||
|
||||
data["lora"]["rxActive"] = loramodule.rxActive;
|
||||
data["lora"]["rxFreq"] = loramodule.rxFreq;
|
||||
@@ -177,8 +178,6 @@ bool Configuration::writeFile() {
|
||||
|
||||
data["other"]["rememberStationTime"] = rememberStationTime;
|
||||
|
||||
data["other"]["backupDigiMode"] = backupDigiMode;
|
||||
|
||||
serializeJson(data, configFile);
|
||||
configFile.close();
|
||||
return true;
|
||||
@@ -275,13 +274,16 @@ bool Configuration::readFile() {
|
||||
blacklist = data["blacklist"] | "station callsign";
|
||||
|
||||
if (!data["digi"].containsKey("mode") ||
|
||||
!data["digi"].containsKey("ecoMode")) needsRewrite = true;
|
||||
!data["digi"].containsKey("ecoMode") ||
|
||||
!data["digi"].containsKey("backupDigiMode")) needsRewrite = true;
|
||||
digi.mode = data["digi"]["mode"] | 0;
|
||||
digi.ecoMode = data["digi"]["ecoMode"] | 0;
|
||||
if (digi.ecoMode == 1) shouldSleepStop = false;
|
||||
#if defined(HAS_A7670)
|
||||
if (digi.ecoMode == 1) digi.ecoMode = 2;
|
||||
#endif
|
||||
digi.backupDigiMode = data["digi"]["backupDigiMode"] | false;
|
||||
|
||||
|
||||
if (!data["lora"].containsKey("rxActive") ||
|
||||
!data["lora"].containsKey("rxFreq") ||
|
||||
@@ -410,9 +412,6 @@ bool Configuration::readFile() {
|
||||
if (!data["other"].containsKey("rememberStationTime")) needsRewrite = true;
|
||||
rememberStationTime = data["other"]["rememberStationTime"] | 30;
|
||||
|
||||
if (!data["other"].containsKey("backupDigiMode")) needsRewrite = true;
|
||||
backupDigiMode = data["other"]["backupDigiMode"] | false;
|
||||
|
||||
if (wifiAPs.size() == 0) { // If we don't have any WiFi's from config we need to add "empty" SSID for AUTO AP
|
||||
WiFi_AP wifiap;
|
||||
wifiap.ssid = "";
|
||||
@@ -484,6 +483,7 @@ void Configuration::setDefaultValues() {
|
||||
|
||||
digi.mode = 0;
|
||||
digi.ecoMode = 0;
|
||||
digi.backupDigiMode = false;
|
||||
|
||||
loramodule.rxActive = true;
|
||||
loramodule.rxFreq = 433775000;
|
||||
@@ -555,8 +555,6 @@ void Configuration::setDefaultValues() {
|
||||
|
||||
rememberStationTime = 30;
|
||||
|
||||
backupDigiMode = false;
|
||||
|
||||
Serial.println("New Data Created... All is Written!");
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ extern String fourthLine;
|
||||
extern String fifthLine;
|
||||
extern String sixthLine;
|
||||
extern String seventhLine;
|
||||
extern bool backUpDigiMode;
|
||||
extern bool backupDigiMode;
|
||||
|
||||
|
||||
namespace DIGI_Utils {
|
||||
@@ -101,7 +101,7 @@ namespace DIGI_Utils {
|
||||
}
|
||||
if (temp.indexOf(",") > 2) { // checks for path
|
||||
const String& path = temp.substring(temp.indexOf(",") + 1); // after tocall
|
||||
if (Config.digi.mode == 2 || backUpDigiMode) {
|
||||
if (Config.digi.mode == 2 || backupDigiMode) {
|
||||
if (path.indexOf("WIDE1-1") != - 1) {
|
||||
return buildPacket(path, packet, thirdParty, false);
|
||||
} else if (path.indexOf("WIDE1-1") == -1 && (abs(Config.loramodule.txFreq - Config.loramodule.rxFreq) >= 125000)) { // CrossFreq Digi
|
||||
@@ -127,7 +127,7 @@ namespace DIGI_Utils {
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else if (temp.indexOf(",") == -1 && (Config.digi.mode == 2 || backUpDigiMode || Config.digi.mode == 3) && (abs(Config.loramodule.txFreq - Config.loramodule.rxFreq) >= 125000)) {
|
||||
} else if (temp.indexOf(",") == -1 && (Config.digi.mode == 2 || backupDigiMode || Config.digi.mode == 3) && (abs(Config.loramodule.txFreq - Config.loramodule.rxFreq) >= 125000)) {
|
||||
return buildPacket("", packet, thirdParty, true);
|
||||
} else {
|
||||
return "";
|
||||
|
||||
@@ -56,12 +56,12 @@ namespace GPS_Utils {
|
||||
Config.aprs_is.objectsToRF = false;
|
||||
Config.beacon.sendViaRF = false;
|
||||
Config.digi.mode = 0;
|
||||
Config.backupDigiMode = false;
|
||||
Config.digi.backupDigiMode = false;
|
||||
} else if (callsignIsValid && Config.tacticalCallsign != "") {
|
||||
beaconPacket = APRSPacketLib::generateBasePacket(Config.tacticalCallsign, "APLRG1", Config.beacon.path);
|
||||
Config.aprs_is.active = false;
|
||||
Config.beacon.sendViaAPRSIS = false;
|
||||
Config.backupDigiMode = false;
|
||||
Config.digi.backupDigiMode = false;
|
||||
}
|
||||
} else {
|
||||
Config.beacon.sendViaAPRSIS = false;
|
||||
|
||||
@@ -81,9 +81,7 @@ namespace LoRa_Utils {
|
||||
radio.XTAL = true;
|
||||
#endif
|
||||
int state = radio.begin(freq);
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
Utils::println("Initializing LoRa Module");
|
||||
} else {
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
Utils::println("Starting LoRa failed! State: " + String(state));
|
||||
while (true);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ extern int freqError;
|
||||
extern String distance;
|
||||
extern bool WiFiConnected;
|
||||
extern int wxModuleType;
|
||||
extern bool backUpDigiMode;
|
||||
extern bool backupDigiMode;
|
||||
extern bool shouldSleepLowVoltage;
|
||||
extern bool transmitFlag;
|
||||
extern bool passcodeValid;
|
||||
@@ -96,7 +96,7 @@ namespace Utils {
|
||||
return "** WiFi AP Killed **";
|
||||
} else if (!WiFiConnected) {
|
||||
return "IP : 192.168.4.1";
|
||||
} else if (backUpDigiMode) {
|
||||
} else if (backupDigiMode) {
|
||||
return "- BACKUP DIGI MODE -";
|
||||
} else {
|
||||
return "IP : " + String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(WiFi.localIP()[3]);
|
||||
@@ -259,7 +259,7 @@ namespace Utils {
|
||||
secondaryBeaconPacket += encodedTelemetry;
|
||||
}
|
||||
|
||||
if (Config.beacon.sendViaAPRSIS && Config.aprs_is.active && passcodeValid && !backUpDigiMode) {
|
||||
if (Config.beacon.sendViaAPRSIS && Config.aprs_is.active && passcodeValid && !backupDigiMode) {
|
||||
Utils::println("-- Sending Beacon to APRSIS --");
|
||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING IGATE BEACON", 0);
|
||||
seventhLine = " listening...";
|
||||
@@ -271,7 +271,7 @@ namespace Utils {
|
||||
if (Config.syslog.logBeaconOverTCPIP) SYSLOG_Utils::log(1, "tcp" + beaconPacket, 0, 0.0, 0); // APRSIS TX
|
||||
}
|
||||
|
||||
if (Config.beacon.sendViaRF || backUpDigiMode) {
|
||||
if (Config.beacon.sendViaRF || backupDigiMode) {
|
||||
Utils::println("-- Sending Beacon to RF --");
|
||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING DIGI BEACON", 0);
|
||||
seventhLine = " listening...";
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace WEB_Utils {
|
||||
|
||||
Config.digi.mode = getParamIntSafe("digi.mode", Config.digi.mode);
|
||||
Config.digi.ecoMode = getParamIntSafe("digi.ecoMode", Config.digi.ecoMode);
|
||||
|
||||
Config.digi.backupDigiMode = request->hasParam("digi.backupDigiMode", true);
|
||||
|
||||
Config.loramodule.rxActive = request->hasParam("lora.rxActive", true);
|
||||
Config.loramodule.rxFreq = getParamIntSafe("lora.rxFreq", Config.loramodule.rxFreq);
|
||||
@@ -214,14 +214,12 @@ namespace WEB_Utils {
|
||||
Config.loramodule.txSignalBandwidth = getParamIntSafe("lora.txSignalBandwidth", Config.loramodule.txSignalBandwidth);
|
||||
Config.loramodule.power = getParamIntSafe("lora.power", Config.loramodule.power);
|
||||
|
||||
|
||||
Config.display.alwaysOn = request->hasParam("display.alwaysOn", true);
|
||||
if (!Config.display.alwaysOn) {
|
||||
Config.display.timeout = getParamIntSafe("display.timeout", Config.display.timeout);
|
||||
}
|
||||
Config.display.turn180 = request->hasParam("display.turn180", true);
|
||||
|
||||
|
||||
Config.battery.sendInternalVoltage = request->hasParam("battery.sendInternalVoltage", true);
|
||||
Config.battery.monitorInternalVoltage = request->hasParam("battery.monitorInternalVoltage", true);
|
||||
if (Config.battery.monitorInternalVoltage) {
|
||||
@@ -243,7 +241,6 @@ namespace WEB_Utils {
|
||||
}
|
||||
Config.battery.sendVoltageAsTelemetry = request->hasParam("battery.sendVoltageAsTelemetry", true);
|
||||
|
||||
|
||||
Config.wxsensor.active = request->hasParam("wxsensor.active", true);
|
||||
if (Config.wxsensor.active) {
|
||||
Config.wxsensor.heightCorrection = getParamIntSafe("wxsensor.heightCorrection", Config.wxsensor.heightCorrection);
|
||||
@@ -251,7 +248,6 @@ namespace WEB_Utils {
|
||||
Config.beacon.symbol = "_";
|
||||
}
|
||||
|
||||
|
||||
Config.syslog.active = request->hasParam("syslog.active", true);
|
||||
if (Config.syslog.active) {
|
||||
Config.syslog.server = getParamStringSafe("syslog.server", Config.syslog.server);
|
||||
@@ -259,13 +255,11 @@ namespace WEB_Utils {
|
||||
Config.syslog.logBeaconOverTCPIP = request->hasParam("syslog.logBeaconOverTCPIP", true);
|
||||
}
|
||||
|
||||
|
||||
Config.tnc.enableServer = request->hasParam("tnc.enableServer", true);
|
||||
Config.tnc.enableSerial = request->hasParam("tnc.enableSerial", true);
|
||||
Config.tnc.acceptOwn = request->hasParam("tnc.acceptOwn", true);
|
||||
Config.tnc.aprsBridgeActive = request->hasParam("tnc.aprsBridgeActive", true);
|
||||
|
||||
|
||||
Config.mqtt.active = request->hasParam("mqtt.active", true);
|
||||
if (Config.mqtt.active) {
|
||||
Config.mqtt.server = getParamStringSafe("mqtt.server", Config.mqtt.server);
|
||||
@@ -276,7 +270,6 @@ namespace WEB_Utils {
|
||||
Config.mqtt.beaconOverMqtt = request->hasParam("mqtt.beaconOverMqtt", true);
|
||||
}
|
||||
|
||||
|
||||
Config.rebootMode = request->hasParam("other.rebootMode", true);
|
||||
if (Config.rebootMode) {
|
||||
Config.rebootModeTime = getParamIntSafe("other.rebootModeTime", Config.rebootModeTime);
|
||||
@@ -299,8 +292,6 @@ namespace WEB_Utils {
|
||||
|
||||
Config.rememberStationTime = getParamIntSafe("other.rememberStationTime", Config.rememberStationTime);
|
||||
|
||||
Config.backupDigiMode = request->hasParam("other.backupDigiMode", true);
|
||||
|
||||
bool saveSuccess = Config.writeFile();
|
||||
|
||||
if (saveSuccess) {
|
||||
|
||||
@@ -29,7 +29,7 @@ extern Configuration Config;
|
||||
extern uint8_t myWiFiAPIndex;
|
||||
extern int myWiFiAPSize;
|
||||
extern WiFi_AP *currentWiFi;
|
||||
extern bool backUpDigiMode;
|
||||
extern bool backupDigiMode;
|
||||
extern uint32_t lastServerCheck;
|
||||
|
||||
bool WiFiConnected = false;
|
||||
@@ -46,24 +46,24 @@ namespace WIFI_Utils {
|
||||
if (Config.digi.ecoMode != 0) return;
|
||||
uint32_t currentTime = millis();
|
||||
|
||||
if (backUpDigiMode) {
|
||||
if (backupDigiMode) {
|
||||
if (WiFi.status() != WL_CONNECTED && ((currentTime - lastBackupDigiTime) >= 15 * 60 * 1000)) {
|
||||
Serial.println("*** Stopping BackUp Digi Mode ***");
|
||||
backUpDigiMode = false;
|
||||
backupDigiMode = false;
|
||||
wifiCounter = 0;
|
||||
} else if (WiFi.status() == WL_CONNECTED) {
|
||||
Serial.println("*** WiFi Reconnect Success (Stopping Backup Digi Mode) ***");
|
||||
backUpDigiMode = false;
|
||||
backupDigiMode = false;
|
||||
wifiCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!backUpDigiMode && ((currentTime - lastWiFiCheck) >= 30 * 1000) && !WiFiAutoAPStarted) {
|
||||
if (!backupDigiMode && ((currentTime - lastWiFiCheck) >= 30 * 1000) && !WiFiAutoAPStarted) {
|
||||
lastWiFiCheck = currentTime;
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
if (Config.backupDigiMode && (currentTime - lastServerCheck > 60 * 1000)) {
|
||||
if (Config.digi.backupDigiMode && (currentTime - lastServerCheck > 60 * 1000)) {
|
||||
Serial.println("*** Server Connection LOST → Backup Digi Mode ***");
|
||||
backUpDigiMode = true;
|
||||
backupDigiMode = true;
|
||||
WiFi.disconnect();
|
||||
lastBackupDigiTime = currentTime;
|
||||
}
|
||||
@@ -72,10 +72,10 @@ namespace WIFI_Utils {
|
||||
WiFi.disconnect();
|
||||
WIFI_Utils::startWiFi();
|
||||
|
||||
if (Config.backupDigiMode) wifiCounter++;
|
||||
if (Config.digi.backupDigiMode) wifiCounter++;
|
||||
if (wifiCounter >= 2) {
|
||||
Serial.println("*** Starting BackUp Digi Mode ***");
|
||||
backUpDigiMode = true;
|
||||
backupDigiMode = true;
|
||||
lastBackupDigiTime = currentTime;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user