From bec4f4f4734e5d519cefb11665b6d86cb99545ed Mon Sep 17 00:00:00 2001 From: richonguzman Date: Wed, 15 Oct 2025 10:58:30 -0300 Subject: [PATCH] beaconOnRxFreq into beacon config --- data/igate_conf.json | 4 ++-- data_embed/index.html | 48 +++++++++++++++++++++-------------------- data_embed/script.js | 2 +- include/configuration.h | 10 ++++----- src/configuration.cpp | 19 ++++++++-------- src/lora_utils.cpp | 4 ++-- src/utils.cpp | 1 + src/web_utils.cpp | 4 ++-- 8 files changed, 48 insertions(+), 44 deletions(-) diff --git a/data/igate_conf.json b/data/igate_conf.json index 3332a7f..7324498 100644 --- a/data/igate_conf.json +++ b/data/igate_conf.json @@ -17,6 +17,7 @@ "path": "WIDE1-1", "sendViaAPRSIS": false, "sendViaRF": false, + "beaconOnRxFreq": false, "statusActive": false, "statusPacket": "", "gpsActive": false, @@ -35,8 +36,7 @@ "blacklist": "", "digi": { "mode": 0, - "ecoMode": 0, - "beaconOnRxFreq": false + "ecoMode": 0 }, "lora": { "rxActive": true, diff --git a/data_embed/index.html b/data_embed/index.html index 0b8931f..f8b0467 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -567,11 +567,35 @@ + +
+
+ + +
-
+
-
- - -
diff --git a/data_embed/script.js b/data_embed/script.js index d88fdbd..382913d 100644 --- a/data_embed/script.js +++ b/data_embed/script.js @@ -120,6 +120,7 @@ function loadSettings(settings) { document.getElementById("other.rememberStationTime").value = settings.other.rememberStationTime; document.getElementById("beacon.sendViaAPRSIS").checked = settings.beacon.sendViaAPRSIS; document.getElementById("beacon.sendViaRF").checked = settings.beacon.sendViaRF; + document.getElementById("beacon.beaconOnRxFreq").value = settings.beacon.beaconOnRxFreq; document.getElementById("beacon.statusActive").checked = settings.beacon.statusActive; document.getElementById("beacon.statusPacket").value = settings.beacon.statusPacket; @@ -135,7 +136,6 @@ function loadSettings(settings) { // Digi document.getElementById("digi.mode").value = settings.digi.mode; document.getElementById("digi.ecoMode").value = settings.digi.ecoMode; - document.getElementById("digi.beaconOnRxFreq").value = settings.digi.beaconOnRxFreq; // LoRa document.getElementById("lora.rxActive").checked = settings.lora.rxActive; diff --git a/include/configuration.h b/include/configuration.h index a3be83d..0c78990 100644 --- a/include/configuration.h +++ b/include/configuration.h @@ -45,12 +45,13 @@ public: String overlay; String symbol; String path; - bool sendViaRF; bool sendViaAPRSIS; - bool gpsActive; - bool gpsAmbiguity; + bool sendViaRF; + bool beaconOnRxFreq; bool statusActive; String statusPacket; + bool gpsActive; + bool gpsAmbiguity; }; class APRS_IS { @@ -67,8 +68,7 @@ public: class DIGI { public: int mode; - int ecoMode; // 0 = Not Active | 1 = Ultra EcoMode | 2 = Not Active (WiFi OFF, Serial ON) - bool beaconOnRxFreq; + int ecoMode; // 0 = Not Active | 1 = Ultra EcoMode | 2 = Not Active (WiFi OFF, Serial ON) }; class LoraModule { diff --git a/src/configuration.cpp b/src/configuration.cpp index 9b5461a..d6564b1 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -68,9 +68,11 @@ bool Configuration::writeFile() { data["beacon"]["longitude"] = beacon.longitude; data["beacon"]["overlay"] = beacon.overlay; data["beacon"]["symbol"] = beacon.symbol; + data["beacon"]["path"] = beacon.path; + data["beacon"]["sendViaAPRSIS"] = beacon.sendViaAPRSIS; data["beacon"]["sendViaRF"] = beacon.sendViaRF; - data["beacon"]["path"] = beacon.path; + data["beacon"]["beaconOnRxFreq"] = beacon.beaconOnRxFreq; data["beacon"]["statusActive"] = beacon.statusActive; data["beacon"]["statusPacket"] = beacon.statusPacket; @@ -87,7 +89,6 @@ bool Configuration::writeFile() { #if defined(HAS_A7670) if (digi.ecoMode == 1) data["digi"]["ecoMode"] = 2; #endif - data["digi"]["beaconOnRxFreq"] = digi.beaconOnRxFreq; data["lora"]["rxActive"] = loramodule.rxActive; data["lora"]["rxFreq"] = loramodule.rxFreq; @@ -226,6 +227,7 @@ bool Configuration::readFile() { !data["beacon"].containsKey("path") || !data["beacon"].containsKey("sendViaAPRSIS") || !data["beacon"].containsKey("sendViaRF") || + !data["beacon"].containsKey("beaconOnRxFreq") || !data["beacon"].containsKey("statusActive") || !data["beacon"].containsKey("statusPacket") || !data["beacon"].containsKey("gpsActive") || @@ -239,6 +241,7 @@ bool Configuration::readFile() { beacon.path = data["beacon"]["path"] | "WIDE1-1"; beacon.sendViaAPRSIS = data["beacon"]["sendViaAPRSIS"] | false; beacon.sendViaRF = data["beacon"]["sendViaRF"] | false; + beacon.beaconOnRxFreq = data["beacon"]["beaconOnRxFreq"] | false; beacon.statusActive = data["beacon"]["statusActive"] | false; beacon.statusPacket = data["beacon"]["statusPacket"] | ""; beacon.gpsActive = data["beacon"]["gpsActive"] | false; @@ -251,13 +254,10 @@ bool Configuration::readFile() { blacklist = data["blacklist"] | "station callsign"; if (!data["digi"].containsKey("mode") || - !data["digi"].containsKey("ecoMode") || - !data["digi"].containsKey("beaconOnRxFreq")) needsRewrite = true; + !data["digi"].containsKey("ecoMode")) needsRewrite = true; digi.mode = data["digi"]["mode"] | 0; digi.ecoMode = data["digi"]["ecoMode"] | 0; if (digi.ecoMode == 1) shouldSleepStop = false; - digi.beaconOnRxFreq = data["digi"]["beaconOnRxFreq"] | false; - #if defined(HAS_A7670) if (digi.ecoMode == 1) digi.ecoMode = 2; #endif @@ -436,10 +436,12 @@ void Configuration::setDefaultValues() { beacon.interval = 15; beacon.overlay = "L"; beacon.symbol = "a"; - beacon.sendViaAPRSIS = true; - beacon.sendViaRF = false; beacon.path = "WIDE1-1"; + beacon.sendViaAPRSIS = true; + beacon.sendViaRF = false; + beacon.beaconOnRxFreq = false; + beacon.statusActive = false; beacon.statusPacket = ""; @@ -452,7 +454,6 @@ void Configuration::setDefaultValues() { digi.mode = 0; digi.ecoMode = 0; - digi.beaconOnRxFreq = false; loramodule.rxActive = true; loramodule.rxFreq = 433775000; diff --git a/src/lora_utils.cpp b/src/lora_utils.cpp index db1bd07..f67829c 100644 --- a/src/lora_utils.cpp +++ b/src/lora_utils.cpp @@ -150,7 +150,7 @@ namespace LoRa_Utils { if (!Config.loramodule.txActive) return; if (Config.loramodule.txFreq != Config.loramodule.rxFreq) { - if (!packetIsBeacon || (packetIsBeacon && !Config.digi.beaconOnRxFreq)) { + if (!packetIsBeacon || (packetIsBeacon && !Config.beacon.beaconOnRxFreq)) { changeFreqTx(); } } @@ -174,7 +174,7 @@ namespace LoRa_Utils { if (Config.digi.ecoMode != 1) digitalWrite(INTERNAL_LED_PIN, LOW); // disabled in Ultra Eco Mode #endif if (Config.loramodule.txFreq != Config.loramodule.rxFreq) { - if (!packetIsBeacon || (packetIsBeacon && !Config.digi.beaconOnRxFreq)) { + if (!packetIsBeacon || (packetIsBeacon && !Config.beacon.beaconOnRxFreq)) { changeFreqRx(); } } diff --git a/src/utils.cpp b/src/utils.cpp index 11e72fa..6d93bb5 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -284,6 +284,7 @@ namespace Utils { Serial.println("Tx Freq less than 125kHz from Rx Freq ---> NOT VALID"); displayShow("Tx Freq is less than ", "125kHz from Rx Freq", "device will autofix", "and then reboot", 1000); Config.loramodule.txFreq = Config.loramodule.rxFreq; // Inform about that but then change the TX QRG to RX QRG and reset the device + Config.beacon.beaconOnRxFreq = false; Config.writeFile(); ESP.restart(); } diff --git a/src/web_utils.cpp b/src/web_utils.cpp index b3d4346..9eb24e7 100644 --- a/src/web_utils.cpp +++ b/src/web_utils.cpp @@ -177,6 +177,7 @@ namespace WEB_Utils { Config.beacon.interval = getParamIntSafe("beacon.interval", Config.beacon.interval); Config.beacon.sendViaAPRSIS = request->hasParam("beacon.sendViaAPRSIS", true); Config.beacon.sendViaRF = request->hasParam("beacon.sendViaRF", true); + Config.beacon.beaconOnRxFreq = request->hasParam("beacon.beaconOnRxFreq", true); Config.beacon.latitude = getParamDoubleSafe("beacon.latitude", Config.beacon.latitude); Config.beacon.longitude = getParamDoubleSafe("beacon.longitude", Config.beacon.longitude); Config.beacon.comment = getParamStringSafe("beacon.comment", Config.beacon.comment); @@ -198,9 +199,8 @@ namespace WEB_Utils { Config.digi.mode = getParamIntSafe("digi.mode", Config.digi.mode); Config.digi.ecoMode = getParamIntSafe("digi.ecoMode", Config.digi.ecoMode); - Config.digi.beaconOnRxFreq = request->hasParam("digi.beaconOnRxFreq", true); - + Config.loramodule.rxActive = request->hasParam("lora.rxActive", true); Config.loramodule.rxFreq = getParamIntSafe("lora.rxFreq", Config.loramodule.rxFreq); Config.loramodule.rxSpreadingFactor = getParamIntSafe("lora.rxSpreadingFactor", Config.loramodule.rxSpreadingFactor);