diff --git a/data/igate_conf.json b/data/igate_conf.json index a6409c5..2977c1e 100644 --- a/data/igate_conf.json +++ b/data/igate_conf.json @@ -48,11 +48,11 @@ "battery": { "sendInternalVoltage": false, "monitorInternalVoltage": false, - "internalSleepVoltage": 0.0, + "internalSleepVoltage": 3.0, "sendExternalVoltage": false, "externalVoltagePin": 34, "monitorExternalVoltage": false, - "externalSleepVoltage": 0.0 + "externalSleepVoltage": 3.0 }, "bme": { "active": false, diff --git a/data_embed/index.html b/data_embed/index.html index 2d8ffcb..e24072b 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -928,7 +928,7 @@ Battery Monitor & Health
-
+
Send Internal Voltage
-
+
Send External Voltage
+
+ + +
+
+ +
+ + volts +
+
-
- - +
+
+ + +
+
+ + +
+
+ +
+ + volts +
+
@@ -1273,7 +1339,7 @@ placeholder="0" class="form-control" step="6" - min="0" + min="6" max="168" /> (); rememberStationTime = data["other"]["rememberStationTime"].as(); - battery.sendInternalVoltage = data["battery"]["sendInternalVoltage"].as(); - battery.sendExternalVoltage = data["battery"]["sendExternalVoltage"].as(); - battery.externalVoltagePin = data["battery"]["externalVoltagePin"].as(); + battery.sendInternalVoltage = data["battery"]["sendInternalVoltage"].as(); + battery.monitorInternalVoltage = data["battery"]["monitorInternalVoltage"].as(); + battery.internalSleepVoltage = data["battery"]["internalSleepVoltage"].as(); + + battery.sendExternalVoltage = data["battery"]["sendExternalVoltage"].as(); + battery.externalVoltagePin = data["battery"]["externalVoltagePin"].as(); + battery.monitorExternalVoltage = data["battery"]["monitorExternalVoltage"].as(); + battery.externalSleepVoltage = data["battery"]["externalSleepVoltage"].as(); aprs_is.passcode = data["aprs_is"]["passcode"].as(); aprs_is.server = data["aprs_is"]["server"].as(); @@ -188,8 +190,6 @@ bool Configuration::readFile() { beacon.overlay = data["beacon"]["overlay"].as(); beacon.symbol = data["beacon"]["symbol"].as(); beacon.interval = data["beacon"]["interval"].as(); - // beacon.igateSendsLoRaBeacons = data["beacon"]["igateSendsLoRaBeacons"].as(); - // beacon.igateRepeatsLoRaPackets = data["beacon"]["igateRepeatsLoRaPackets"].as(); beacon.sendViaAPRSIS = data["beacon"]["sendViaAPRSIS"].as(); beacon.sendViaRF = data["beacon"]["sendViaRF"].as(); beacon.path = data["beacon"]["path"].as(); @@ -198,7 +198,6 @@ bool Configuration::readFile() { aprs_is.active = data["aprs_is"]["active"].as(); aprs_is.filter = data["aprs_is"]["filter"].as(); - //aprs_is.toRF = data["aprs_is"]["toRF"].as(); aprs_is.messagesToRF = data["aprs_is"]["messagesToRF"].as(); aprs_is.objectsToRF = data["aprs_is"]["objectsToRF"].as(); @@ -211,8 +210,6 @@ bool Configuration::readFile() { String iGateComment = data["iGateComment"].as(); int beaconInterval = data["other"]["beaconInterval"].as(); - // bool igateSendsLoRaBeacons = data["other"]["igateSendsLoRaBeacons"].as(); - // bool igateRepeatsLoRaPackets = data["other"]["igateRepeatsLoRaPackets"].as(); long iGateFreq = data["lora"]["iGateFreq"].as(); long digirepeaterTxFreq = data["lora"]["digirepeaterTxFreq"].as(); @@ -225,8 +222,7 @@ bool Configuration::readFile() { beacon.latitude = digiLatitude; beacon.longitude = digiLongitude; beacon.interval = beaconInterval; - // beacon.igateSendsLoRaBeacons = igateSendsLoRaBeacons; - // beacon.igateRepeatsLoRaPackets = igateRepeatsLoRaPackets; + loramodule.txFreq = digirepeaterTxFreq; loramodule.rxFreq = digirepeaterRxFreq; loramodule.rxActive = true; @@ -278,33 +274,25 @@ void Configuration::init() { WiFi_AP wifiap; wifiap.ssid = ""; wifiap.password = ""; - // wifiap.latitude = 0.0; // deprecated - // wifiap.longitude = 0.0; // deprecated + wifiAPs.push_back(wifiap); wifiAutoAP.password = "1234567890"; wifiAutoAP.powerOff = 15; callsign = "N0CALL"; - // stationMode = 1; // deprecated - // iGateComment = "LoRa_APRS_iGate Development"; // deprecated beacon.comment = "LoRa APRS"; // new beacon.latitude = 0.0; // new beacon.longitude = 0.0; // new beacon.interval = 15; // new - // beacon.igateRepeatsLoRaPackets = false; // new - // beacon.igateSendsLoRaBeacons = false; // new beacon.overlay = "L"; // new beacon.symbol = "#"; // new beacon.sendViaAPRSIS = true; // new beacon.sendViaRF = false; // new beacon.path = "WIDE1-1"; // new - digi.mode = 0; // new - // digi.comment = "LoRa_APRS_iGate Development"; // deprecated - // digi.latitude = 0.0; // deprecated - // digi.longitude = 0.0; // deprecated + digi.mode = 0; tnc.enableServer = false; tnc.enableSerial = false; @@ -315,13 +303,9 @@ void Configuration::init() { aprs_is.server = "rotate.aprs2.net"; aprs_is.port = 14580; aprs_is.filter = "m/10"; // new - //aprs_is.toRF = false; // new aprs_is.messagesToRF = false; aprs_is.objectsToRF = false; - // loramodule.iGateFreq = 433775000; // deprecated - // loramodule.digirepeaterTxFreq = 433775000; // deprecated - // loramodule.digirepeaterRxFreq = 433900000; // deprecated loramodule.txFreq = 433775000; // new loramodule.rxFreq = 433775000; // new loramodule.spreadingFactor = 12; @@ -348,10 +332,15 @@ void Configuration::init() { rememberStationTime = 30; - - battery.sendInternalVoltage = false; - battery.sendExternalVoltage = false; - battery.externalVoltagePin = 34; + + battery.sendInternalVoltage = false; + battery.monitorInternalVoltage = false; + battery.internalSleepVoltage = 3.0; + + battery.sendExternalVoltage = false; + battery.externalVoltagePin = 34; + battery.monitorExternalVoltage = false; + battery.externalSleepVoltage = 3.0; lowPowerMode = false; lowVoltageCutOff = 0; diff --git a/src/configuration.h b/src/configuration.h index c4ee337..b8c5037 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -69,8 +69,12 @@ public: class BATTERY { public: bool sendInternalVoltage; + bool monitorInternalVoltage; + float internalSleepVoltage; bool sendExternalVoltage; int externalVoltagePin; + bool monitorExternalVoltage; + float externalSleepVoltage; }; class BME { @@ -105,9 +109,6 @@ public: bool reload; // ? String callsign; int rememberStationTime; - /*bool sendBatteryVoltage; - bool externalVoltageMeasurement; - int externalVoltagePin;*/ bool lowPowerMode; double lowVoltageCutOff; bool backupDigiMode; diff --git a/src/web_utils.cpp b/src/web_utils.cpp index b7f33fb..71c2612 100644 --- a/src/web_utils.cpp +++ b/src/web_utils.cpp @@ -157,11 +157,22 @@ namespace WEB_Utils { Config.ota.password = request->getParam("ota.password", true)->value(); Config.rememberStationTime = request->getParam("other.rememberStationTime", true)->value().toInt(); + Config.battery.sendInternalVoltage = request->hasParam("battery.sendInternalVoltage", true); + Config.battery.monitorInternalVoltage = request->hasParam("battery.monitorInternalVoltage", true); + if (Config.battery.monitorInternalVoltage) { + Config.battery.internalSleepVoltage = request->getParam("battery.internalSleepVoltage", true)->value().toFloat(); + } + Config.battery.sendExternalVoltage = request->hasParam("battery.sendExternalVoltage", true); if (Config.battery.sendExternalVoltage) { Config.battery.externalVoltagePin = request->getParam("battery.externalVoltagePin", true)->value().toInt(); } + Config.battery.monitorExternalVoltage = request->hasParam("battery.monitorExternalVoltage", true); + if (Config.battery.monitorExternalVoltage) { + Config.battery.externalSleepVoltage = request->getParam("battery.externalSleepVoltage", true)->value().toFloat(); + } + Config.backupDigiMode = request->hasParam("other.backupDigiMode", true);