Skip to content

Commit cc4b12c

Browse files
authored
Merge pull request #333 from sparkfun/release_candidate
Release v2.5 - Add TCP and extend AP config
2 parents db59b33 + 7f1f97a commit cc4b12c

30 files changed

+2410
-1010
lines changed

Firmware/RTK_Surveyor/AP-Config/index.html

Lines changed: 191 additions & 22 deletions
Large diffs are not rendered by default.

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

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ function ge(e) {
1010
}
1111

1212
var platformPrefix = "Surveyor";
13+
var geodeticLat = 40.01;
14+
var geodeticLon = -105.19;
15+
var geodeticAlt = 1500.1;
16+
var ecefX = 100;
17+
var ecefY = -100;
18+
var ecefZ = -200;
1319

1420
function parseIncoming(msg) {
1521
//console.log("incoming message: " + msg);
@@ -92,6 +98,7 @@ function parseIncoming(msg) {
9298
|| id.includes("profile5Name")
9399
|| id.includes("profile6Name")
94100
|| id.includes("profile7Name")
101+
|| id.includes("radioMAC")
95102
) {
96103
ge(id).innerHTML = val;
97104
}
@@ -105,6 +112,41 @@ function parseIncoming(msg) {
105112
else if (id.includes("firmwareUploadStatus")) {
106113
firmwareUploadStatus(val);
107114
}
115+
else if (id.includes("geodeticLat")) {
116+
geodeticLat = val;
117+
ge(id).innerHTML = val;
118+
}
119+
else if (id.includes("geodeticLon")) {
120+
geodeticLon = val;
121+
ge(id).innerHTML = val;
122+
}
123+
else if (id.includes("geodeticAlt")) {
124+
geodeticAlt = val;
125+
ge(id).innerHTML = val;
126+
}
127+
else if (id.includes("ecefX")) {
128+
ecefX = val;
129+
ge(id).innerHTML = val;
130+
}
131+
else if (id.includes("ecefY")) {
132+
ecefY = val;
133+
ge(id).innerHTML = val;
134+
}
135+
else if (id.includes("ecefZ")) {
136+
ecefZ = val;
137+
ge(id).innerHTML = val;
138+
}
139+
else if (id.includes("bluetoothRadioType")) {
140+
currentBtNumber = val;
141+
$("input[name=bluetoothRadioType][value=" + currentBtNumber + "]").prop('checked', true);
142+
}
143+
else if (id.includes("espnowPeerCount")) {
144+
if(val > 0)
145+
ge("peerMACs").innerHTML = "";
146+
}
147+
else if (id.includes("peerMAC")) {
148+
ge("peerMACs").innerHTML += val + "<br>";
149+
}
108150

109151
//Check boxes / radio buttons
110152
else if (val == "true") {
@@ -134,6 +176,7 @@ function parseIncoming(msg) {
134176
//console.log("Settings loaded");
135177

136178
ge("profileChangeMessage").innerHTML = '';
179+
ge("resetProfileMsg").innerHTML = '';
137180

138181
//Force element updates
139182
ge("measurementRateHz").dispatchEvent(new CustomEvent('change'));
@@ -147,6 +190,7 @@ function parseIncoming(msg) {
147190
ge("dataPortChannel").dispatchEvent(new CustomEvent('change'));
148191
ge("enableExternalPulse").dispatchEvent(new CustomEvent('change'));
149192
ge("enablePointPerfectCorrections").dispatchEvent(new CustomEvent('change'));
193+
ge("radioType").dispatchEvent(new CustomEvent('change'));
150194
}
151195

152196
function hide(id) {
@@ -215,6 +259,7 @@ function validateFields() {
215259
collapseSection("collapseSensorConfig", "sensorCaret");
216260
collapseSection("collapsePPConfig", "pointPerfectCaret");
217261
collapseSection("collapsePortsConfig", "portsCaret");
262+
collapseSection("collapseRadioConfig", "radioCaret");
218263
collapseSection("collapseSystemConfig", "systemCaret");
219264

220265
errorCount = 0;
@@ -350,6 +395,8 @@ function validateFields() {
350395
clearElement("fixedLat", 40.09029479);
351396
clearElement("fixedLong", -105.18505761);
352397
clearElement("fixedAltitude", 1560.089);
398+
clearElement("antennaHeight", 0);
399+
clearElement("antennaReferencePoint", 0);
353400
}
354401
else {
355402
clearElement("observationSeconds", 60);
@@ -372,6 +419,9 @@ function validateFields() {
372419
checkElementValue("fixedLat", -180, 180, "Must be -180 to 180", "collapseBaseConfig");
373420
checkElementValue("fixedLong", -180, 180, "Must be -180 to 180", "collapseBaseConfig");
374421
checkElementValue("fixedAltitude", -11034, 8849, "Must be -11034 to 8849", "collapseBaseConfig");
422+
423+
checkElementValue("antennaHeight", -15000, 15000, "Must be -15000 to 15000", "collapseBaseConfig");
424+
checkElementValue("antennaReferencePoint", -200.0, 200.0, "Must be -200.0 to 200.0", "collapseBaseConfig");
375425
}
376426
}
377427

@@ -553,7 +603,7 @@ function clearElement(id, value) {
553603
}
554604

555605
function resetToFactoryDefaults() {
556-
ge("factoryDefaultsMsg").innerHTML = "Defaults Applied. Please wait for device reset..."
606+
ge("factoryDefaultsMsg").innerHTML = "Defaults Applied. Please wait for device reset...";
557607
ws.send("factoryDefaultReset,1,");
558608
}
559609

@@ -669,6 +719,16 @@ function resetToLoggingDefaults() {
669719
ge("UBX_RXM_RAWX").value = 1;
670720
ge("UBX_RXM_SFRBX").value = 1;
671721
}
722+
function useECEFCoordinates() {
723+
ge("fixedEcefX").value = ecefX;
724+
ge("fixedEcefY").value = ecefY;
725+
ge("fixedEcefZ").value = ecefZ;
726+
}
727+
function useGeodeticCoordinates() {
728+
ge("fixedLat").value = geodeticLat;
729+
ge("fixedLong").value = geodeticLon;
730+
ge("fixedAltitude").value = geodeticAlt;
731+
}
672732

673733
function exitConfig() {
674734
show("exitPage");
@@ -689,6 +749,17 @@ function firmwareUploadComplete() {
689749
hide("mainPage");
690750
}
691751

752+
function forgetPairedRadios() {
753+
ge("btnForgetRadiosMsg").innerHTML = "All radios forgotten.";
754+
ge("peerMACs").innerHTML = "None";
755+
ws.send("forgetEspNowPeers,1,");
756+
}
757+
758+
function btnResetProfile() {
759+
ge("resetProfileMsg").innerHTML = "Resetting profile.";
760+
ws.send("resetProfile,1,");
761+
}
762+
692763
document.addEventListener("DOMContentLoaded", (event) => {
693764

694765
var radios = document.querySelectorAll('input[name=profileRadio]');
@@ -812,6 +883,24 @@ document.addEventListener("DOMContentLoaded", (event) => {
812883
}
813884
});
814885

886+
ge("radioType").addEventListener("change", function () {
887+
if (ge("radioType").value == 0) {
888+
hide("radioDetails");
889+
}
890+
else if (ge("radioType").value == 1){
891+
show("radioDetails");
892+
}
893+
});
894+
895+
ge("enableForgetRadios").addEventListener("change", function () {
896+
if (ge("enableForgetRadios").checked) {
897+
ge("btnForgetRadios").disabled = false;
898+
}
899+
else {
900+
ge("btnForgetRadios").disabled = true;
901+
}
902+
});
903+
815904
ge("enableLogging").addEventListener("change", function () {
816905
if (ge("enableLogging").checked) {
817906
show("enableLoggingDetails");
@@ -820,5 +909,4 @@ document.addEventListener("DOMContentLoaded", (event) => {
820909
hide("enableLoggingDetails");
821910
}
822911
});
823-
824912
})

Firmware/RTK_Surveyor/Base.ino

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ bool beginSurveyIn()
113113
return (false);
114114
}
115115

116-
Serial.printf("Survey started. This will run until %d seconds have passed and less than %0.03f meter accuracy is achieved.\n\r",
116+
Serial.printf("Survey started. This will run until %d seconds have passed and less than %0.03f meter accuracy is achieved.\r\n",
117117
settings.observationSeconds,
118118
settings.observationPositionAccuracy
119119
);
@@ -173,9 +173,9 @@ bool startFixedBase()
173173
long majorEcefZ = floor((settings.fixedEcefZ * 100) + 0.5);
174174
long minorEcefZ = floor((((settings.fixedEcefZ * 100.0) - majorEcefZ) * 100.0) + 0.5);
175175

176-
// Serial.printf("fixedEcefY (should be -4716808.5807): %0.04f\n\r", settings.fixedEcefY);
177-
// Serial.printf("major (should be -471680858): %ld\n\r", majorEcefY);
178-
// Serial.printf("minor (should be -7): %ld\n\r", minorEcefY);
176+
// Serial.printf("fixedEcefY (should be -4716808.5807): %0.04f\r\n", settings.fixedEcefY);
177+
// Serial.printf("major (should be -471680858): %ld\r\n", majorEcefY);
178+
// Serial.printf("minor (should be -7): %ld\r\n", minorEcefY);
179179

180180
//Units are cm with a high precision extension so -1234.5678 should be called: (-123456, -78)
181181
//-1280208.308,-4716803.847,4086665.811 is SparkFun HQ so...
@@ -188,26 +188,31 @@ bool startFixedBase()
188188
}
189189
else if (settings.fixedBaseCoordinateType == COORD_TYPE_GEODETIC)
190190
{
191+
//Add height of instrument (HI) to fixed altitude
192+
//https://www.e-education.psu.edu/geog862/node/1853
193+
//For example, if HAE is at 100.0m, + 2m stick + 73mm ARP = 102.073
194+
float totalFixedAltitude = settings.fixedAltitude + (settings.antennaHeight / 1000.0) + (settings.antennaReferencePoint / 1000.0);
195+
191196
//Break coordinates into main and high precision parts
192197
//The type casting should not effect rounding of original double cast coordinate
193198
int64_t majorLat = settings.fixedLat * 10000000;
194199
int64_t minorLat = ((settings.fixedLat * 10000000) - majorLat) * 100;
195200
int64_t majorLong = settings.fixedLong * 10000000;
196201
int64_t minorLong = ((settings.fixedLong * 10000000) - majorLong) * 100;
197-
int32_t majorAlt = settings.fixedAltitude * 100;
198-
int32_t minorAlt = ((settings.fixedAltitude * 100) - majorAlt) * 100;
202+
int32_t majorAlt = totalFixedAltitude * 100;
203+
int32_t minorAlt = ((totalFixedAltitude * 100) - majorAlt) * 100;
199204

200-
// Serial.printf("fixedLong (should be -105.184774720): %0.09f\n\r", settings.fixedLong);
201-
// Serial.printf("major (should be -1051847747): %lld\n\r", majorLat);
202-
// Serial.printf("minor (should be -20): %lld\n\r", minorLat);
205+
// Serial.printf("fixedLong (should be -105.184774720): %0.09f\r\n", settings.fixedLong);
206+
// Serial.printf("major (should be -1051847747): %lld\r\n", majorLat);
207+
// Serial.printf("minor (should be -20): %lld\r\n", minorLat);
203208
//
204-
// Serial.printf("fixedLat (should be 40.090335429): %0.09f\n\r", settings.fixedLat);
205-
// Serial.printf("major (should be 400903354): %lld\n\r", majorLong);
206-
// Serial.printf("minor (should be 29): %lld\n\r", minorLong);
209+
// Serial.printf("fixedLat (should be 40.090335429): %0.09f\r\n", settings.fixedLat);
210+
// Serial.printf("major (should be 400903354): %lld\r\n", majorLong);
211+
// Serial.printf("minor (should be 29): %lld\r\n", minorLong);
207212
//
208-
// Serial.printf("fixedAlt (should be 1560.2284): %0.04f\n\r", settings.fixedAltitude);
209-
// Serial.printf("major (should be 156022): %ld\n\r", majorAlt);
210-
// Serial.printf("minor (should be 84): %ld\n\r", minorAlt);
213+
// Serial.printf("fixedAlt (should be 1560.2284): %0.04f\r\n", settings.fixedAltitude);
214+
// Serial.printf("major (should be 156022): %ld\r\n", majorAlt);
215+
// Serial.printf("minor (should be 84): %ld\r\n", minorAlt);
211216

212217
response = i2cGNSS.setStaticPosition(
213218
majorLat, minorLat,
@@ -230,13 +235,9 @@ void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
230235
{
231236
if (rtcmPacketsSent > 99) rtcmPacketsSent = 1; //Trim to two digits to avoid overlap
232237
}
233-
else if (logIncreasing == true)
234-
{
235-
if (rtcmPacketsSent > 999) rtcmPacketsSent = 1; //Trim to three digits to avoid log icon
236-
}
237238
else
238239
{
239-
if (rtcmPacketsSent > 9999) rtcmPacketsSent = 1;
240+
if (rtcmPacketsSent > 999) rtcmPacketsSent = 1; //Trim to three digits to avoid log icon and increasing bar
240241
}
241242

242243
//Determine if we should check this byte with the RTCM checker or simply pass it along

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,29 @@ void beginBoard()
148148
btMACAddress[5] += 2; //Convert MAC address to Bluetooth MAC (add 2): https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system.html#mac-address
149149

150150
//For all boards, check reset reason. If reset was due to wdt or panic, append last log
151-
loadSettingsPartial(); //Get resetCount
151+
loadSettingsPartial(); //Loads settings from LFS
152152
if (esp_reset_reason() == ESP_RST_POWERON)
153153
{
154154
reuseLastLog = false; //Start new log
155+
156+
if (settings.enableResetDisplay == true)
157+
{
158+
settings.resetCount = 0;
159+
recordSystemSettingsToFileLFS(settingsFileName); //Avoid overwriting LittleFS settings onto SD
160+
}
155161
settings.resetCount = 0;
156162
}
157163
else
158164
{
159165
reuseLastLog = true; //Attempt to reuse previous log
160-
settings.resetCount++;
161166

167+
if (settings.enableResetDisplay == true)
168+
{
169+
settings.resetCount++;
170+
Serial.printf("resetCount: %d\r\n", settings.resetCount);
171+
recordSystemSettingsToFileLFS(settingsFileName); //Avoid overwriting LittleFS settings onto SD
172+
}
173+
162174
Serial.print("Reset reason: ");
163175
switch (esp_reset_reason())
164176
{
@@ -175,8 +187,6 @@ void beginBoard()
175187
default : Serial.println("Unknown");
176188
}
177189
}
178-
179-
recordSystemSettings(); //Record resetCount to NVM
180190
}
181191

182192
void beginSD()
@@ -445,7 +455,7 @@ void beginGNSS()
445455
zedFirmwareVersionInt = 132;
446456
else
447457
{
448-
Serial.printf("Unknown firmware version: %s\n\r", zedFirmwareVersion);
458+
Serial.printf("Unknown firmware version: %s\r\n", zedFirmwareVersion);
449459
zedFirmwareVersionInt = 99; //0.99 invalid firmware version
450460
}
451461

@@ -456,7 +466,7 @@ void beginGNSS()
456466
zedModuleType = PLATFORM_F9R;
457467
else
458468
{
459-
Serial.printf("Unknown ZED module: %s\n\r", i2cGNSS.minfo.extension[3]);
469+
Serial.printf("Unknown ZED module: %s\r\n", i2cGNSS.minfo.extension[3]);
460470
zedModuleType = PLATFORM_F9P;
461471
}
462472

Firmware/RTK_Surveyor/Bluetooth.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Bluetooth States:
2727
// Locals - compiled out
2828
//----------------------------------------
2929

30-
#ifdef COMPILE_BT
30+
#ifdef COMPILE_BT
3131
BTSerialInterface *bluetoothSerial;
3232
static volatile byte bluetoothState = BT_OFF;
3333

0 commit comments

Comments
 (0)