Skip to content

Commit 0728416

Browse files
committed
2 parents 2c7dc56 + 9d3ddcc commit 0728416

File tree

19 files changed

+421
-128
lines changed

19 files changed

+421
-128
lines changed

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,8 @@ function useGeodeticCoordinates() {
846846
ge("fixedLat").value = geodeticLat;
847847
ge("fixedLong").value = geodeticLon;
848848
ge("fixedAltitude").value = geodeticAlt;
849+
var hae = Number(ge("fixedAltitude").value) + Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000
850+
ge("fixedHAE_APC").value = hae.toFixed(3);
849851
}
850852

851853
function startNewLog() {
@@ -1061,15 +1063,18 @@ document.addEventListener("DOMContentLoaded", (event) => {
10611063
});
10621064

10631065
ge("fixedAltitude").addEventListener("change", function () {
1064-
ge("fixedHAE_APC").value = Number(ge("fixedAltitude").value) + Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000;
1066+
var hae = Number(ge("fixedAltitude").value) + Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000;
1067+
ge("fixedHAE_APC").value = hae.toFixed(3);
10651068
});
10661069

10671070
ge("antennaHeight").addEventListener("change", function () {
1068-
ge("fixedHAE_APC").value = Number(ge("fixedAltitude").value) + Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000;
1071+
var hae = Number(ge("fixedAltitude").value) + Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000;
1072+
ge("fixedHAE_APC").value = hae.toFixed(3);
10691073
});
10701074

10711075
ge("antennaReferencePoint").addEventListener("change", function () {
1072-
ge("fixedHAE_APC").value = Number(ge("fixedAltitude").value) + Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000;
1076+
var hae = Number(ge("fixedAltitude").value) + Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000;
1077+
ge("fixedHAE_APC").value = hae.toFixed(3);
10731078
});
10741079
})
10751080

@@ -1160,19 +1165,21 @@ function addGeodetic() {
11601165
checkElementValue("fixedLat", -180, 180, "Must be -180 to 180", "collapseBaseConfig");
11611166
checkElementValue("fixedLong", -180, 180, "Must be -180 to 180", "collapseBaseConfig");
11621167
checkElementValue("fixedAltitude", -11034, 8849, "Must be -11034 to 8849", "collapseBaseConfig");
1168+
checkElementValue("antennaHeight", -15000, 15000, "Must be -15000 to 15000", "collapseBaseConfig");
1169+
checkElementValue("antennaReferencePoint", -200.0, 200.0, "Must be -200.0 to 200.0", "collapseBaseConfig");
11631170

11641171
if (errorCount == 0) {
11651172
//Check name against the list
11661173
var index = 0;
11671174
for (; index < recordsGeodetic.length; ++index) {
11681175
var parts = recordsGeodetic[index].split(' ');
11691176
if (ge("nicknameGeodetic").value == parts[0]) {
1170-
recordsGeodetic[index] = nicknameGeodetic.value + ' ' + fixedLat.value + ' ' + fixedLong.value + ' ' + fixedAltitude.value;
1177+
recordsGeodetic[index] = nicknameGeodetic.value + ' ' + fixedLat.value + ' ' + fixedLong.value + ' ' + fixedAltitude.value + ' ' + antennaHeight.value + ' ' + antennaReferencePoint.value;
11711178
break;
11721179
}
11731180
}
11741181
if (index == recordsGeodetic.length)
1175-
recordsGeodetic.push(nicknameGeodetic.value + ' ' + fixedLat.value + ' ' + fixedLong.value + ' ' + fixedAltitude.value);
1182+
recordsGeodetic.push(nicknameGeodetic.value + ' ' + fixedLat.value + ' ' + fixedLong.value + ' ' + fixedAltitude.value + ' ' + antennaHeight.value + ' ' + antennaReferencePoint.value);
11761183
}
11771184

11781185
updateGeodeticList();
@@ -1189,14 +1196,19 @@ function loadGeodetic() {
11891196
var val = ge("StationCoordinatesGeodetic").value;
11901197
if (val > "") {
11911198
var parts = recordsGeodetic[val].split(' ');
1199+
ge("nicknameGeodetic").value = parts[0];
11921200
ge("fixedLat").value = parts[1];
11931201
ge("fixedLong").value = parts[2];
11941202
ge("fixedAltitude").value = parts[3];
1195-
ge("nicknameGeodetic").value = parts[0];
1203+
ge("antennaHeight").value = parts[4];
1204+
ge("antennaReferencePoint").value = parts[5];
1205+
1206+
clearError("nicknameGeodetic");
11961207
clearError("fixedLat");
11971208
clearError("fixedLong");
11981209
clearError("fixedAltitude");
1199-
clearError("nicknameGeodetic");
1210+
clearError("antennaHeight");
1211+
clearError("antennaReferencePoint");
12001212
}
12011213
}
12021214

@@ -1216,7 +1228,6 @@ function updateGeodeticList() {
12161228
}
12171229

12181230
for (let index = 0; index < recordsGeodetic.length; ++index) {
1219-
12201231
var option = document.createElement('option');
12211232
option.text = recordsGeodetic[index];
12221233
option.value = index;
@@ -1284,6 +1295,10 @@ function fileManagerToggle() {
12841295
function fileManagerDelete() {
12851296
selectedFiles = document.querySelectorAll('input[name=fileID]:checked');
12861297

1298+
if (confirm("Delete " + selectedFiles.length + " files?") == false) {
1299+
return;
1300+
}
1301+
12871302
for (let x = 0; x < selectedFiles.length; x++) {
12881303
var urltocall = "/file?name=" + selectedFiles[x].id + "&action=delete";
12891304
xmlhttp = new XMLHttpRequest();

Firmware/RTK_Surveyor/Bluetooth.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ bool bluetoothRxDataAvailable()
109109
int bluetoothWrite(const uint8_t *buffer, int length)
110110
{
111111
#ifdef COMPILE_BT
112-
return bluetoothSerial->write(buffer, length);
112+
//BLE write does not handle 0 length requests correctly
113+
if(length > 0)
114+
return bluetoothSerial->write(buffer, length);
115+
else
116+
return 0;
113117
#else //COMPILE_BT
114118
return 0;
115119
#endif //COMPILE_BT

Firmware/RTK_Surveyor/Form.ino

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,21 +165,18 @@ void stopWebServer()
165165

166166
if (websocket != NULL)
167167
{
168-
Serial.println("Free websocket");
169168
delete websocket;
170169
websocket = NULL;
171170
}
172171

173172
if (settingsCSV != NULL)
174173
{
175-
Serial.println("Freeing settingsCSV");
176174
free(settingsCSV);
177175
settingsCSV = NULL;
178176
}
179177

180178
if (incomingSettings != NULL)
181179
{
182-
Serial.println("Freeing incomingSettings");
183180
free(incomingSettings);
184181
incomingSettings = NULL;
185182
}
@@ -504,11 +501,13 @@ void createSettingsString(char* newSettings)
504501
stringRecord(newSettings, "maxLogTime_minutes", settings.maxLogTime_minutes);
505502
stringRecord(newSettings, "maxLogLength_minutes", settings.maxLogLength_minutes);
506503

507-
char sdSpace[30];
508-
sprintf(sdSpace, "%s", stringHumanReadableSize(sdFreeSpace));
509-
stringRecord(newSettings, "sdFreeSpace", sdSpace);
510-
sprintf(sdSpace, "%s", stringHumanReadableSize(sdCardSize));
511-
stringRecord(newSettings, "sdSize", sdSpace);
504+
char sdCardSizeChar[20];
505+
stringHumanReadableSize(sdCardSize).toCharArray(sdCardSizeChar, sizeof(sdCardSizeChar));
506+
char sdFreeSpaceChar[20];
507+
stringHumanReadableSize(sdFreeSpace).toCharArray(sdFreeSpaceChar, sizeof(sdFreeSpaceChar));
508+
509+
stringRecord(newSettings, "sdFreeSpace", sdCardSizeChar);
510+
stringRecord(newSettings, "sdSize", sdFreeSpaceChar);
512511

513512
stringRecord(newSettings, "enableResetDisplay", settings.enableResetDisplay);
514513

Firmware/RTK_Surveyor/NtripClient.ino

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,19 +306,32 @@ void ntripClientStop(bool wifiClientAllocated)
306306
#endif //COMPILE_WIFI
307307
}
308308

309-
//Check for the arrival of any correction data. Push it to the GNSS.
310-
//Stop task if the connection has dropped or if we receive no data for maxTimeBeforeHangup_ms
311-
void ntripClientUpdate()
309+
//Determine if NTRIP Client is needed
310+
bool ntripClientIsNeeded()
312311
{
313312
if (settings.enableNtripClient == false)
314313
{
315314
//If user turns off NTRIP Client via settings, stop server
316315
if (ntripClientState > NTRIP_CLIENT_OFF)
317316
ntripClientStop(true); //Don't allocate new wifiClient
318-
return;
317+
return(false);
319318
}
320319

321-
if (wifiInConfigMode()) return; //Do not service NTRIP during WiFi config
320+
if (wifiInConfigMode()) return(false); //Do not service NTRIP during WiFi config
321+
322+
//Allow NTRIP Client to run during Survey-In,
323+
//but do not allow NTRIP Client to run during Base
324+
if (systemState == STATE_BASE_TEMP_TRANSMITTING)
325+
return(false);
326+
327+
return(true);
328+
}
329+
330+
//Check for the arrival of any correction data. Push it to the GNSS.
331+
//Stop task if the connection has dropped or if we receive no data for maxTimeBeforeHangup_ms
332+
void ntripClientUpdate()
333+
{
334+
if(ntripClientIsNeeded() == false) return;
322335

323336
#ifdef COMPILE_WIFI
324337
//Periodically display the NTRIP client state

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
const int FIRMWARE_VERSION_MAJOR = 3;
23-
const int FIRMWARE_VERSION_MINOR = 0;
23+
const int FIRMWARE_VERSION_MINOR = 1;
2424

2525
#define COMPILE_WIFI //Comment out to remove WiFi functionality
2626
#define COMPILE_AP //Requires WiFi. Comment out to remove Access Point functionality
@@ -300,7 +300,7 @@ const int readTaskStackSize = 2000;
300300

301301
TaskHandle_t handleGNSSDataTaskHandle = NULL;
302302
const uint8_t handleGNSSDataTaskPriority = 1; //3 being the highest, and 0 being the lowest
303-
const int handleGNSSDataTaskStackSize = 2000;
303+
const int handleGNSSDataTaskStackSize = 3000;
304304

305305
TaskHandle_t pinUART2TaskHandle = NULL; //Dummy task to start UART2 on core 0.
306306
volatile bool uart2pinned = false; //This variable is touched by core 0 but checked by core 1. Must be volatile.

Firmware/RTK_Surveyor/States.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ void updateSystemState()
234234

235235
displayBaseStart(0); //Show 'Base'
236236

237-
wifiStop(); //Stop WiFi. Re-enable in each specific base start state.
237+
//Allow WiFi to continue running if NTRIP Client is needed for assisted survey in
238+
if(wifiIsNeeded() == false)
239+
wifiStop();
238240

239241
bluetoothStop();
240242
bluetoothStart(); //Restart Bluetooth with 'Base' identifier
@@ -328,7 +330,7 @@ void updateSystemState()
328330
systemPrint("Time elapsed: ");
329331
systemPrint(svinObservationTime);
330332
systemPrint(" Accuracy: ");
331-
systemPrint(svinMeanAccuracy);
333+
systemPrint(svinMeanAccuracy, 3);
332334
systemPrint(" SIV: ");
333335
systemPrint(numSV);
334336
systemPrintln();

Firmware/RTK_Surveyor/Tasks.ino

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ void F9PSerialReadTask(void *e)
115115
{
116116
static PARSE_STATE parse = {waitForPreamble, processUart1Message, "Log"};
117117

118-
bool newDataLost = false; //Goes true at the first instance of 0 bytes available
119118
uint8_t incomingData = 0;
120119

121120
availableHandlerSpace = settings.gnssHandlerBufferSize;
@@ -131,10 +130,6 @@ void F9PSerialReadTask(void *e)
131130
//Read the data from UART1
132131
incomingData = serialGNSS.read();
133132

134-
//For testing: Inject bad data once in awhile
135-
//if(random(0,10000) == 1) //0.01% failure rate
136-
// incomingData = 0xAA; //Bogus data
137-
138133
//Save the data byte
139134
parse.buffer[parse.length++] = incomingData;
140135
parse.length %= PARSE_BUFFER_LENGTH;
@@ -147,8 +142,6 @@ void F9PSerialReadTask(void *e)
147142
parse.state(&parse, incomingData);
148143
}
149144

150-
//emptyRingBuffer(true); //Empty and record to SD
151-
152145
delay(1);
153146
taskYIELD();
154147
}
@@ -223,9 +216,6 @@ void processUart1Message(PARSE_STATE * parse, uint8_t type)
223216
//Display the dataHead offset
224217
if (settings.enablePrintRingBufferOffsets && (!inMainMenu))
225218
systemPrintf("%4d\r\n", dataHead);
226-
227-
//Start emptying the ring buffer
228-
//emptyRingBuffer(false);
229219
}
230220

231221
//If new data is in the ringBuffer, dole it out to appropriate interface
@@ -281,7 +271,6 @@ void handleGNSSDataTask(void *e)
281271
//Send data over Bluetooth
282272
//----------------------------------------------------------------------
283273

284-
//If we are actively survey-in then do not pass NMEA data from ZED to phone
285274
if (!btConnected)
286275
//Discard the data
287276
btTail = dataHead;
@@ -361,7 +350,7 @@ void handleGNSSDataTask(void *e)
361350
if (settings.enablePrintSDBuffers && !inMainMenu)
362351
{
363352
int availableUARTSpace = settings.uartReceiveBufferSize - serialGNSS.available();
364-
systemPrintf("SD Incoming Serial: %04d\tToRead: %04d\tMovedToBuffer: %04d\tavailableUARTSpace: %04d\tavailableHandlerSpace: %04d\tToRecord: %04d\tRecorded: %04d\tBO: %d\n\r", serialGNSS.available(), 0, 0, availableUARTSpace, availableHandlerSpace, sliceToRecord, 0, bufferOverruns);
353+
systemPrintf("SD Incoming Serial: %04d\tToRead: %04d\tMovedToBuffer: %04d\tavailableUARTSpace: %04d\tavailableHandlerSpace: %04d\tToRecord: %04d\tRecorded: %04d\tBO: %d\r\n", serialGNSS.available(), 0, 0, availableUARTSpace, availableHandlerSpace, sliceToRecord, 0, bufferOverruns);
365354
}
366355

367356
//Write the data to the file
@@ -390,7 +379,7 @@ void handleGNSSDataTask(void *e)
390379
if (settings.enablePrintBufferOverrun)
391380
{
392381
if (endTime - startTime > 150)
393-
systemPrintf("Long Write! Time: %ld ms / Location: %ld / Recorded %d bytes / spaceRemaining %d bytes\n\r", endTime - startTime, fileSize, sdBytesToRecord, combinedSpaceRemaining);
382+
systemPrintf("Long Write! Time: %ld ms / Location: %ld / Recorded %d bytes / spaceRemaining %d bytes\r\n", endTime - startTime, fileSize, sdBytesToRecord, combinedSpaceRemaining);
394383
}
395384

396385
xSemaphoreGive(sdCardSemaphore);
@@ -949,7 +938,7 @@ void sdSizeCheckTask(void *e)
949938

950939
xSemaphoreGive(sdCardSemaphore);
951940

952-
uint64_t sdUsedSpace = sdCardSize - sdFreeSpace; //Don't think of it as used, think of it as unusable
941+
//uint64_t sdUsedSpace = sdCardSize - sdFreeSpace; //Don't think of it as used, think of it as unusable
953942

954943
systemPrintf("SD card size: %s / Free space: %s\r\n",
955944
stringHumanReadableSize(sdCardSize),

Firmware/RTK_Surveyor/WiFi.ino

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static const int MAX_WIFI_CONNECTION_ATTEMPTS = 500;
4646
//ms - Max of 4,294,967,295 or 4.3M seconds or 71,000 minutes or 1193 hours or 49 days between attempts
4747
static int wifiConnectionAttempts = 0; //Count the number of connection attempts between restarts
4848
static uint32_t wifiConnectionAttemptsTotal; //Count the number of connection attempts absolutely
49-
static uint32_t wifiLastConnectionAttempt = 0;
5049
static uint32_t wifiConnectionAttemptTimeout = 0;
5150

5251
//----------------------------------------
@@ -55,6 +54,8 @@ static uint32_t wifiConnectionAttemptTimeout = 0;
5554

5655
#ifdef COMPILE_WIFI
5756

57+
static uint32_t wifiLastConnectionAttempt = 0;
58+
5859
//WiFi Timer usage:
5960
// * Measure interval to display IP address
6061
static unsigned long wifiDisplayTimer = 0;
@@ -460,6 +461,13 @@ bool wifiIsNeeded()
460461
)
461462
needed = true;
462463

464+
//If the user has enabled NTRIP Client for an Assisted Survey-In, and Survey-In is running, keep WiFi on.
465+
if (systemState >= STATE_BASE_NOT_STARTED && systemState <= STATE_BASE_TEMP_SURVEY_STARTED
466+
&& settings.enableNtripClient == true
467+
&& settings.fixedBase == false
468+
)
469+
needed = true;
470+
463471
//If WiFi is on while we are in the following states, allow WiFi to continue to operate
464472
if (systemState >= STATE_BUBBLE_LEVEL && systemState <= STATE_PROFILE)
465473
{

0 commit comments

Comments
 (0)