diff --git a/data/igate_conf.json b/data/igate_conf.json index 7519b6f..b56deb6 100644 --- a/data/igate_conf.json +++ b/data/igate_conf.json @@ -71,6 +71,7 @@ "externalVoltageMeasurement": false, "externalVoltagePin": 34, "lowPowerMode": false, - "lowVoltageCutOff": 0 + "lowVoltageCutOff": 0, + "backupDigiMode": false } } \ No newline at end of file diff --git a/data_embed/index.html b/data_embed/index.html index 64149bb..c803df6 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -1348,6 +1348,24 @@
+
+
+
+ When "only" iGate Mode loses WiFi, it will change into a Digirepeater Mode and after 15 min check if WiFi available and return to "only" iGate Mode. +
+ + +
+
diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 3b20479..78b429f 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -46,16 +46,13 @@ int myWiFiAPSize = Config.wifiAPs.size(); WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex]; bool isUpdatingOTA = false; -uint32_t lastScreenOn = millis(); - uint32_t lastBatteryCheck = 0; String batteryVoltage; - -std::vector receivedPackets; - bool backUpDigiMode = false; bool modemLoggedToAPRSIS = false; +std::vector receivedPackets; + String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine; //#define STARTUP_DELAY 5 //min diff --git a/src/configuration.cpp b/src/configuration.cpp index a42b3a3..45c23b7 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -105,6 +105,8 @@ void Configuration::writeFile() { data["other"]["lowPowerMode"] = lowPowerMode; data["other"]["lowVoltageCutOff"] = lowVoltageCutOff; + data["other"]["backupDigiMode"] = backupDigiMode; + serializeJson(data, configFile); configFile.close(); @@ -174,6 +176,8 @@ bool Configuration::readFile() { lowPowerMode = data["other"]["lowPowerMode"].as(); lowVoltageCutOff = data["other"]["lowVoltageCutOff"].as(); + backupDigiMode = data["other"]["backupDigiMode"].as(); + int stationMode = data["stationMode"].as(); // deprecated but need to specify config version if (stationMode == 0) { @@ -354,7 +358,9 @@ void Configuration::init() { lowPowerMode = false; lowVoltageCutOff = 0; - Serial.println("todo escrito"); + backupDigiMode = false; + + Serial.println("All is Written!"); } Configuration::Configuration() { diff --git a/src/configuration.h b/src/configuration.h index a8708a2..991e9e4 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -107,30 +107,31 @@ public: class Configuration { public: - bool reload; - String callsign; + bool reload; + String callsign; // int stationMode; // deprecated // String iGateComment; // deprecated // int beaconInterval; // deprecated // bool igateSendsLoRaBeacons; // deprecated // bool igateRepeatsLoRaPackets; // deprecated - int rememberStationTime; - bool sendBatteryVoltage; - bool externalVoltageMeasurement; - int externalVoltagePin; - bool lowPowerMode; - double lowVoltageCutOff; - std::vector wifiAPs; - WiFi_Auto_AP wifiAutoAP; - Beacon beacon; // new - DIGI digi; - TNC tnc; // new - APRS_IS aprs_is; - LoraModule loramodule; - Display display; - SYSLOG syslog; - BME bme; - OTA ota; + int rememberStationTime; + bool sendBatteryVoltage; + bool externalVoltageMeasurement; + int externalVoltagePin; + bool lowPowerMode; + double lowVoltageCutOff; + bool backupDigiMode; + std::vector wifiAPs; + WiFi_Auto_AP wifiAutoAP; + Beacon beacon; // new + DIGI digi; + TNC tnc; // new + APRS_IS aprs_is; + LoraModule loramodule; + Display display; + SYSLOG syslog; + BME bme; + OTA ota; void init(); void writeFile(); diff --git a/src/utils.cpp b/src/utils.cpp index 56d7422..4e643f3 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -22,7 +22,6 @@ extern String fourthLine; extern String fifthLine; extern String sixthLine; extern String seventhLine; -extern uint32_t lastScreenOn; extern String iGateBeaconPacket; extern String iGateLoRaBeaconPacket; extern std::vector lastHeardStation; @@ -39,6 +38,7 @@ extern bool backUpDigiMode; bool statusAfterBoot = true; bool beaconUpdate = true; uint32_t lastBeaconTx = 0; +uint32_t lastScreenOn = millis(); namespace Utils { diff --git a/src/web_utils.cpp b/src/web_utils.cpp index 2b1227d..b42651b 100644 --- a/src/web_utils.cpp +++ b/src/web_utils.cpp @@ -182,6 +182,8 @@ namespace WEB_Utils { Config.lowPowerMode = request->hasParam("other.lowPowerMode", true); Config.lowVoltageCutOff = request->getParam("other.lowVoltageCutOff", true)->value().toDouble(); + Config.backupDigiMode = request->hasParam("other.backupDigiMode", true); + if (Config.bme.active) { Config.beacon.symbol = "_"; } diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp index f6594b6..6423cc5 100644 --- a/src/wifi_utils.cpp +++ b/src/wifi_utils.cpp @@ -5,29 +5,26 @@ #include "display.h" #include "utils.h" -extern Configuration Config; +extern Configuration Config; -extern uint8_t myWiFiAPIndex; -extern int myWiFiAPSize; -extern WiFi_AP *currentWiFi; +extern uint8_t myWiFiAPIndex; +extern int myWiFiAPSize; +extern WiFi_AP *currentWiFi; +extern bool backUpDigiMode; bool WiFiConnected = false; uint32_t WiFiAutoAPTime = millis(); bool WiFiAutoAPStarted = false; uint32_t previousWiFiMillis = 0; +uint8_t wifiCounter = 0; +uint32_t lastBackupDigiTime = millis(); -// -uint8_t wifiCounter = 0; -bool backupDigiModeActive = true; -extern bool backUpDigiMode; -uint32_t lastWiFiCheckBackupDigiMode = millis(); -// namespace WIFI_Utils { void checkWiFi() { if (backUpDigiMode) { - uint32_t WiFiCheck = millis() - lastWiFiCheckBackupDigiMode; + uint32_t WiFiCheck = millis() - lastBackupDigiTime; if (WiFi.status() != WL_CONNECTED && WiFiCheck >= 15 * 60 * 1000) { Serial.println("*** Stoping BackUp Digi Mode ***"); backUpDigiMode = false; @@ -46,13 +43,13 @@ namespace WIFI_Utils { WiFi.reconnect(); previousWiFiMillis = millis(); - if (backupDigiModeActive) { + if (Config.backupDigiMode) { wifiCounter++; } if (wifiCounter >= 2) { Serial.println("*** Starting BackUp Digi Mode ***"); backUpDigiMode = true; - lastWiFiCheckBackupDigiMode = millis(); + lastBackupDigiTime = millis(); } } }