Skip to content

Commit c1dba1c

Browse files
authored
Merge pull request #258 from sparkfun/release_candidate
Add circular buffer and better RAM handling
2 parents b258637 + 1d5a341 commit c1dba1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+7451
-3008
lines changed
1.9 MB
Binary file not shown.

Firmware/RTK_Surveyor/AP-Config/index.html

Lines changed: 96 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,96 @@ <h2>
8787
<div align="center" class="small">
8888
<span id="rtkFirmwareVersion" style="display:inline;">RTK Firmware: v0.0</span> <br>
8989
<span id="zedFirmwareVersion" style="display:inline;">ZED-F9P Firmware: v0.0</span> <br>
90-
<span id="profileName" style="display:inline;">Profile Name: Default</span>
9190
</div>
9291
</div>
9392

9493
<hr class="mt-0">
9594
<div style="margin-top:20px;">
95+
96+
<!-- --------- Profile Config --------- -->
97+
<div class="d-grid gap-2">
98+
<button class="btn btn-primary toggle-btn" id="profileConfig" type="button" data-toggle="collapse"
99+
data-target="#collapseProfileConfig" aria-expanded="false" aria-controls="collapseProfileConfig">
100+
Profile Configuration <i id="profileCaret" class="caret-icon bi icon-caret-down"></i>
101+
</button>
102+
</div>
103+
<div class="collapse mb-2" id="collapseProfileConfig">
104+
<div class="card card-body">
105+
106+
<div class="form-group mt-2">
107+
Profile:
108+
<span class="tt" data-bs-placement="right"
109+
title="Select a profile and then assign settings to that profile. At reset, RTK device will use selected profile. Profile changes are saved when a different profile is selected or when 'Save Configuration' is pressed.">
110+
<span class="icon-info-circle text-primary ms-2"></span>
111+
</span>
112+
</div>
113+
114+
<div class="form-group row">
115+
<span style="display:inline; margin-left:20px;">
116+
<input type="radio" name="profileRadio" value="0">
117+
<label id="profile0Name">Profile1</label>
118+
</span>
119+
</div>
120+
<div class="form-group row">
121+
<span style="display:inline; margin-left:20px;">
122+
<input type="radio" name="profileRadio" value="1">
123+
<label id="profile1Name">12345678901234567890123456789012345678901234567890</label>
124+
</span>
125+
</div>
126+
<div class="form-group row">
127+
<span style="display:inline; margin-left:20px;">
128+
<input type="radio" name="profileRadio" value="2">
129+
<label id="profile2Name">12345678901234567890123456789012345678901234567890</label>
130+
</span>
131+
</div>
132+
<div class="form-group row">
133+
<span style="display:inline; margin-left:20px;">
134+
<input type="radio" name="profileRadio" value="3">
135+
<label id="profile3Name">12345678901234567890123456789012345678901234567890</label>
136+
</span>
137+
</div>
138+
<div class="form-group row">
139+
<span style="display:inline; margin-left:20px;">
140+
<input type="radio" name="profileRadio" value="4">
141+
<label id="profile4Name">12345678901234567890123456789012345678901234567890</label>
142+
</span>
143+
</div>
144+
<div class="form-group row">
145+
<span style="display:inline; margin-left:20px;">
146+
<input type="radio" name="profileRadio" value="5">
147+
<label id="profile5Name">12345678901234567890123456789012345678901234567890</label>
148+
</span>
149+
</div>
150+
<div class="form-group row">
151+
<span style="display:inline; margin-left:20px;">
152+
<input type="radio" name="profileRadio" value="6">
153+
<label id="profile6Name">12345678901234567890123456789012345678901234567890</label>
154+
</span>
155+
</div>
156+
<div class="form-group row">
157+
<span style="display:inline; margin-left:20px;">
158+
<input type="radio" name="profileRadio" value="7">
159+
<label id="profile7Name">12345678901234567890123456789012345678901234567890</label>
160+
</span>
161+
</div>
162+
163+
<div class="form-group row">
164+
<label for="profileName" class="box-margin20 col-sm-3 col-4 col-form-label">Profile Name:</label>
165+
<div class="col-sm-8 col-7">
166+
<input type="text" class="form-control" id="profileName">
167+
<p id="profileNameError" class="inlineError"></p>
168+
</div>
169+
<p id="profileChangeMessage" class="inlineSuccess"></p>
170+
</div>
171+
172+
</div>
173+
</div>
174+
96175
<!-- --------- GNSS Config --------- -->
97176
<div class="d-grid gap-2">
98-
<button class="btn btn-primary toggle-btn" type="button" data-toggle="collapse"
177+
<button class="btn btn-primary mt-3 toggle-btn" type="button" data-toggle="collapse"
99178
data-target="#collapseGNSSConfig" aria-expanded="false" aria-controls="collapseGNSSConfig">
100-
GNSS Configuration <i class="caret-icon bi icon-caret-up"></i>
179+
GNSS Configuration <i id="gnssCaret" class="caret-icon bi icon-caret-up"></i>
101180
</button>
102181
</div>
103182
<div class="collapse show" id="collapseGNSSConfig">
@@ -265,8 +344,8 @@ <h2>
265344
<input type="text" class="form-control" id="ntripClient_MountPointPW">
266345
<p id="ntripClient_MountPointPWError" class="inlineError"></p>
267346
</div>
268-
</div>
269-
347+
</div>
348+
270349
<div class="form-check mt-1 box-margin20">
271350
<label class="form-check-label" for="ntripClient_TransmitGGA">Transmit GGA to Caster</label>
272351
<input class="form-check-input" type="checkbox" value="" id="ntripClient_TransmitGGA" unchecked>
@@ -276,12 +355,12 @@ <h2>
276355
</span>
277356
</div>
278357
</div>
279-
358+
280359
<div id="messageRateButton">
281360
<button class="btn btn-md btn-outline-primary mt-3 toggle-btn" type="button"
282361
data-toggle="collapse" data-target="#collapseGNSSConfigMsg" aria-expanded="false"
283362
aria-controls="collapseGNSSConfigMsg">
284-
Message Rates <i class="caret-icon bi icon-caret-down"></i>
363+
Message Rates <i id="gnssMsgCaret" class="caret-icon bi icon-caret-down"></i>
285364
</button>
286365
<span class="tt" data-bs-placement="right"
287366
title="NMEA and RAWX are the two most commonly reported types of message but the receiver supports more than 70 different messages. Each message rate input controls which messages are disabled (0) and how often the message is reported (1 = one message reported per 1 fix, 5 = one report every 5 fixes). Default: NMEA GGA, GSA, GST, GSV, and RMC. Limits: 0 to 20.">
@@ -846,15 +925,15 @@ <h2>
846925
<div class="d-grid gap-2">
847926
<button class="btn btn-primary mt-3 toggle-btn" id="baseConfig" type="button" data-toggle="collapse"
848927
data-target="#collapseBaseConfig" aria-expanded="false" aria-controls="collapseBaseConfig">
849-
Base Configuration <i class="caret-icon bi icon-caret-down"></i>
928+
Base Configuration <i id="baseCaret" class="caret-icon bi icon-caret-down"></i>
850929
</button>
851930
</div>
852931
<div class="collapse" id="collapseBaseConfig">
853932
<div class="card card-body">
854933

855934
<div id="surveyInRadio">
856935
<input type="radio" id="baseTypeSurveyIn" name="baseType" class="form-radio" checked>
857-
<label for="baseTypeSurveyIn"><strong>Survey-In</strong></label>
936+
<label for="baseTypeSurveyIn">Survey-In</label>
858937
<span class="tt" data-bs-placement="right"
859938
title="If the precise location of a base station is not known it may be obtained by ‘surveying’ the location. The base is fixed in one place and takes approximately 60 seconds worth of readings to obtain a best fit location based on the measurements. This method achieves ~30cm accurate position but can vary. Increasing the Minimum Observation Time and/or Required Mean Deviation will increase accuracy but only to a point. Better accuracy is achieved with long-term logging and post processing. Default: 60s and 5.0m. Limits: 60 to 900s, 1.0 to 5.0m.">
860939
<span class="icon-info-circle text-primary ms-2"></span>
@@ -884,7 +963,7 @@ <h2>
884963

885964
<div id="fixedRadio">
886965
<input type="radio" id="baseTypeFixed" name="baseType" value="1" class="form-radio">
887-
<label for="baseTypeFixed"><strong>Fixed</strong> <span class="small">(Choose ECEF or
966+
<label for="baseTypeFixed">Fixed<span class="small">(Choose ECEF or
888967
Geodetic)</span></label>
889968
<span class="tt" data-bs-placement="right"
890969
title="If the location of the base is known it can be entered in either ECEF or Geodetic coordinates. In this mode the receiver will immediately begin outputting RTCM correction data. A fixed position is best obtained with PPP (please see our tutorial) or with post processing against a reference station. Default: SparkFun's location in Boulder, Colorado.">
@@ -1055,7 +1134,7 @@ <h2>
10551134
<div class="d-grid gap-2">
10561135
<button class="btn btn-primary mt-3 toggle-btn" id="sensorConfig" type="button" data-toggle="collapse"
10571136
data-target="#collapseSensorConfig" aria-expanded="false" aria-controls="collapseSensorConfig">
1058-
Sensor Configuration <i class="caret-icon bi icon-caret-down"></i>
1137+
Sensor Configuration <i id="sensorCaret" class="caret-icon bi icon-caret-down"></i>
10591138
</button>
10601139
</div>
10611140
<div class="collapse" id="collapseSensorConfig">
@@ -1083,7 +1162,7 @@ <h2>
10831162
<div class="d-grid gap-2">
10841163
<button class="btn btn-primary mt-3 toggle-btn" id="ppConfig" type="button" data-toggle="collapse"
10851164
data-target="#collapsePPConfig" aria-expanded="false" aria-controls="collapsePPConfig">
1086-
PointPerfect Configuration <i class="caret-icon bi icon-caret-down"></i>
1165+
PointPerfect Configuration <i id="pointPerfectCaret" class="caret-icon bi icon-caret-down"></i>
10871166
</button>
10881167
</div>
10891168
<div class="collapse" id="collapsePPConfig">
@@ -1149,12 +1228,12 @@ <h2>
11491228
</div>
11501229
</div>
11511230
</div>
1152-
1231+
11531232
<!-- --------- Ports Config --------- -->
11541233
<div class="d-grid gap-2">
11551234
<button class="btn btn-primary mt-3 toggle-btn" type="button" data-toggle="collapse"
11561235
data-target="#collapsePortsConfig" aria-expanded="false" aria-controls="collapsePortsConfig">
1157-
Ports Configuration <i class="caret-icon bi icon-caret-down"></i>
1236+
Ports Configuration <i id="portsCaret" class="caret-icon bi icon-caret-down"></i>
11581237
</button>
11591238
</div>
11601239
<div class="collapse" id="collapsePortsConfig">
@@ -1270,7 +1349,7 @@ <h2>
12701349
<div class="d-grid gap-2">
12711350
<button class="btn btn-primary mt-3 toggle-btn" type="button" data-toggle="collapse"
12721351
data-target="#collapseSystemConfig" aria-expanded="false" aria-controls="collapseSystemConfig">
1273-
System Configuration <i class="caret-icon bi icon-caret-down"></i>
1352+
System Configuration <i id="systemCaret" class="caret-icon bi icon-caret-down"></i>
12741353
</button>
12751354
</div>
12761355
<div class="collapse" id="collapseSystemConfig">
@@ -1374,7 +1453,7 @@ <h2>
13741453
<hr>
13751454
<div class="row">
13761455
<div align="center" class="col-sm-5 offset-sm-1 col-12 offset-0 mb-2">
1377-
<button type="button" id="saveBtn" class="btn btn-secondary" onclick="validateFields()">Save
1456+
<button type="button" id="saveBtn" class="btn btn-secondary" onclick="saveConfig()">Save
13781457
Configuration <span class="icon-save ms-1"></span></button>
13791458
<p id="saveBtnError" class="inlineError"></p>
13801459
<p id="saveBtnSuccess" class="inlineSuccess"></p>
@@ -1397,4 +1476,4 @@ <h2>
13971476
</script>
13981477
</body>
13991478

1400-
</html>
1479+
</html>

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

Lines changed: 96 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,23 @@ function parseIncoming(msg) {
8282
|| id.includes("sdUsedSpace")
8383
|| id.includes("rtkFirmwareVersion")
8484
|| id.includes("zedFirmwareVersion")
85-
|| id.includes("profileName")
8685
|| id.includes("hardwareID")
8786
|| id.includes("daysRemaining")
87+
|| id.includes("profile0Name")
88+
|| id.includes("profile1Name")
89+
|| id.includes("profile2Name")
90+
|| id.includes("profile3Name")
91+
|| id.includes("profile4Name")
92+
|| id.includes("profile5Name")
93+
|| id.includes("profile6Name")
94+
|| id.includes("profile7Name")
8895
) {
8996
ge(id).innerHTML = val;
9097
}
98+
else if (id.includes("profileNumber")) {
99+
currentProfileNumber = val;
100+
$("input[name=profileRadio][value=" + currentProfileNumber + "]").prop('checked', true);
101+
}
91102
else if (id.includes("firmwareUploadComplete")) {
92103
firmwareUploadComplete();
93104
}
@@ -122,6 +133,8 @@ function parseIncoming(msg) {
122133
}
123134
//console.log("Settings loaded");
124135

136+
ge("profileChangeMessage").innerHTML = '';
137+
125138
//Force element updates
126139
ge("measurementRateHz").dispatchEvent(new CustomEvent('change'));
127140
ge("baseTypeSurveyIn").dispatchEvent(new CustomEvent('change'));
@@ -186,18 +199,29 @@ function checkMessageValue(id) {
186199
checkElementValue(id, 0, 20, "Must be between 0 and 20", "collapseGNSSConfigMsg");
187200
}
188201

202+
function collapseSection(section, caret) {
203+
ge(section).classList.remove('show');
204+
ge(caret).classList.remove('icon-caret-down');
205+
ge(caret).classList.remove('icon-caret-up');
206+
ge(caret).classList.add('icon-caret-down');
207+
}
208+
189209
function validateFields() {
190210
//Collapse all sections
191-
ge("collapseGNSSConfig").classList.remove('show');
192-
ge("collapseGNSSConfigMsg").classList.remove('show');
193-
ge("collapseBaseConfig").classList.remove('show');
194-
ge("collapseSensorConfig").classList.remove('show');
195-
ge("collapsePPConfig").classList.remove('show');
196-
ge("collapsePortsConfig").classList.remove('show');
197-
ge("collapseSystemConfig").classList.remove('show');
211+
collapseSection("collapseProfileConfig", "profileCaret");
212+
collapseSection("collapseGNSSConfig", "gnssCaret");
213+
collapseSection("collapseGNSSConfigMsg", "gnssMsgCaret");
214+
collapseSection("collapseBaseConfig", "baseCaret");
215+
collapseSection("collapseSensorConfig", "sensorCaret");
216+
collapseSection("collapsePPConfig", "pointPerfectCaret");
217+
collapseSection("collapsePortsConfig", "portsCaret");
218+
collapseSection("collapseSystemConfig", "systemCaret");
198219

199220
errorCount = 0;
200221

222+
//Profile Config
223+
checkElementString("profileName", 1, 49, "Must be 1 to 49 characters", "collapseProfileConfig");
224+
201225
//GNSS Config
202226
checkElementValue("measurementRateHz", 0.00012, 10, "Must be between 0.00012 and 10Hz", "collapseGNSSConfig");
203227
checkConstellations();
@@ -378,7 +402,7 @@ function validateFields() {
378402
if(ge("enablePointPerfectCorrections").checked == true) {
379403
checkElementString("home_wifiSSID", 1, 30, "Must be 1 to 30 characters", "collapsePPConfig");
380404
checkElementString("home_wifiPW", 0, 30, "Must be 0 to 30 characters", "collapsePPConfig");
381-
405+
382406
value = ge("pointPerfectDeviceProfileToken").value;
383407
console.log(value);
384408
if (value.length > 0)
@@ -415,6 +439,47 @@ function validateFields() {
415439
ge("externalPulsePolarity").value = 0;
416440
}
417441
}
442+
}
443+
444+
var currentProfileNumber = 0;
445+
446+
function changeConfig() {
447+
validateFields();
448+
449+
if (errorCount == 1) {
450+
showError('saveBtn', "Please clear " + errorCount + " error");
451+
clearSuccess('saveBtn');
452+
$("input[name=profileRadio][value=" + currentProfileNumber + "]").prop('checked', true);
453+
}
454+
else if (errorCount > 1) {
455+
showError('saveBtn', "Please clear " + errorCount + " errors");
456+
clearSuccess('saveBtn');
457+
$("input[name=profileRadio][value=" + currentProfileNumber + "]").prop('checked', true);
458+
}
459+
else {
460+
ge("profileChangeMessage").innerHTML = 'Loading. Please wait...';
461+
462+
currentProfileNumber = document.querySelector('input[name=profileRadio]:checked').value;
463+
464+
sendData();
465+
clearError('saveBtn');
466+
showSuccess('saveBtn', "All saved!");
467+
468+
ws.send("setProfile," + currentProfileNumber + ",");
469+
470+
ge("collapseProfileConfig").classList.add('show');
471+
ge("collapseGNSSConfig").classList.add('show');
472+
collapseSection("collapseGNSSConfigMsg", "gnssMsgCaret");
473+
collapseSection("collapseBaseConfig", "baseCaret");
474+
collapseSection("collapseSensorConfig", "sensorCaret");
475+
collapseSection("collapsePPConfig", "pointPerfectCaret");
476+
collapseSection("collapsePortsConfig", "portsCaret");
477+
collapseSection("collapseSystemConfig", "systemCaret");
478+
}
479+
}
480+
481+
function saveConfig() {
482+
validateFields();
418483

419484
if (errorCount == 1) {
420485
showError('saveBtn', "Please clear " + errorCount + " error");
@@ -430,6 +495,7 @@ function validateFields() {
430495
clearError('saveBtn');
431496
showSuccess('saveBtn', "All saved!");
432497
}
498+
433499
}
434500

435501
function checkConstellations() {
@@ -446,6 +512,19 @@ function checkConstellations() {
446512
clearError("ubxConstellations");
447513
}
448514

515+
function checkBitMapValue(id, min, max, bitMap, errorText, collapseID) {
516+
value = ge(id).value;
517+
mask = ge(bitMap).value;
518+
if ((value < min) || (value > max) || ((mask & (1 << value)) == 0)) {
519+
ge(id + 'Error').innerHTML = 'Error: ' + errorText;
520+
ge(collapseID).classList.add('show');
521+
errorCount++;
522+
}
523+
else {
524+
clearError(id);
525+
}
526+
}
527+
449528
function checkElementValue(id, min, max, errorText, collapseID) {
450529
value = ge(id).value;
451530
if (value < min || value > max) {
@@ -613,6 +692,13 @@ function firmwareUploadComplete() {
613692

614693
document.addEventListener("DOMContentLoaded", (event) => {
615694

695+
var radios = document.querySelectorAll('input[name=profileRadio]');
696+
for(var i = 0, max = radios.length; i < max; i++) {
697+
radios[i].onclick = function() {
698+
changeConfig();
699+
}
700+
}
701+
616702
ge("measurementRateHz").addEventListener("change", function () {
617703
ge("measurementRateSec").value = 1.0 / ge("measurementRateHz").value;
618704
});
@@ -736,4 +822,4 @@ document.addEventListener("DOMContentLoaded", (event) => {
736822
}
737823
});
738824

739-
})
825+
})

0 commit comments

Comments
 (0)