mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-04-20 22:05:11 +00:00
first test backupDigiMode
This commit is contained in:
parent
35fbd7a5dc
commit
5296b19ef2
8 changed files with 62 additions and 40 deletions
|
|
@ -71,6 +71,7 @@
|
|||
"externalVoltageMeasurement": false,
|
||||
"externalVoltagePin": 34,
|
||||
"lowPowerMode": false,
|
||||
"lowVoltageCutOff": 0
|
||||
"lowVoltageCutOff": 0,
|
||||
"backupDigiMode": false
|
||||
}
|
||||
}
|
||||
|
|
@ -1348,6 +1348,24 @@
|
|||
</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 Digirepeater 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 Digirepeater Mode</label
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="form-check form-switch">
|
||||
<div class="form-text">
|
||||
|
|
|
|||
|
|
@ -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<ReceivedPacket> receivedPackets;
|
||||
|
||||
bool backUpDigiMode = false;
|
||||
bool modemLoggedToAPRSIS = false;
|
||||
|
||||
std::vector<ReceivedPacket> receivedPackets;
|
||||
|
||||
String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine;
|
||||
|
||||
//#define STARTUP_DELAY 5 //min
|
||||
|
|
|
|||
|
|
@ -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<bool>();
|
||||
lowVoltageCutOff = data["other"]["lowVoltageCutOff"].as<double>();
|
||||
|
||||
backupDigiMode = data["other"]["backupDigiMode"].as<bool>();
|
||||
|
||||
int stationMode = data["stationMode"].as<int>(); // 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() {
|
||||
|
|
|
|||
|
|
@ -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<WiFi_AP> 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<WiFi_AP> 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();
|
||||
|
|
|
|||
|
|
@ -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<String> lastHeardStation;
|
||||
|
|
@ -39,6 +38,7 @@ extern bool backUpDigiMode;
|
|||
bool statusAfterBoot = true;
|
||||
bool beaconUpdate = true;
|
||||
uint32_t lastBeaconTx = 0;
|
||||
uint32_t lastScreenOn = millis();
|
||||
|
||||
|
||||
namespace Utils {
|
||||
|
|
|
|||
|
|
@ -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 = "_";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue