mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-04-20 22:05:11 +00:00
Reboot Mode Added
This commit is contained in:
parent
960df01d61
commit
51f9e0f0cc
9 changed files with 160 additions and 58 deletions
|
|
@ -72,6 +72,8 @@
|
|||
"externalVoltagePin": 34,
|
||||
"lowPowerMode": false,
|
||||
"lowVoltageCutOff": 0,
|
||||
"backupDigiMode": false
|
||||
"backupDigiMode": false,
|
||||
"rebootMode": false,
|
||||
"rebootModeTime": 0
|
||||
}
|
||||
}
|
||||
|
|
@ -617,6 +617,70 @@
|
|||
</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-broadcast-pin"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM6 8a2 2 0 1 1 2.5 1.937V15.5a.5.5 0 0 1-1 0V9.937A2 2 0 0 1 6 8"
|
||||
/>
|
||||
</svg>
|
||||
Reboot Time
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-9 mt-2">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="other.rebootMode"
|
||||
id="other.rebootMode"
|
||||
class="form-check-input"
|
||||
/>
|
||||
<label
|
||||
for="other.rebootMode"
|
||||
class="form-label"
|
||||
>Reboot Mode Active</label
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-6">
|
||||
<label
|
||||
for="other.rebootModeTime"
|
||||
class="form-label"
|
||||
>Time before forced Reboot</label
|
||||
>
|
||||
<div class="input-group">
|
||||
<input
|
||||
type="number"
|
||||
name="other.rebootModeTime"
|
||||
id="other.rebootModeTime"
|
||||
placeholder="0"
|
||||
class="form-control"
|
||||
step="6"
|
||||
min="0"
|
||||
max="168"
|
||||
/>
|
||||
<span class="input-group-text"
|
||||
>hours</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<div class="row my-5 d-flex align-items-top">
|
||||
<div class="col-lg-3 col-sm-12">
|
||||
<h5>
|
||||
|
|
@ -1399,6 +1463,9 @@
|
|||
step="0.01"
|
||||
class="form-control"
|
||||
/>
|
||||
<span class="input-group-text"
|
||||
>Volts</span
|
||||
>
|
||||
<div class="form-text">
|
||||
MCU will deep sleep when below provided battery voltage to save power. Set to <strong>0</strong> if you don't want this option. <u>Please calibrate your voltage reading first!</u>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -167,10 +167,8 @@ function loadSettings(settings) {
|
|||
document.getElementById("other.sendBatteryVoltage").checked = settings.other.sendBatteryVoltage;
|
||||
document.getElementById("other.externalVoltageMeasurement").checked = settings.other.externalVoltageMeasurement;
|
||||
document.getElementById("other.externalVoltagePin").value = settings.other.externalVoltagePin;
|
||||
// document.getElementById("beacon.igateSendsLoRaBeacon").value =
|
||||
// settings.beacon.igateSendsLoRaBeacon;
|
||||
// document.getElementById("beacon.igateRepeatLoRaPackets").value =
|
||||
// settings.beacon.igateRepeatLoRaPackets;
|
||||
// document.getElementById("beacon.igateSendsLoRaBeacon").value = settings.beacon.igateSendsLoRaBeacon;
|
||||
// document.getElementById("beacon.igateRepeatLoRaPackets").value = settings.beacon.igateRepeatLoRaPackets;
|
||||
document.getElementById("beacon.path").value = settings.beacon.path;
|
||||
document.getElementById("beacon.latitude").value = settings.beacon.latitude;
|
||||
document.getElementById("beacon.longitude").value = settings.beacon.longitude;
|
||||
|
|
@ -188,11 +186,9 @@ function loadSettings(settings) {
|
|||
}
|
||||
|
||||
// LoRa
|
||||
// document.getElementById("lora.digirepeaterTxFreq").value =
|
||||
// settings.lora.digirepeaterTxFreq;
|
||||
// document.getElementById("lora.digirepeaterTxFreq").value = settings.lora.digirepeaterTxFreq;
|
||||
// document.getElementById("lora.iGateFreq").value = settings.lora.iGateFreq;
|
||||
// document.getElementById("lora.digirepeaterRxFreq").value =
|
||||
// settings.lora.digirepeaterRxFreq;
|
||||
// document.getElementById("lora.digirepeaterRxFreq").value = settings.lora.digirepeaterRxFreq;
|
||||
document.getElementById("lora.txFreq").value = settings.lora.txFreq;
|
||||
document.getElementById("lora.rxFreq").value = settings.lora.rxFreq;
|
||||
document.getElementById("lora.txActive").checked = settings.lora.txActive;
|
||||
|
|
@ -202,6 +198,10 @@ function loadSettings(settings) {
|
|||
document.getElementById("lora.codingRate4").value = settings.lora.codingRate4;
|
||||
document.getElementById("lora.power").value = settings.lora.power;
|
||||
|
||||
// Reboot
|
||||
document.getElementById("other.rebootMode").checked = settings.other.rebootMode;
|
||||
document.getElementById("other.rebootModeTime").value = settings.other.rebootModeTime;
|
||||
|
||||
// Experimental
|
||||
document.getElementById("other.backupDigiMode").checked = settings.other.backupDigiMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ void setup() {
|
|||
#ifdef ESP32_DIY_LoRa_A7670
|
||||
A7670_Utils::setup();
|
||||
#endif
|
||||
Utils::checkRebootMode();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
|
@ -181,4 +182,5 @@ void loop() {
|
|||
STATION_Utils::clean25SegBuffer();
|
||||
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
Utils::checkRebootTime();
|
||||
}
|
||||
|
|
@ -29,83 +29,86 @@ void Configuration::writeFile() {
|
|||
}
|
||||
}
|
||||
|
||||
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
||||
data["wifi"]["autoAP"]["powerOff"] = wifiAutoAP.powerOff;
|
||||
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
||||
data["wifi"]["autoAP"]["powerOff"] = wifiAutoAP.powerOff;
|
||||
|
||||
data["callsign"] = callsign;
|
||||
data["callsign"] = callsign;
|
||||
// data["stationMode"] = stationMode; // only check for config version
|
||||
// data["iGateComment"] = iGateComment;
|
||||
|
||||
// data["other"]["beaconInterval"] = beaconInterval;
|
||||
// data["other"]["igateSendsLoRaBeacons"] = igateSendsLoRaBeacons;
|
||||
// data["other"]["igateRepeatsLoRaPackets"] = igateRepeatsLoRaPackets;
|
||||
data["other"]["rememberStationTime"] = rememberStationTime;
|
||||
data["other"]["sendBatteryVoltage"] = sendBatteryVoltage;
|
||||
data["other"]["rememberStationTime"] = rememberStationTime;
|
||||
data["other"]["sendBatteryVoltage"] = sendBatteryVoltage;
|
||||
data["other"]["externalVoltageMeasurement"] = externalVoltageMeasurement;
|
||||
data["other"]["externalVoltagePin"] = externalVoltagePin;
|
||||
data["other"]["externalVoltagePin"] = externalVoltagePin;
|
||||
|
||||
data["digi"]["mode"] = digi.mode;
|
||||
data["digi"]["mode"] = digi.mode;
|
||||
// data["digi"]["comment"] = digi.comment;
|
||||
// data["digi"]["latitude"] = digi.latitude;
|
||||
// data["digi"]["longitude"] = digi.longitude;
|
||||
|
||||
data["tnc"]["enableServer"] = tnc.enableServer;
|
||||
data["tnc"]["enableSerial"] = tnc.enableSerial;
|
||||
data["tnc"]["acceptOwn"] = tnc.acceptOwn;
|
||||
data["tnc"]["enableServer"] = tnc.enableServer;
|
||||
data["tnc"]["enableSerial"] = tnc.enableSerial;
|
||||
data["tnc"]["acceptOwn"] = tnc.acceptOwn;
|
||||
|
||||
data["aprs_is"]["active"] = aprs_is.active;
|
||||
data["aprs_is"]["passcode"] = aprs_is.passcode;
|
||||
data["aprs_is"]["server"] = aprs_is.server;
|
||||
data["aprs_is"]["port"] = aprs_is.port;
|
||||
data["aprs_is"]["filter"] = aprs_is.filter;
|
||||
data["aprs_is"]["active"] = aprs_is.active;
|
||||
data["aprs_is"]["passcode"] = aprs_is.passcode;
|
||||
data["aprs_is"]["server"] = aprs_is.server;
|
||||
data["aprs_is"]["port"] = aprs_is.port;
|
||||
data["aprs_is"]["filter"] = aprs_is.filter;
|
||||
//data["aprs_is"]["toRF"] = aprs_is.toRF;
|
||||
data["aprs_is"]["messagesToRF"] = aprs_is.messagesToRF;
|
||||
data["aprs_is"]["objectsToRF"] = aprs_is.objectsToRF;
|
||||
data["aprs_is"]["messagesToRF"] = aprs_is.messagesToRF;
|
||||
data["aprs_is"]["objectsToRF"] = aprs_is.objectsToRF;
|
||||
|
||||
|
||||
data["beacon"]["comment"] = beacon.comment;
|
||||
data["beacon"]["comment"] = beacon.comment;
|
||||
// data["beacon"]["igateRepeatsLoRaPackets"] = beacon.igateRepeatsLoRaPackets;
|
||||
// data["beacon"]["igateSendsLoRaBeacons"] = beacon.igateSendsLoRaBeacons;
|
||||
data["beacon"]["interval"] = beacon.interval;
|
||||
data["beacon"]["latitude"] = beacon.latitude;
|
||||
data["beacon"]["longitude"] = beacon.longitude;
|
||||
data["beacon"]["overlay"] = beacon.overlay;
|
||||
data["beacon"]["symbol"] = beacon.symbol;
|
||||
data["beacon"]["sendViaAPRSIS"] = beacon.sendViaAPRSIS;
|
||||
data["beacon"]["sendViaRF"] = beacon.sendViaRF;
|
||||
data["beacon"]["path"] = beacon.path;
|
||||
data["beacon"]["interval"] = beacon.interval;
|
||||
data["beacon"]["latitude"] = beacon.latitude;
|
||||
data["beacon"]["longitude"] = beacon.longitude;
|
||||
data["beacon"]["overlay"] = beacon.overlay;
|
||||
data["beacon"]["symbol"] = beacon.symbol;
|
||||
data["beacon"]["sendViaAPRSIS"] = beacon.sendViaAPRSIS;
|
||||
data["beacon"]["sendViaRF"] = beacon.sendViaRF;
|
||||
data["beacon"]["path"] = beacon.path;
|
||||
|
||||
// data["lora"]["iGateFreq"] = loramodule.iGateFreq;
|
||||
// data["lora"]["digirepeaterTxFreq"] = loramodule.digirepeaterTxFreq;
|
||||
// data["lora"]["digirepeaterRxFreq"] = loramodule.digirepeaterRxFreq;
|
||||
data["lora"]["rxFreq"] = loramodule.rxFreq;
|
||||
data["lora"]["txFreq"] = loramodule.txFreq;
|
||||
data["lora"]["spreadingFactor"] = loramodule.spreadingFactor;
|
||||
data["lora"]["signalBandwidth"] = loramodule.signalBandwidth;
|
||||
data["lora"]["codingRate4"] = loramodule.codingRate4;
|
||||
data["lora"]["power"] = loramodule.power;
|
||||
data["lora"]["txActive"] = loramodule.txActive;
|
||||
data["lora"]["rxActive"] = loramodule.rxActive;
|
||||
data["lora"]["rxFreq"] = loramodule.rxFreq;
|
||||
data["lora"]["txFreq"] = loramodule.txFreq;
|
||||
data["lora"]["spreadingFactor"] = loramodule.spreadingFactor;
|
||||
data["lora"]["signalBandwidth"] = loramodule.signalBandwidth;
|
||||
data["lora"]["codingRate4"] = loramodule.codingRate4;
|
||||
data["lora"]["power"] = loramodule.power;
|
||||
data["lora"]["txActive"] = loramodule.txActive;
|
||||
data["lora"]["rxActive"] = loramodule.rxActive;
|
||||
|
||||
data["display"]["alwaysOn"] = display.alwaysOn;
|
||||
data["display"]["timeout"] = display.timeout;
|
||||
data["display"]["turn180"] = display.turn180;
|
||||
data["display"]["alwaysOn"] = display.alwaysOn;
|
||||
data["display"]["timeout"] = display.timeout;
|
||||
data["display"]["turn180"] = display.turn180;
|
||||
|
||||
data["syslog"]["active"] = syslog.active;
|
||||
data["syslog"]["server"] = syslog.server;
|
||||
data["syslog"]["port"] = syslog.port;
|
||||
data["syslog"]["active"] = syslog.active;
|
||||
data["syslog"]["server"] = syslog.server;
|
||||
data["syslog"]["port"] = syslog.port;
|
||||
|
||||
data["bme"]["active"] = bme.active;
|
||||
data["bme"]["heightCorrection"] = bme.heightCorrection;
|
||||
data["bme"]["temperatureCorrection"] = bme.temperatureCorrection;
|
||||
data["bme"]["active"] = bme.active;
|
||||
data["bme"]["heightCorrection"] = bme.heightCorrection;
|
||||
data["bme"]["temperatureCorrection"] = bme.temperatureCorrection;
|
||||
|
||||
data["ota"]["username"] = ota.username;
|
||||
data["ota"]["password"] = ota.password;
|
||||
data["ota"]["username"] = ota.username;
|
||||
data["ota"]["password"] = ota.password;
|
||||
|
||||
data["other"]["lowPowerMode"] = lowPowerMode;
|
||||
data["other"]["lowVoltageCutOff"] = lowVoltageCutOff;
|
||||
data["other"]["lowPowerMode"] = lowPowerMode;
|
||||
data["other"]["lowVoltageCutOff"] = lowVoltageCutOff;
|
||||
|
||||
data["other"]["backupDigiMode"] = backupDigiMode;
|
||||
data["other"]["backupDigiMode"] = backupDigiMode;
|
||||
|
||||
data["other"]["rebootMode"] = rebootMode;
|
||||
data["other"]["rebootModeTime"] = rebootModeTime;
|
||||
|
||||
serializeJson(data, configFile);
|
||||
|
||||
|
|
@ -178,7 +181,10 @@ bool Configuration::readFile() {
|
|||
|
||||
backupDigiMode = data["other"]["backupDigiMode"].as<bool>();
|
||||
|
||||
int stationMode = data["stationMode"].as<int>(); // deprecated but need to specify config version
|
||||
rebootMode = data["other"]["rebootMode"].as<bool>();
|
||||
rebootModeTime = data["other"]["rebootModeTime"].as<int>();
|
||||
|
||||
int stationMode = data["stationMode"].as<int>(); // deprecated but need to specify config version
|
||||
|
||||
if (stationMode == 0) {
|
||||
// Load new settings
|
||||
|
|
@ -360,6 +366,9 @@ void Configuration::init() {
|
|||
|
||||
backupDigiMode = false;
|
||||
|
||||
rebootMode = false;
|
||||
rebootModeTime = 0;
|
||||
|
||||
Serial.println("All is Written!");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ public:
|
|||
bool lowPowerMode;
|
||||
double lowVoltageCutOff;
|
||||
bool backupDigiMode;
|
||||
bool rebootMode;
|
||||
int rebootModeTime;
|
||||
std::vector<WiFi_AP> wifiAPs;
|
||||
WiFi_Auto_AP wifiAutoAP;
|
||||
Beacon beacon; // new
|
||||
|
|
|
|||
|
|
@ -262,4 +262,19 @@ namespace Utils {
|
|||
}
|
||||
}
|
||||
|
||||
void checkRebootMode() {
|
||||
if (Config.rebootMode && Config.rebootModeTime > 0) {
|
||||
Serial.println("(Reboot Time Set to " + String(Config.rebootModeTime) + " hours)");
|
||||
}
|
||||
}
|
||||
|
||||
void checkRebootTime() {
|
||||
if (Config.rebootMode && Config.rebootModeTime > 0) {
|
||||
if (millis() > Config.rebootModeTime * 60 * 60 * 1000) {
|
||||
Serial.println("\n*** Automatic Reboot Time Restart! ****\n");
|
||||
ESP.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -24,6 +24,8 @@ namespace Utils {
|
|||
void typeOfPacket(const String& packet, uint8_t packetType);
|
||||
void print(const String& text);
|
||||
void println(const String& text);
|
||||
void checkRebootMode();
|
||||
void checkRebootTime();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,6 +179,9 @@ namespace WEB_Utils {
|
|||
Config.externalVoltagePin = request->getParam("other.externalVoltagePin", true)->value().toInt();
|
||||
}
|
||||
|
||||
Config.rebootMode = request->hasParam("other.rebootMode", true);
|
||||
Config.rebootModeTime = request->getParam("other.rebootModeTime", true)->value().toInt();
|
||||
|
||||
Config.lowPowerMode = request->hasParam("other.lowPowerMode", true);
|
||||
Config.lowVoltageCutOff = request->getParam("other.lowVoltageCutOff", true)->value().toDouble();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue