Rx and Tx Freq selection fix

This commit is contained in:
richonguzman 2025-10-15 14:18:43 -03:00
parent bec4f4f473
commit 83ec2265c6
9 changed files with 36 additions and 30 deletions

View file

@ -17,7 +17,7 @@
"path": "WIDE1-1",
"sendViaAPRSIS": false,
"sendViaRF": false,
"beaconOnRxFreq": false,
"beaconFreq": 1,
"statusActive": false,
"statusPacket": "",
"gpsActive": false,

View file

@ -569,29 +569,26 @@
</div>
</div>
<div class="row mt-3">
<div class="col-6 d-grid gap-2">
<button class="btn btn-primary" id="send-beacon">Send beacon now</button>
<div class="col-6">
<button class="btn btn-primary form-control h-100" id="send-beacon">Send beacon now</button>
</div>
<div class="col-6">
<label
for="digi.beaconOnRxFreq"
class="form-label"
>Digipeater Beacon Frequency
<small
>(If Rx Freq different from Tx Freq).</small
></label
>
for="beacon.beaconFreq"
class="form-label">
<small>(Select LoRa Beacon Frequency)</small>
</label>
<select
class="form-select form-select"
name="digi.beaconOnRxFreq"
id="digi.beaconOnRxFreq"
name="beacon.beaconFreq"
id="beacon.beaconFreq"
>
<option value="false">
Beacon on Tx Freq
</option>
<option value="true">
<option value="0">
Beacon on Rx Freq
</option>
<option value="1">
Beacon on Tx Freq
</option>
</select>
</div>
</div>

View file

@ -119,8 +119,11 @@ function loadSettings(settings) {
document.getElementById("beacon.interval").value = settings.beacon.interval;
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.beaconFreq").value = settings.beacon.beaconFreq;
BeaconingViaRFCheckbox.checked = settings.beacon.sendViaRF;
BeaconingFrequency.disabled = !BeaconingViaRFCheckbox.checked;
document.getElementById("beacon.statusActive").checked = settings.beacon.statusActive;
document.getElementById("beacon.statusPacket").value = settings.beacon.statusPacket;
@ -306,6 +309,12 @@ function updateImage() {
}
}
// Beaconing Switches
const BeaconingViaRFCheckbox = document.querySelector('input[name="beacon.sendViaRF"]');
const BeaconingFrequency = document.querySelector('select[name="beacon.beaconFreq"]');
BeaconingViaRFCheckbox.addEventListener("change", function() {
BeaconingFrequency.disabled = !this.checked;
});
// Status Switch
const StatusCheckbox = document.querySelector('input[name="beacon.statusActive"]');

View file

@ -47,7 +47,7 @@ public:
String path;
bool sendViaAPRSIS;
bool sendViaRF;
bool beaconOnRxFreq;
int beaconFreq;
bool statusActive;
String statusPacket;
bool gpsActive;

View file

@ -67,8 +67,8 @@ ___________________________________________________________________*/
#endif
String versionDate = "2025-10-13";
String versionNumber = "3.1.3";
String versionDate = "2025-10-15";
String versionNumber = "3.1.4";
Configuration Config;
WiFiClient aprsIsClient;
WiFiClient mqttClient;

View file

@ -72,7 +72,7 @@ bool Configuration::writeFile() {
data["beacon"]["sendViaAPRSIS"] = beacon.sendViaAPRSIS;
data["beacon"]["sendViaRF"] = beacon.sendViaRF;
data["beacon"]["beaconOnRxFreq"] = beacon.beaconOnRxFreq;
data["beacon"]["beaconFreq"] = beacon.beaconFreq;
data["beacon"]["statusActive"] = beacon.statusActive;
data["beacon"]["statusPacket"] = beacon.statusPacket;
@ -227,7 +227,7 @@ bool Configuration::readFile() {
!data["beacon"].containsKey("path") ||
!data["beacon"].containsKey("sendViaAPRSIS") ||
!data["beacon"].containsKey("sendViaRF") ||
!data["beacon"].containsKey("beaconOnRxFreq") ||
!data["beacon"].containsKey("beaconFreq") ||
!data["beacon"].containsKey("statusActive") ||
!data["beacon"].containsKey("statusPacket") ||
!data["beacon"].containsKey("gpsActive") ||
@ -241,7 +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.beaconFreq = data["beacon"]["beaconFreq"] | 1;
beacon.statusActive = data["beacon"]["statusActive"] | false;
beacon.statusPacket = data["beacon"]["statusPacket"] | "";
beacon.gpsActive = data["beacon"]["gpsActive"] | false;
@ -440,7 +440,7 @@ void Configuration::setDefaultValues() {
beacon.sendViaAPRSIS = true;
beacon.sendViaRF = false;
beacon.beaconOnRxFreq = false;
beacon.beaconFreq = 1;
beacon.statusActive = false;
beacon.statusPacket = "";

View file

@ -129,7 +129,7 @@ namespace LoRa_Utils {
}
void changeFreqTx() {
delay(500);
delay(300);
float freq = (float)Config.loramodule.txFreq / 1000000;
radio.setFrequency(freq);
radio.setSpreadingFactor(Config.loramodule.txSpreadingFactor);
@ -138,7 +138,7 @@ namespace LoRa_Utils {
}
void changeFreqRx() {
delay(500);
delay(300);
float freq = (float)Config.loramodule.rxFreq / 1000000;
radio.setFrequency(freq);
radio.setSpreadingFactor(Config.loramodule.rxSpreadingFactor);
@ -150,7 +150,7 @@ namespace LoRa_Utils {
if (!Config.loramodule.txActive) return;
if (Config.loramodule.txFreq != Config.loramodule.rxFreq) {
if (!packetIsBeacon || (packetIsBeacon && !Config.beacon.beaconOnRxFreq)) {
if (!packetIsBeacon || (packetIsBeacon && Config.beacon.beaconFreq == 1)) {
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.beacon.beaconOnRxFreq)) {
if (!packetIsBeacon || (packetIsBeacon && Config.beacon.beaconFreq == 1)) {
changeFreqRx();
}
}

View file

@ -284,7 +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.beacon.beaconFreq = 1; // return to LoRa Tx Beacon Freq
Config.writeFile();
ESP.restart();
}

View file

@ -177,7 +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.beaconFreq = getParamIntSafe("beacon.beaconFreq", Config.beacon.beaconFreq);
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);