diff --git a/data/igate_conf.json b/data/igate_conf.json index b68a4ec8..10df54f3 100644 --- a/data/igate_conf.json +++ b/data/igate_conf.json @@ -13,7 +13,6 @@ "server": "rotate.aprs2.net", "port": 14580, "filter": "m/10", - "toRF": false, "messagesToRF": false, "objectsToRF": false }, diff --git a/data_embed/index.html b/data_embed/index.html index 6f1d4212..f9879586 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -524,52 +524,6 @@
-
-
-
- - -
-
- - -
-
-
- - -
-

@@ -954,6 +908,62 @@

+
+
+
+ + + + Battery +
+ Battery Telemetry & Health +
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+
diff --git a/data_embed/script.js b/data_embed/script.js index d3a285a4..905e2579 100644 --- a/data_embed/script.js +++ b/data_embed/script.js @@ -62,9 +62,9 @@ alwaysOnCheckbox.addEventListener("change", function () { // alwaysOnCheckbox.disabled = this.value !== ""; // }); -const logCheckbox = document.querySelector('input[name="syslog.active"]'); -const serverField = document.querySelector('input[name="syslog.server"]'); -const portField = document.querySelector('input[name="syslog.port"]'); +const logCheckbox = document.querySelector('input[name="syslog.active"]'); +const serverField = document.querySelector('input[name="syslog.server"]'); +const portField = document.querySelector('input[name="syslog.port"]'); logCheckbox.addEventListener("change", function () { serverField.disabled = !this.checked; @@ -75,12 +75,8 @@ function loadSettings(settings) { currentSettings = settings; // General document.getElementById("callsign").value = settings.callsign; - // document.getElementById("stationMode").value = settings.stationMode; - document.getElementById("bme.active").checked = settings.bme.active; - document.getElementById("bme.heightCorrection").value = settings.bme.heightCorrection; - document.getElementById("bme.temperatureCorrection").value = settings.bme.temperatureCorrection.toFixed(1); - document.getElementById("beacon.comment").value = settings.beacon.comment; + /*document.getElementById("beacon.comment").value = settings.beacon.comment; document.getElementById("beacon.symbol").value = settings.beacon.symbol; document.getElementById("beacon.overlay").value = settings.beacon.overlay; @@ -125,7 +121,6 @@ function loadSettings(settings) { document.getElementById("aprs_is.active").checked = settings.aprs_is.active; document.getElementById("aprs_is.messagesToRF").checked = settings.aprs_is.messagesToRF; document.getElementById("aprs_is.objectsToRF").checked = settings.aprs_is.objectsToRF; - //document.getElementById("aprs_is.toRF").checked = settings.aprs_is.toRF; document.getElementById("aprs_is.server").value = settings.aprs_is.server; document.getElementById("aprs_is.port").value = settings.aprs_is.port; document.getElementById("aprs_is.filter").value = settings.aprs_is.filter; @@ -145,30 +140,40 @@ function loadSettings(settings) { document.getElementById("wifi.autoAP.powerOff").value = settings.wifi.autoAP.powerOff; // Digi - // document.getElementById("digi.comment").value = settings.digi.comment; - // document.getElementById("digi.latitude").value = settings.digi.latitude; - // document.getElementById("digi.longitude").value = settings.digi.longitude; document.getElementById("digi.mode").value = settings.digi.mode; - // TNC - if (settings.tnc) { - document.getElementById("tnc.enableServer").checked = settings.tnc.enableServer; - document.getElementById("tnc.enableSerial").checked = settings.tnc.enableSerial; - document.getElementById("tnc.acceptOwn").checked = settings.tnc.acceptOwn; - } + // LoRa + document.getElementById("lora.txFreq").value = settings.lora.txFreq; + document.getElementById("lora.rxFreq").value = settings.lora.rxFreq; + document.getElementById("lora.txActive").checked = settings.lora.txActive; + document.getElementById("lora.rxActive").checked = settings.lora.rxActive; + document.getElementById("lora.spreadingFactor").value = settings.lora.spreadingFactor; + document.getElementById("lora.signalBandwidth").value = settings.lora.signalBandwidth; + document.getElementById("lora.codingRate4").value = settings.lora.codingRate4; + document.getElementById("lora.power").value = settings.lora.power; - // OTA - document.getElementById("ota.username").value = settings.ota.username; - document.getElementById("ota.password").value = settings.ota.password; + // Battery + document.getElementById("battery.sendInternalVoltage").checked = settings.battery.sendInternalVoltage; + document.getElementById("battery.sendExternalVoltage").checked = settings.battery.sendExternalVoltage; + document.getElementById("battery.externalVoltagePin").value = settings.battery.externalVoltagePin; + document.getElementById("battery.internalMonitor").checked = settings.battery.internalMonitor; + document.getElementById("battery.internalSleepVoltage").value = settings.battery.internalSleepVoltage; + document.getElementById("battery.externalMonitor").checked = settings.battery.externalMonitor; + document.getElementById("battery.externalSleepVoltage").value = settings.battery.externalSleepVoltage; + + // Telemetry BME - WX + document.getElementById("bme.active").checked = settings.bme.active; + document.getElementById("bme.heightCorrection").value = settings.bme.heightCorrection; + document.getElementById("bme.temperatureCorrection").value = settings.bme.temperatureCorrection.toFixed(1); // Beacon document.getElementById("beacon.interval").value = settings.beacon.interval; document.getElementById("other.rememberStationTime").value = settings.other.rememberStationTime; - document.getElementById("other.sendBatteryVoltage").checked = settings.other.sendBatteryVoltage; + + /*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("other.externalVoltagePin").value = settings.other.externalVoltagePin;*/ + document.getElementById("beacon.path").value = settings.beacon.path; document.getElementById("beacon.latitude").value = settings.beacon.latitude; document.getElementById("beacon.longitude").value = settings.beacon.longitude; @@ -185,18 +190,16 @@ function loadSettings(settings) { portField.disabled = false; } - // LoRa - // 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.txFreq").value = settings.lora.txFreq; - document.getElementById("lora.rxFreq").value = settings.lora.rxFreq; - document.getElementById("lora.txActive").checked = settings.lora.txActive; - document.getElementById("lora.rxActive").checked = settings.lora.rxActive; - document.getElementById("lora.spreadingFactor").value = settings.lora.spreadingFactor; - document.getElementById("lora.signalBandwidth").value = settings.lora.signalBandwidth; - document.getElementById("lora.codingRate4").value = settings.lora.codingRate4; - document.getElementById("lora.power").value = settings.lora.power; + // TNC + if (settings.tnc) { + document.getElementById("tnc.enableServer").checked = settings.tnc.enableServer; + document.getElementById("tnc.enableSerial").checked = settings.tnc.enableSerial; + document.getElementById("tnc.acceptOwn").checked = settings.tnc.acceptOwn; + } + + // OTA + document.getElementById("ota.username").value = settings.ota.username; + document.getElementById("ota.password").value = settings.ota.password; // Reboot document.getElementById("other.rebootMode").checked = settings.other.rebootMode; diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 9975c046..6a74ed2f 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -124,13 +124,72 @@ void setup() { Utils::checkRebootMode(); // - /*Serial.println(Config.battery.sendInternalVoltage); + /*Serial.println(Config.callsign); + Serial.println(Config.wifiAPs[0].ssid); + Serial.println(Config.wifiAPs[0].password); + Serial.println(" "); + Serial.println(Config.aprs_is.active); + Serial.println(Config.aprs_is.passcode); + Serial.println(Config.aprs_is.server); + Serial.println(Config.aprs_is.port); + Serial.println(Config.aprs_is.filter); + Serial.println(Config.aprs_is.messagesToRF); + Serial.println(Config.aprs_is.objectsToRF); + Serial.println(" "); + Serial.println(Config.beacon.latitude); + Serial.println(Config.beacon.longitude); + Serial.println(Config.beacon.comment); + Serial.println(Config.beacon.overlay); + Serial.println(Config.beacon.symbol); + Serial.println(Config.beacon.interval); + Serial.println(Config.beacon.sendViaRF); + Serial.println(Config.beacon.sendViaAPRSIS); + Serial.println(Config.beacon.path); + Serial.println(" "); + Serial.println(Config.digi.mode); + Serial.println(" "); + Serial.println(Config.lora.txFreq); + Serial.println(Config.lora.rxFreq); + Serial.println(Config.lora.txActive); + Serial.println(Config.lora.rxActive); + Serial.println(Config.lora.spreadingFactor); + Serial.println(Config.lora.signalBandwidth); + Serial.println(Config.lora.codingRate4); + Serial.println(Config.lora.power); + Serial.println(" "); + Serial.println(Config.display.alwaysOn); + Serial.println(Config.display.timeout); + Serial.println(Config.display.turn180); + Serial.println(" "); + Serial.println(Config.battery.sendInternalVoltage); Serial.println(Config.battery.sendExternalVoltage); Serial.println(Config.battery.externalVoltagePin); Serial.println(Config.battery.internalMonitor); Serial.println(Config.battery.internalSleepVoltage); Serial.println(Config.battery.externalMonitor); - Serial.println(Config.battery.externalSleepVoltage);*/ + Serial.println(Config.battery.externalSleepVoltage); + Serial.println(" "); + Serial.println(Config.bme.active); + Serial.println(Config.bme.heightCorrection); + Serial.println(Config.bme.temperatureCorrection); + Serial.println(" "); + Serial.println(Config.syslog.active); + Serial.println(Config.syslog.server); + Serial.println(Config.syslog.port); + Serial.println(" "); + Serial.println(Config.tnc.enableServer); + Serial.println(Config.tnc.enableSerial); + Serial.println(Config.tnc.acceptOwn); + Serial.println(" "); + Serial.println(Config.ota.username); + Serial.println(Config.ota.password); + Serial.println(" "); + Serial.println(Config.reload); + Serial.println(Config.rememberStationTime); + Serial.println(Config.lowPowerMode); + Serial.println(Config.lowVoltageCutOff); + Serial.println(Config.rebootMode); + Serial.println(Config.rebootModeTime);*/ // } diff --git a/src/configuration.cpp b/src/configuration.cpp index 46258746..ae1ef009 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -17,7 +17,7 @@ void Configuration::check() { void Configuration::writeFile() { Serial.println("Saving config.."); - StaticJsonDocument<2048> data; + StaticJsonDocument<3000> data; File configFile = SPIFFS.open("/igate_conf.json", "w"); if (wifiAPs[0].ssid != "") { // We don't want to save Auto AP empty SSID @@ -33,20 +33,6 @@ void Configuration::writeFile() { data["callsign"] = callsign; data["other"]["rememberStationTime"] = rememberStationTime; - data["digi"]["mode"] = digi.mode; - - 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"]["messagesToRF"] = aprs_is.messagesToRF; - data["aprs_is"]["objectsToRF"] = aprs_is.objectsToRF; - data["beacon"]["comment"] = beacon.comment; data["beacon"]["interval"] = beacon.interval; data["beacon"]["latitude"] = beacon.latitude; @@ -55,7 +41,17 @@ void Configuration::writeFile() { data["beacon"]["symbol"] = beacon.symbol; data["beacon"]["sendViaAPRSIS"] = beacon.sendViaAPRSIS; data["beacon"]["sendViaRF"] = beacon.sendViaRF; - data["beacon"]["path"] = beacon.path; + data["beacon"]["path"] = beacon.path; + + 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"]["messagesToRF"] = aprs_is.messagesToRF; + data["aprs_is"]["objectsToRF"] = aprs_is.objectsToRF; + + data["digi"]["mode"] = digi.mode; data["lora"]["rxFreq"] = lora.rxFreq; data["lora"]["txFreq"] = lora.txFreq; @@ -70,14 +66,26 @@ void Configuration::writeFile() { 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["battery"]["sendInternalVoltage"] = battery.sendInternalVoltage; + data["battery"]["sendExternalVoltage"] = battery.sendExternalVoltage; + data["battery"]["externalVoltagePin"] = battery.externalVoltagePin; + data["battery"]["internalMonitor"] = battery.internalMonitor; + data["battery"]["internalSleepVoltage"] = battery.internalSleepVoltage; + data["battery"]["externalMonitor"] = battery.externalMonitor; + data["battery"]["externalSleepVoltage"] = battery.externalSleepVoltage; data["bme"]["active"] = bme.active; data["bme"]["heightCorrection"] = bme.heightCorrection; data["bme"]["temperatureCorrection"] = bme.temperatureCorrection; + data["syslog"]["active"] = syslog.active; + data["syslog"]["server"] = syslog.server; + data["syslog"]["port"] = syslog.port; + + data["tnc"]["enableServer"] = tnc.enableServer; + data["tnc"]["enableSerial"] = tnc.enableSerial; + data["tnc"]["acceptOwn"] = tnc.acceptOwn; + data["ota"]["username"] = ota.username; data["ota"]["password"] = ota.password; @@ -89,14 +97,6 @@ void Configuration::writeFile() { data["other"]["rebootMode"] = rebootMode; data["other"]["rebootModeTime"] = rebootModeTime; - data["battery"]["sendInternalVoltage"] = battery.sendInternalVoltage; - data["battery"]["sendExternalVoltage"] = battery.sendExternalVoltage; - data["battery"]["externalVoltagePin"] = battery.externalVoltagePin; - data["battery"]["internalMonitor"] = battery.internalMonitor; - data["battery"]["internalSleepVoltage"] = battery.internalSleepVoltage; - data["battery"]["externalMonitor"] = battery.externalMonitor; - data["battery"]["externalSleepVoltage"] = battery.externalSleepVoltage; - serializeJson(data, configFile); configFile.close(); @@ -110,7 +110,7 @@ bool Configuration::readFile() { File configFile = SPIFFS.open("/igate_conf.json", "r"); if (configFile) { - StaticJsonDocument<2048> data; + StaticJsonDocument<3000> data; DeserializationError error = deserializeJson(data, configFile); if (error) { @@ -130,36 +130,65 @@ bool Configuration::readFile() { wifiAutoAP.powerOff = data["wifi"]["autoAP"]["powerOff"].as(); callsign = data["callsign"].as(); - rememberStationTime = data["other"]["rememberStationTime"].as(); + aprs_is.active = data["aprs_is"]["active"].as(); aprs_is.passcode = data["aprs_is"]["passcode"].as(); aprs_is.server = data["aprs_is"]["server"].as(); aprs_is.port = data["aprs_is"]["port"].as(); + aprs_is.filter = data["aprs_is"]["filter"].as(); + aprs_is.messagesToRF = data["aprs_is"]["messagesToRF"].as(); + aprs_is.objectsToRF = data["aprs_is"]["objectsToRF"].as(); + + beacon.latitude = data["beacon"]["latitude"].as(); + beacon.longitude = data["beacon"]["longitude"].as(); + beacon.comment = data["beacon"]["comment"].as(); + beacon.interval = data["beacon"]["interval"].as(); + beacon.overlay = data["beacon"]["overlay"].as(); + beacon.symbol = data["beacon"]["symbol"].as(); + beacon.path = data["beacon"]["path"].as(); + beacon.sendViaAPRSIS = data["beacon"]["sendViaAPRSIS"].as(); + beacon.sendViaRF = data["beacon"]["sendViaRF"].as(); + + digi.mode = data["digi"]["mode"].as(); + lora.txFreq = data["lora"]["txFreq"].as(); + lora.rxFreq = data["lora"]["rxFreq"].as(); lora.spreadingFactor = data["lora"]["spreadingFactor"].as(); lora.signalBandwidth = data["lora"]["signalBandwidth"].as(); lora.codingRate4 = data["lora"]["codingRate4"].as(); lora.power = data["lora"]["power"].as(); + lora.txActive = data["lora"]["txActive"].as(); + lora.rxActive = data["lora"]["rxActive"].as(); display.alwaysOn = data["display"]["alwaysOn"].as(); display.timeout = data["display"]["timeout"].as(); display.turn180 = data["display"]["turn180"].as(); - syslog.active = data["syslog"]["active"].as(); - syslog.server = data["syslog"]["server"].as(); - syslog.port = data["syslog"]["port"].as(); + battery.sendInternalVoltage = data["battery"]["sendInternalVoltage"].as(); + battery.sendExternalVoltage = data["battery"]["sendExternalVoltage"].as(); + battery.externalVoltagePin = data["battery"]["externalVoltagePin"].as(); + battery.internalMonitor = data["battery"]["internalMonitor"].as(); + battery.internalSleepVoltage = data["battery"]["internalSleepVoltage"].as(); + battery.externalMonitor = data["battery"]["externalMonitor"].as(); + battery.externalSleepVoltage = data["battery"]["externalSleepVoltage"].as(); bme.active = data["bme"]["active"].as(); bme.heightCorrection = data["bme"]["heightCorrection"].as(); bme.temperatureCorrection = data["bme"]["temperatureCorrection"].as(); - ota.username = data["ota"]["username"].as(); - ota.password = data["ota"]["password"].as(); + syslog.active = data["syslog"]["active"].as(); + syslog.server = data["syslog"]["server"].as(); + syslog.port = data["syslog"]["port"].as(); tnc.enableServer = data["tnc"]["enableServer"].as(); tnc.enableSerial = data["tnc"]["enableSerial"].as(); tnc.acceptOwn = data["tnc"]["acceptOwn"].as(); + ota.username = data["ota"]["username"].as(); + ota.password = data["ota"]["password"].as(); + + rememberStationTime = data["other"]["rememberStationTime"].as(); + lowPowerMode = data["other"]["lowPowerMode"].as(); lowVoltageCutOff = data["other"]["lowVoltageCutOff"].as(); @@ -168,87 +197,6 @@ bool Configuration::readFile() { rebootMode = data["other"]["rebootMode"].as(); rebootModeTime = data["other"]["rebootModeTime"].as(); - battery.sendInternalVoltage = data["battery"]["sendInternalVoltage"].as(); - battery.sendExternalVoltage = data["battery"]["sendExternalVoltage"].as(); - battery.externalVoltagePin = data["battery"]["externalVoltagePin"].as(); - battery.internalMonitor = data["battery"]["internalMonitor"].as(); - battery.internalSleepVoltage = data["battery"]["internalSleepVoltage"].as(); - battery.externalMonitor = data["battery"]["externalMonitor"].as(); - battery.externalSleepVoltage = data["battery"]["externalSleepVoltage"].as(); - - int stationMode = data["stationMode"].as(); // deprecated but need to specify config version - - if (stationMode == 0) { - // Load new settings - - beacon.latitude = data["beacon"]["latitude"].as(); - beacon.longitude = data["beacon"]["longitude"].as(); - beacon.comment = data["beacon"]["comment"].as(); - beacon.overlay = data["beacon"]["overlay"].as(); - beacon.symbol = data["beacon"]["symbol"].as(); - beacon.interval = data["beacon"]["interval"].as(); - beacon.sendViaAPRSIS = data["beacon"]["sendViaAPRSIS"].as(); - beacon.sendViaRF = data["beacon"]["sendViaRF"].as(); - beacon.path = data["beacon"]["path"].as(); - - digi.mode = data["digi"]["mode"].as(); - - aprs_is.active = data["aprs_is"]["active"].as(); - aprs_is.filter = data["aprs_is"]["filter"].as(); - aprs_is.messagesToRF = data["aprs_is"]["messagesToRF"].as(); - aprs_is.objectsToRF = data["aprs_is"]["objectsToRF"].as(); - - lora.txFreq = data["lora"]["txFreq"].as(); - lora.rxFreq = data["lora"]["rxFreq"].as(); - lora.txActive = data["lora"]["txActive"].as(); - lora.rxActive = data["lora"]["rxActive"].as(); - } else { - // Load old settings and put into new variables not actual config - - String iGateComment = data["iGateComment"].as(); - int beaconInterval = data["other"]["beaconInterval"].as(); - - long iGateFreq = data["lora"]["iGateFreq"].as(); - long digirepeaterTxFreq = data["lora"]["digirepeaterTxFreq"].as(); - long digirepeaterRxFreq = data["lora"]["digirepeaterRxFreq"].as(); - - String digiComment = data["digi"]["comment"].as(); - double digiLatitude = data["digi"]["latitude"].as(); - double digiLongitude = data["digi"]["longitude"].as(); - - beacon.latitude = digiLatitude; - beacon.longitude = digiLongitude; - beacon.interval = beaconInterval; - - lora.txFreq = digirepeaterTxFreq; - lora.rxFreq = digirepeaterRxFreq; - lora.rxActive = true; - beacon.sendViaAPRSIS = true; - beacon.sendViaRF = false; - - switch (stationMode) { - case 1: // IGate only - // aprs_is.active = true; // better don't do that automatically - beacon.comment = iGateComment; - lora.rxFreq = iGateFreq; - break; - case 5: // Digi + IGate - case 2: // Digi + IGate - // aprs_is.active = true; // better don't do that automatically - // digi.mode = 2; // better don't do that automatically - beacon.comment = digiComment; - lora.rxFreq = iGateFreq; - break; - case 3: // Digi - case 4: // Digi - // digi.mode = 2; // better don't do that automatically - beacon.comment = digiComment; - break; - } - - reload = true; - } - 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 = ""; @@ -269,63 +217,71 @@ void Configuration::init() { reload = false; WiFi_AP wifiap; - wifiap.ssid = ""; - wifiap.password = ""; + wifiap.ssid = ""; + wifiap.password = ""; wifiAPs.push_back(wifiap); - wifiAutoAP.password = "1234567890"; - wifiAutoAP.powerOff = 15; - - callsign = "N0CALL"; - - beacon.comment = "LoRa APRS"; - beacon.latitude = 0.0; - beacon.longitude = 0.0; - beacon.interval = 15; - beacon.overlay = "L"; - beacon.symbol = "#"; - beacon.sendViaAPRSIS = true; - beacon.sendViaRF = false; - beacon.path = "WIDE1-1"; + wifiAutoAP.password = "1234567890"; + wifiAutoAP.powerOff = 15; + + callsign = "N0CALL"; + + beacon.comment = "LoRa APRS"; + beacon.latitude = 0.0; + beacon.longitude = 0.0; + beacon.interval = 15; + beacon.overlay = "L"; + beacon.symbol = "#"; + beacon.sendViaAPRSIS = true; + beacon.sendViaRF = false; + beacon.path = "WIDE1-1"; + + aprs_is.active = false; + aprs_is.passcode = "XYZVW"; + aprs_is.server = "rotate.aprs2.net"; + aprs_is.port = 14580; + aprs_is.filter = "m/10"; + aprs_is.messagesToRF = false; + aprs_is.objectsToRF = false; - digi.mode = 0; - - tnc.enableServer = false; - tnc.enableSerial = false; - tnc.acceptOwn = false; - - aprs_is.active = false; - aprs_is.passcode = "XYZVW"; - aprs_is.server = "rotate.aprs2.net"; - aprs_is.port = 14580; - aprs_is.filter = "m/10"; - aprs_is.messagesToRF = false; - aprs_is.objectsToRF = false; - - lora.txFreq = 433775000; - lora.rxFreq = 433775000; - lora.spreadingFactor = 12; - lora.signalBandwidth = 125000; - lora.codingRate4 = 5; - lora.power = 20; - lora.txActive = false; - lora.rxActive = true; + digi.mode = 0; + + lora.txFreq = 433775000; + lora.rxFreq = 433775000; + lora.spreadingFactor = 12; + lora.signalBandwidth = 125000; + lora.codingRate4 = 5; + lora.power = 20; + lora.txActive = false; + lora.rxActive = true; - display.alwaysOn = true; - display.timeout = 4; - display.turn180 = false; + display.alwaysOn = true; + display.timeout = 4; + display.turn180 = false; + + battery.sendInternalVoltage = false; + battery.sendExternalVoltage = false; + battery.externalVoltagePin = 34; + battery.internalMonitor = false; + battery.internalSleepVoltage = 0.0; + battery.externalMonitor = false; + battery.externalSleepVoltage = 0.0; + + bme.active = false; + bme.heightCorrection = 0; + bme.temperatureCorrection = 0.0; - syslog.active = false; - syslog.server = "192.168.0.100"; - syslog.port = 514; + syslog.active = false; + syslog.server = "192.168.0.100"; + syslog.port = 514; - bme.active = false; - bme.heightCorrection = 0; - bme.temperatureCorrection = 0.0; + tnc.enableServer = false; + tnc.enableSerial = false; + tnc.acceptOwn = false; - ota.username = ""; - ota.password = ""; + ota.username = ""; + ota.password = ""; rememberStationTime = 30; @@ -337,13 +293,6 @@ void Configuration::init() { rebootMode = false; rebootModeTime = 0; - battery.sendInternalVoltage = false; - battery.sendExternalVoltage = false; - battery.externalVoltagePin = 34; - battery.internalMonitor = false; - battery.internalSleepVoltage = 0.0; - battery.externalMonitor = false; - battery.externalSleepVoltage = 0.0; Serial.println("All is Written!"); } diff --git a/src/web_utils.cpp b/src/web_utils.cpp index 0e2ff795..bb191033 100644 --- a/src/web_utils.cpp +++ b/src/web_utils.cpp @@ -61,7 +61,7 @@ namespace WEB_Utils { } void handleReceivedPackets(AsyncWebServerRequest *request) { - StaticJsonDocument<1536> data; + StaticJsonDocument<2048> data; for (int i = 0; i < receivedPackets.size(); i++) { data[i]["millis"] = receivedPackets[i].millis; @@ -86,107 +86,88 @@ namespace WEB_Utils { for (int i=0; igetParam("wifi.AP." + String(i) + ".ssid", true)->value(); - wifiap.password = request->getParam("wifi.AP." + String(i) + ".password", true)->value(); - // wifiap.latitude = request->getParam("wifi.AP." + String(i) + ".latitude", true)->value().toDouble(); - // wifiap.longitude = request->getParam("wifi.AP." + String(i) + ".longitude", true)->value().toDouble(); + wifiap.ssid = request->getParam("wifi.AP." + String(i) + ".ssid", true)->value(); + wifiap.password = request->getParam("wifi.AP." + String(i) + ".password", true)->value(); Config.wifiAPs.push_back(wifiap); } - Config.callsign = request->getParam("callsign", true)->value(); - // Config.iGateComment = request->getParam("iGateComment", true)->value(); + Config.callsign = request->getParam("callsign", true)->value(); - Config.wifiAutoAP.password = request->getParam("wifi.autoAP.password", true)->value(); - Config.wifiAutoAP.powerOff = request->getParam("wifi.autoAP.powerOff", true)->value().toInt(); - - Config.digi.mode = request->getParam("digi.mode", true)->value().toInt(); - // Config.digi.comment = request->getParam("digi.comment", true)->value(); - // Config.digi.latitude = request->getParam("digi.latitude", true)->value().toDouble(); - // Config.digi.longitude = request->getParam("digi.longitude", true)->value().toDouble(); - - 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.aprs_is.active = request->hasParam("aprs_is.active", true); - Config.aprs_is.passcode = request->getParam("aprs_is.passcode", true)->value(); - Config.aprs_is.server = request->getParam("aprs_is.server", true)->value(); - Config.aprs_is.port = request->getParam("aprs_is.port", true)->value().toInt(); - // Config.aprs_is.reportingDistance = request->getParam("aprs_is.reportingDistance", true)->value().toInt(); - Config.aprs_is.filter = request->getParam("aprs_is.filter", true)->value(); - //Config.aprs_is.toRF = request->hasParam("aprs_is.toRF", true); - Config.aprs_is.messagesToRF = request->hasParam("aprs_is.messagesToRF", true); - Config.aprs_is.objectsToRF = request->hasParam("aprs_is.objectsToRF", true); - - // Config.lora.iGateFreq = request->getParam("lora.iGateFreq", true)->value().toInt(); - // if (request->hasParam("lora.digirepeaterTxFreq", true)) { - // Config.lora.digirepeaterTxFreq = request->getParam("lora.digirepeaterTxFreq", true)->value().toInt(); - // } - // if (request->hasParam("lora.digirepeaterRxFreq", true)) { - // Config.lora.digirepeaterRxFreq = request->getParam("lora.digirepeaterRxFreq", true)->value().toInt(); - // } - - Config.lora.txFreq = request->getParam("lora.txFreq", true)->value().toInt(); - Config.lora.rxFreq = request->getParam("lora.rxFreq", true)->value().toInt(); - Config.lora.spreadingFactor = request->getParam("lora.spreadingFactor", true)->value().toInt(); - Config.lora.signalBandwidth = request->getParam("lora.signalBandwidth", true)->value().toInt(); - Config.lora.codingRate4 = request->getParam("lora.codingRate4", true)->value().toInt(); - Config.lora.power = request->getParam("lora.power", true)->value().toInt(); - Config.lora.txActive = request->hasParam("lora.txActive", true); - Config.lora.rxActive = request->hasParam("lora.rxActive", true); - - Config.display.alwaysOn = request->hasParam("display.alwaysOn", true); - + Config.wifiAutoAP.password = request->getParam("wifi.autoAP.password", true)->value(); + Config.wifiAutoAP.powerOff = request->getParam("wifi.autoAP.powerOff", true)->value().toInt(); + + Config.aprs_is.active = request->hasParam("aprs_is.active", true); + Config.aprs_is.passcode = request->getParam("aprs_is.passcode", true)->value(); + Config.aprs_is.server = request->getParam("aprs_is.server", true)->value(); + Config.aprs_is.port = request->getParam("aprs_is.port", true)->value().toInt(); + Config.aprs_is.filter = request->getParam("aprs_is.filter", true)->value(); + Config.aprs_is.messagesToRF = request->hasParam("aprs_is.messagesToRF", true); + Config.aprs_is.objectsToRF = request->hasParam("aprs_is.objectsToRF", true); + + Config.beacon.interval = request->getParam("beacon.interval", true)->value().toInt(); + Config.beacon.sendViaAPRSIS = request->hasParam("beacon.sendViaAPRSIS", true); + Config.beacon.sendViaRF = request->hasParam("beacon.sendViaRF", true); + Config.beacon.latitude = request->getParam("beacon.latitude", true)->value().toDouble(); + Config.beacon.longitude = request->getParam("beacon.longitude", true)->value().toDouble(); + Config.beacon.comment = request->getParam("beacon.comment", true)->value(); + Config.beacon.overlay = request->getParam("beacon.overlay", true)->value(); + Config.beacon.symbol = request->getParam("beacon.symbol", true)->value(); + Config.beacon.path = request->getParam("beacon.path", true)->value(); + + Config.digi.mode = request->getParam("digi.mode", true)->value().toInt(); + + Config.lora.txFreq = request->getParam("lora.txFreq", true)->value().toInt(); + Config.lora.rxFreq = request->getParam("lora.rxFreq", true)->value().toInt(); + Config.lora.spreadingFactor = request->getParam("lora.spreadingFactor", true)->value().toInt(); + Config.lora.signalBandwidth = request->getParam("lora.signalBandwidth", true)->value().toInt(); + Config.lora.codingRate4 = request->getParam("lora.codingRate4", true)->value().toInt(); + Config.lora.power = request->getParam("lora.power", true)->value().toInt(); + Config.lora.txActive = request->hasParam("lora.txActive", true); + Config.lora.rxActive = request->hasParam("lora.rxActive", true); + + Config.display.alwaysOn = request->hasParam("display.alwaysOn", true); if (!Config.display.alwaysOn) { - Config.display.timeout = request->getParam("display.timeout", true)->value().toInt(); + Config.display.timeout = request->getParam("display.timeout", true)->value().toInt(); } + Config.display.turn180 = request->hasParam("display.turn180", true); - Config.display.turn180 = request->hasParam("display.turn180", true); + Config.battery.sendInternalVoltage = request->hasParam("battery.sendInternalVoltage", true); + Config.battery.sendExternalVoltage = request->hasParam("battery.sendExternalVoltage", true); + if (Config.battery.sendExternalVoltage) { + Config.battery.externalVoltagePin = request->getParam("battery.externalVoltagePin", true)->value().toInt(); + } + Config.battery.internalMonitor = request->hasParam("battery.internalMonitor", true); + Config.battery.internalSleepVoltage = request->getParam("battery.internalSleepVoltage", true)->value().toFloat(); + Config.battery.externalMonitor = request->hasParam("battery.externalMonitor", true); + Config.battery.externalSleepVoltage = request->getParam("battery.externalSleepVoltage", true)->value().toFloat(); - Config.syslog.active = request->hasParam("syslog.active", true); + Config.bme.active = request->hasParam("bme.active", true); + Config.bme.heightCorrection = request->getParam("bme.heightCorrection", true)->value().toInt(); + Config.bme.temperatureCorrection = request->getParam("bme.temperatureCorrection", true)->value().toFloat(); + Config.syslog.active = request->hasParam("syslog.active", true); if (Config.syslog.active) { - Config.syslog.server = request->getParam("syslog.server", true)->value(); - Config.syslog.port = request->getParam("syslog.port", true)->value().toInt(); + Config.syslog.server = request->getParam("syslog.server", true)->value(); + Config.syslog.port = request->getParam("syslog.port", true)->value().toInt(); } - Config.bme.active = request->hasParam("bme.active", true); - Config.bme.heightCorrection = request->getParam("bme.heightCorrection", true)->value().toInt(); - Config.bme.temperatureCorrection = request->getParam("bme.temperatureCorrection", true)->value().toFloat(); - - Config.ota.username = request->getParam("ota.username", true)->value(); - Config.ota.password = request->getParam("ota.password", true)->value(); + 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.beacon.interval = request->getParam("beacon.interval", true)->value().toInt(); - Config.beacon.sendViaAPRSIS = request->hasParam("beacon.sendViaAPRSIS", true); - Config.beacon.sendViaRF = request->hasParam("beacon.sendViaRF", true); - Config.beacon.latitude = request->getParam("beacon.latitude", true)->value().toDouble(); - Config.beacon.longitude = request->getParam("beacon.longitude", true)->value().toDouble(); - Config.beacon.comment = request->getParam("beacon.comment", true)->value(); - Config.beacon.overlay = request->getParam("beacon.overlay", true)->value(); - Config.beacon.symbol = request->getParam("beacon.symbol", true)->value(); - Config.beacon.path = request->getParam("beacon.path", true)->value(); + Config.ota.username = request->getParam("ota.username", true)->value(); + Config.ota.password = request->getParam("ota.password", true)->value(); - // Config.beaconInterval = request->getParam("other.beaconInterval", true)->value().toInt(); - // Config.igateSendsLoRaBeacons = request->hasParam("other.igateSendsLoRaBeacons", true); - // Config.igateRepeatsLoRaPackets = request->hasParam("other.igateRepeatsLoRaPackets", true); - Config.rememberStationTime = request->getParam("other.rememberStationTime", true)->value().toInt(); + Config.rememberStationTime = request->getParam("other.rememberStationTime", true)->value().toInt(); - Config.rebootMode = request->hasParam("other.rebootMode", true); - Config.rebootModeTime = request->getParam("other.rebootModeTime", 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(); + Config.lowPowerMode = request->hasParam("other.lowPowerMode", true); + Config.lowVoltageCutOff = request->getParam("other.lowVoltageCutOff", true)->value().toDouble(); - Config.backupDigiMode = request->hasParam("other.backupDigiMode", true); - - Config.battery.sendInternalVoltage = request->hasParam("battery.sendInternalVoltage", true); - Config.battery.sendExternalVoltage = request->hasParam("battery.sendExternalVoltage", true); - - if (Config.battery.sendExternalVoltage) { - Config.battery.externalVoltagePin = request->getParam("battery.externalVoltagePin", true)->value().toInt(); - } + Config.backupDigiMode = request->hasParam("other.backupDigiMode", true); if (Config.bme.active) { Config.beacon.symbol = "_";