Skip to content

Commit f76b67d

Browse files
committed
Handle antennaHeight in m
1 parent aeac865 commit f76b67d

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

Firmware/RTK_Everywhere/AP-Config/src/main.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ function parseIncoming(msg) {
138138
hide("ethernetConfig");
139139
hide("ntpConfig");
140140
show("portsConfig");
141-
141+
142142
hide("externalPortOptions");
143143
show("noExternalPortOptions");
144-
144+
145145
hide("logToSDCard");
146146

147147
hide("constellationSbas"); //Not supported on UM980
@@ -378,6 +378,11 @@ function parseIncoming(msg) {
378378
}
379379
}
380380

381+
//Convert incoming mm to local meters
382+
else if (id.includes("antennaHeight_mm")) {
383+
ge("antennaHeight_m").value = val / 1000.0;
384+
}
385+
381386
//Check boxes / radio buttons
382387
else if (val == "true") {
383388
try {
@@ -641,8 +646,6 @@ function validateFields() {
641646
clearElement("fixedLatText", 40.09029479);
642647
clearElement("fixedLongText", -105.18505761);
643648
clearElement("fixedAltitude", 1560.089);
644-
clearElement("antennaHeight_mm", 0);
645-
clearElement("antennaPhaseCenter_mm", 0);
646649
}
647650
else {
648651
clearElement("observationSeconds", 60);
@@ -652,8 +655,6 @@ function validateFields() {
652655
clearElement("fixedLatText", 40.09029479);
653656
clearElement("fixedLongText", -105.18505761);
654657
clearElement("fixedAltitude", 1560.089);
655-
clearElement("antennaHeight_mm", 0);
656-
clearElement("antennaPhaseCenter_mm", 0);
657658

658659
checkElementValue("fixedEcefX", -7000000, 7000000, "Must be -7000000 to 7000000", "collapseBaseConfig");
659660
checkElementValue("fixedEcefY", -7000000, 7000000, "Must be -7000000 to 7000000", "collapseBaseConfig");
@@ -667,7 +668,7 @@ function validateFields() {
667668
checkLatLong(); //Verify Lat/Long input type
668669
checkElementValue("fixedAltitude", -11034, 8849, "Must be -11034 to 8849", "collapseBaseConfig");
669670

670-
checkElementValue("antennaHeight_mm", -15000, 15000, "Must be -15000 to 15000", "collapseBaseConfig");
671+
checkElementValue("antennaHeight_m", -15, 15, "Must be -15 to 15", "collapseBaseConfig");
671672
checkElementValue("antennaPhaseCenter_mm", -200.0, 200.0, "Must be -200.0 to 200.0", "collapseBaseConfig");
672673
}
673674
}
@@ -862,6 +863,7 @@ function changeProfile() {
862863
collapseSection("collapseEthernetConfig", "ethernetCaret");
863864
collapseSection("collapseNTPConfig", "ntpCaret");
864865
collapseSection("collapseFileManager", "fileManagerCaret");
866+
collapseSection("collapseInstrumentConfig", "instrumentCaret");
865867
}
866868
}
867869

@@ -1449,7 +1451,7 @@ document.addEventListener("DOMContentLoaded", (event) => {
14491451
adjustHAE();
14501452
});
14511453

1452-
ge("antennaHeight_mm").addEventListener("change", function () {
1454+
ge("antennaHeight_m").addEventListener("change", function () {
14531455
adjustHAE();
14541456
});
14551457

@@ -1620,7 +1622,7 @@ function addGeodetic() {
16201622
checkElementString("nicknameGeodetic", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
16211623
checkLatLong();
16221624
checkElementValue("fixedAltitude", -11034, 8849, "Must be -11034 to 8849", "collapseBaseConfig");
1623-
checkElementValue("antennaHeight_mm", -15000, 15000, "Must be -15000 to 15000", "collapseBaseConfig");
1625+
checkElementValue("antennaHeight_m", -15, 15, "Must be -15 to 15", "collapseBaseConfig");
16241626
checkElementValue("antennaPhaseCenter_mm", -200.0, 200.0, "Must be -200.0 to 200.0", "collapseBaseConfig");
16251627

16261628
if (errorCount == 0) {
@@ -1629,12 +1631,12 @@ function addGeodetic() {
16291631
for (; index < recordsGeodetic.length; ++index) {
16301632
var parts = recordsGeodetic[index].split(' ');
16311633
if (ge("nicknameGeodetic").value == parts[0]) {
1632-
recordsGeodetic[index] = nicknameGeodetic.value + ' ' + fixedLatText.value + ' ' + fixedLongText.value + ' ' + fixedAltitude.value + ' ' + antennaHeight_mm.value + ' ' + antennaPhaseCenter_mm.value;
1634+
recordsGeodetic[index] = nicknameGeodetic.value + ' ' + fixedLatText.value + ' ' + fixedLongText.value + ' ' + fixedAltitude.value + ' ' + antennaHeight_m.value + ' ' + antennaPhaseCenter_mm.value;
16331635
break;
16341636
}
16351637
}
16361638
if (index == recordsGeodetic.length)
1637-
recordsGeodetic.push(nicknameGeodetic.value + ' ' + fixedLatText.value + ' ' + fixedLongText.value + ' ' + fixedAltitude.value + ' ' + antennaHeight_mm.value + ' ' + antennaPhaseCenter_mm.value);
1639+
recordsGeodetic.push(nicknameGeodetic.value + ' ' + fixedLatText.value + ' ' + fixedLongText.value + ' ' + fixedAltitude.value + ' ' + antennaHeight_m.value + ' ' + antennaPhaseCenter_mm.value);
16381640
}
16391641

16401642
updateGeodeticList();
@@ -1660,13 +1662,13 @@ function adjustHAE() {
16601662
if (haeMethod == 1) {
16611663
ge("fixedHAEAPC").disabled = false;
16621664
ge("fixedAltitude").disabled = true;
1663-
hae = Number(ge("fixedHAEAPC").value) - (Number(ge("antennaHeight_mm").value) / 1000 + Number(ge("antennaPhaseCenter_mm").value) / 1000);
1665+
hae = Number(ge("fixedHAEAPC").value) - (Number(ge("antennaHeight_m").value) + Number(ge("antennaPhaseCenter_mm").value) / 1000);
16641666
ge("fixedAltitude").value = hae.toFixed(3);
16651667
}
16661668
else {
16671669
ge("fixedHAEAPC").disabled = true;
16681670
ge("fixedAltitude").disabled = false;
1669-
hae = Number(ge("fixedAltitude").value) + (Number(ge("antennaHeight_mm").value) / 1000 + Number(ge("antennaPhaseCenter_mm").value) / 1000);
1671+
hae = Number(ge("fixedAltitude").value) + (Number(ge("antennaHeight_m").value) + Number(ge("antennaPhaseCenter_mm").value) / 1000);
16701672
ge("fixedHAEAPC").value = hae.toFixed(3);
16711673
}
16721674
}
@@ -1692,7 +1694,7 @@ function loadGeodetic() {
16921694
}
16931695
}
16941696
ge("fixedAltitude").value = parts[numParts - 3];
1695-
ge("antennaHeight_mm").value = parts[numParts - 2];
1697+
ge("antennaHeight_m").value = parts[numParts - 2];
16961698
ge("antennaPhaseCenter_mm").value = parts[numParts - 1];
16971699

16981700
$("input[name=markRadio][value=1]").prop('checked', false);
@@ -1704,7 +1706,7 @@ function loadGeodetic() {
17041706
clearError("fixedLatText");
17051707
clearError("fixedLongText");
17061708
clearError("fixedAltitude");
1707-
clearError("antennaHeight_mm");
1709+
clearError("antennaHeight_m");
17081710
clearError("antennaPhaseCenter_mm");
17091711
}
17101712
else {

Firmware/RTK_Everywhere/menuCommands.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,13 @@ SettingValueResponse updateSettingWithValue(bool inCommands, const char *setting
11541154
knownSetting = true;
11551155
}
11561156

1157+
//Convert antenna in meters (from Web Config) to mm (internal settings)
1158+
else if (strcmp(settingName, "antennaHeight_m") == 0)
1159+
{
1160+
settings.antennaHeight_mm = settingValue * 1000;
1161+
knownSetting = true;
1162+
}
1163+
11571164
// Unused variables - read to avoid errors
11581165
else
11591166
{

0 commit comments

Comments
 (0)