Skip to content

Commit 25b3bea

Browse files
authored
Merge pull request #338 from sparkfun/Changes_from_RTK_Firmware
Changes from RTK Firmware
2 parents 7c8549c + 9cb2996 commit 25b3bea

File tree

13 files changed

+207
-115
lines changed

13 files changed

+207
-115
lines changed

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

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,26 +1645,41 @@ function loadGeodetic() {
16451645
var val = ge("StationCoordinatesGeodetic").value;
16461646
if (val > "") {
16471647
var parts = recordsGeodetic[val].split(' ');
1648-
ge("nicknameGeodetic").value = parts[0];
1649-
ge("fixedLatText").value = parts[1];
1650-
ge("fixedLongText").value = parts[2];
1651-
ge("antennaHeight").value = parts[4];
1652-
ge("antennaReferencePoint").value = parts[5];
1653-
1654-
ge("fixedAltitude").value = parts[3];
1648+
var numParts = parts.length;
1649+
if (numParts >= 6) {
1650+
var latParts = (numParts - 4) / 2;
1651+
ge("nicknameGeodetic").value = parts[0];
1652+
ge("fixedLatText").value = parts[1];
1653+
if (latParts > 1) {
1654+
for (let moreParts = 1; moreParts < latParts; moreParts++) {
1655+
ge("fixedLatText").value += ' ' + parts[moreParts + 1];
1656+
}
1657+
}
1658+
ge("fixedLongText").value = parts[1 + latParts];
1659+
if (latParts > 1) {
1660+
for (let moreParts = 1; moreParts < latParts; moreParts++) {
1661+
ge("fixedLongText").value += ' ' + parts[moreParts + 1 + latParts];
1662+
}
1663+
}
1664+
ge("fixedAltitude").value = parts[numParts - 3];
1665+
ge("antennaHeight").value = parts[numParts - 2];
1666+
ge("antennaReferencePoint").value = parts[numParts - 1];
16551667

1656-
$("input[name=markRadio][value=1]").prop('checked', false);
1657-
$("input[name=markRadio][value=2]").prop('checked', true);
1668+
$("input[name=markRadio][value=1]").prop('checked', false);
1669+
$("input[name=markRadio][value=2]").prop('checked', true);
16581670

1659-
adjustHAE();
1671+
adjustHAE();
16601672

1661-
clearError("nicknameGeodetic");
1662-
clearError("fixedLatText");
1663-
clearError("fixedLongText");
1664-
clearError("fixedAltitude");
1665-
clearError("antennaHeight");
1666-
clearError("antennaReferencePoint");
1667-
}
1673+
clearError("nicknameGeodetic");
1674+
clearError("fixedLatText");
1675+
clearError("fixedLongText");
1676+
clearError("fixedAltitude");
1677+
clearError("antennaHeight");
1678+
clearError("antennaReferencePoint");
1679+
}
1680+
else {
1681+
console.log("stationGeodetic split error");
1682+
}
16681683
}
16691684

16701685
//Based on recordsGeodetic array, update and monospace HTML list
@@ -2077,7 +2092,7 @@ function identifyInputType(userEntry) {
20772092
seconds -= (minutes * 100); //Remove MM
20782093
convertedCoordinate = decimal + (minutes / 60.0) + (seconds / 3600.0);
20792094
if (negativeSign == true) {
2080-
convertedCoordinate *= -1;
2095+
convertedCoordinate *= -1.0;
20812096
}
20822097
}
20832098
else if (spaceCount == 0 && dashCount == 0 && (lengthOfLeadingNumber == 5 || lengthOfLeadingNumber == 4)) //DDMM.mmmmmmm
@@ -2091,7 +2106,7 @@ function identifyInputType(userEntry) {
20912106
minutes -= (decimal * 100); //Remove DDD
20922107
convertedCoordinate = decimal + (minutes / 60.0);
20932108
if (negativeSign == true) {
2094-
convertedCoordinate *= -1;
2109+
convertedCoordinate *= -1.0;
20952110
}
20962111
}
20972112

@@ -2104,7 +2119,7 @@ function identifyInputType(userEntry) {
21042119
var minutes = Number(data[1]); //Get MM.mmmmmmm
21052120
convertedCoordinate = decimal + (minutes / 60.0);
21062121
if (negativeSign == true) {
2107-
convertedCoordinate *= -1;
2122+
convertedCoordinate *= -1.0;
21082123
}
21092124
}
21102125
else if (dashCount == 2) //DD-MM-SS.ssss
@@ -2122,15 +2137,15 @@ function identifyInputType(userEntry) {
21222137
var seconds = Number(data[2]); //Get SS.ssssss
21232138
convertedCoordinate = decimal + (minutes / 60.0) + (seconds / 3600.0);
21242139
if (negativeSign == true) {
2125-
convertedCoordinate *= -1;
2140+
convertedCoordinate *= -1.0;
21262141
}
21272142
}
21282143
else if (spaceCount == 0) //DD.ddddddddd
21292144
{
21302145
coordinateInputType = CoordinateTypes.COORDINATE_INPUT_TYPE_DD;
21312146
convertedCoordinate = userEntry;
21322147
if (negativeSign == true) {
2133-
convertedCoordinate *= -1;
2148+
convertedCoordinate *= -1.0;
21342149
}
21352150
}
21362151
else if (spaceCount == 1) //DD MM.mmmmmmm
@@ -2142,7 +2157,7 @@ function identifyInputType(userEntry) {
21422157
var minutes = Number(data[1]); //Get MM.mmmmmmm
21432158
convertedCoordinate = decimal + (minutes / 60.0);
21442159
if (negativeSign == true) {
2145-
convertedCoordinate *= -1;
2160+
convertedCoordinate *= -1.0;
21462161
}
21472162
}
21482163
else if (spaceCount == 2) //DD MM SS.ssssss
@@ -2160,7 +2175,7 @@ function identifyInputType(userEntry) {
21602175
var seconds = Number(data[2]); //Get SS.ssssss
21612176
convertedCoordinate = decimal + (minutes / 60.0) + (seconds / 3600.0);
21622177
if (negativeSign == true) {
2163-
convertedCoordinate *= -1;
2178+
convertedCoordinate *= -1.0;
21642179
}
21652180
}
21662181

@@ -2268,6 +2283,9 @@ function printableInputType(coordinateInputType) {
22682283
case (CoordinateTypes.COORDINATE_INPUT_TYPE_DD_MM_SS):
22692284
return ("DD MM SS.ssssss");
22702285
break;
2286+
case (CoordinateTypes.COORDINATE_INPUT_TYPE_DD_MM_SS_DASH):
2287+
return ("DD-MM-SS.ssssss");
2288+
break;
22712289
case (CoordinateTypes.COORDINATE_INPUT_TYPE_DDMMSS_NO_DECIMAL):
22722290
return ("DDMMSS");
22732291
break;

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void pushGPGGA(NMEA_GGA_data_t *nmeaData) {}
5959

6060
void ntripServerPrintStatus(int serverIndex) {systemPrintf("**NTRIP Server %d not compiled**\r\n", serverIndex);}
6161
void ntripServerProcessRTCM(int serverIndex, uint8_t incoming) {}
62-
void ntripServerStop(int serverIndex, bool clientAllocated) {online.ntripServer[0] = false;}
62+
void ntripServerStop(int serverIndex, bool clientAllocated) {online.ntripServer[serverIndex] = false;}
6363
void ntripServerUpdate() {}
6464
void ntripServerValidateTables() {}
6565
bool ntripServerIsCasting(int serverIndex) {

Firmware/RTK_Everywhere/MQTT_Client.ino

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ void mqttClientStop(bool shutdown)
443443
{
444444
if (settings.debugMqttClientState)
445445
systemPrintln("Freeing mqttSecureClient");
446-
delete mqttSecureClient;
446+
//delete mqttSecureClient; // Don't. This causes issue #335
447447
mqttSecureClient = nullptr;
448448
reportHeapNow(settings.debugMqttClientState);
449449
}
@@ -480,7 +480,9 @@ void mqttClientStop(bool shutdown)
480480
if (shutdown)
481481
{
482482
mqttClientSetState(MQTT_CLIENT_OFF);
483-
settings.enablePointPerfectCorrections = false;
483+
//settings.enablePointPerfectCorrections = false;
484+
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Why? This means PointPerfect Corrections
485+
//cannot be restarted without opening the menu or web configuration page...
484486
mqttClientConnectionAttempts = 0;
485487
mqttClientConnectionAttemptTimeout = 0;
486488
}
@@ -504,7 +506,7 @@ void mqttClientUpdate()
504506
if (mqttClientState > MQTT_CLIENT_OFF)
505507
{
506508
systemPrintln("MQTT Client stopping");
507-
mqttClientStop(false);
509+
mqttClientStop(true); // Was false - #StopVsRestart
508510
mqttClientConnectionAttempts = 0;
509511
mqttClientConnectionAttemptTimeout = 0;
510512
mqttClientSetState(MQTT_CLIENT_OFF);
@@ -533,7 +535,7 @@ void mqttClientUpdate()
533535
// Determine if the network has failed
534536
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
535537
// Failed to connect to the network, attempt to restart the network
536-
mqttClientRestart();
538+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
537539

538540
// Determine if the network is connected to the media
539541
else if (networkUserConnected(NETWORK_USER_MQTT_CLIENT))
@@ -548,7 +550,7 @@ void mqttClientUpdate()
548550
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
549551
{
550552
// Failed to connect to the network, attempt to restart the network
551-
mqttClientRestart();
553+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
552554
break;
553555
}
554556

@@ -652,7 +654,7 @@ void mqttClientUpdate()
652654
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
653655
{
654656
// Failed to connect to the network, attempt to restart the network
655-
mqttClientRestart();
657+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
656658
break;
657659
}
658660

@@ -661,7 +663,7 @@ void mqttClientUpdate()
661663
{
662664
mqttClientRestart();
663665
systemPrintln("ERROR: Subscription to key distribution topic failed!!");
664-
mqttClientRestart();
666+
mqttClientRestart(); // Why twice? TODO
665667
break;
666668
}
667669

@@ -678,7 +680,7 @@ void mqttClientUpdate()
678680
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
679681
{
680682
// Failed to connect to the network, attempt to restart the network
681-
mqttClientRestart();
683+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
682684
break;
683685
}
684686

@@ -689,7 +691,7 @@ void mqttClientUpdate()
689691
{
690692
mqttClientRestart();
691693
systemPrintln("ERROR: Subscription to corrections topic failed!!");
692-
mqttClientRestart();
694+
mqttClientRestart(); // Why twice? TODO
693695
break;
694696
}
695697

@@ -711,7 +713,7 @@ void mqttClientUpdate()
711713
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
712714
{
713715
// Failed to connect to the network, attempt to restart the network
714-
mqttClientRestart();
716+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
715717
break;
716718
}
717719

Firmware/RTK_Everywhere/Network.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,14 +897,14 @@ void networkStop(uint8_t networkType)
897897
serverIndex = user - NETWORK_USER_NTRIP_SERVER;
898898
if (settings.debugNetworkLayer)
899899
systemPrintln("Network layer stopping NTRIP server");
900-
ntripServerRestart(serverIndex);
900+
ntripServerStop(serverIndex, true); // Was ntripServerRestart(serverIndex); - #StopVsRestart
901901
}
902902
break;
903903

904904
case NETWORK_USER_MQTT_CLIENT:
905905
if (settings.debugNetworkLayer)
906906
systemPrintln("Network layer stopping MQTT client");
907-
mqttClientRestart();
907+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
908908
break;
909909

910910
case NETWORK_USER_NTP_SERVER:
@@ -916,7 +916,7 @@ void networkStop(uint8_t networkType)
916916
case NETWORK_USER_NTRIP_CLIENT:
917917
if (settings.debugNetworkLayer)
918918
systemPrintln("Network layer stopping NTRIP client");
919-
ntripClientRestart();
919+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
920920
break;
921921

922922
case NETWORK_USER_OTA_AUTO_UPDATE:

Firmware/RTK_Everywhere/NtripClient.ino

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -452,22 +452,22 @@ void ntripClientRestart()
452452
}
453453

454454
// Update the state of the NTRIP client state machine
455+
// PERIODIC_DISPLAY(PD_NTRIP_CLIENT_STATE) is handled by ntripClientUpdate
455456
void ntripClientSetState(uint8_t newState)
456457
{
457-
if (settings.debugNtripClientState || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_STATE))
458+
if (settings.debugNtripClientState)
458459
{
459460
if (ntripClientState == newState)
460-
systemPrint("*");
461+
systemPrint("NTRIP Client: *");
461462
else
462-
systemPrintf("%s --> ", ntripClientStateName[ntripClientState]);
463+
systemPrintf("NTRIP Client: %s --> ", ntripClientStateName[ntripClientState]);
463464
}
464465
ntripClientState = newState;
465-
if (settings.debugNtripClientState || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_STATE))
466+
if (settings.debugNtripClientState)
466467
{
467-
PERIODIC_CLEAR(PD_NTRIP_CLIENT_STATE);
468468
if (newState >= NTRIP_CLIENT_STATE_MAX)
469469
{
470-
systemPrintf("Unknown NTRIP Client state: %d\r\n", newState);
470+
systemPrintf("Unknown client state: %d\r\n", newState);
471471
reportFatalError("Unknown NTRIP Client state");
472472
}
473473
else
@@ -546,7 +546,7 @@ void ntripClientUpdate()
546546
{
547547
if (ntripClientState > NTRIP_CLIENT_OFF)
548548
{
549-
ntripClientStop(false);
549+
ntripClientStop(true); // Was false - #StopVsRestart
550550
ntripClientConnectionAttempts = 0;
551551
ntripClientConnectionAttemptTimeout = 0;
552552
ntripClientSetState(NTRIP_CLIENT_OFF);
@@ -573,7 +573,7 @@ void ntripClientUpdate()
573573
// Determine if the network has failed
574574
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
575575
// Failed to connect to to the network, attempt to restart the network
576-
ntripClientRestart();
576+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
577577

578578
// Determine if the network is connected to the media
579579
else if (networkUserConnected(NETWORK_USER_NTRIP_CLIENT))
@@ -600,7 +600,7 @@ void ntripClientUpdate()
600600
// Determine if the network has failed
601601
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
602602
// Failed to connect to to the network, attempt to restart the network
603-
ntripClientRestart();
603+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
604604

605605
// If GGA transmission is enabled, wait for GNSS lock before connecting to NTRIP Caster
606606
// If GGA transmission is not enabled, start connecting to NTRIP Caster
@@ -633,7 +633,7 @@ void ntripClientUpdate()
633633
// Determine if the network has failed
634634
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
635635
// Failed to connect to to the network, attempt to restart the network
636-
ntripClientRestart();
636+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
637637

638638
// Check for no response from the caster service
639639
else if (ntripClientReceiveDataAvailable() <
@@ -753,7 +753,7 @@ void ntripClientUpdate()
753753
// Determine if the network has failed
754754
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
755755
// Failed to connect to to the network, attempt to restart the network
756-
ntripClientRestart();
756+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
757757

758758
// Check for a broken connection
759759
else if (!ntripClient->connected())
@@ -860,7 +860,10 @@ void ntripClientUpdate()
860860

861861
// Periodically display the NTRIP client state
862862
if (PERIODIC_DISPLAY(PD_NTRIP_CLIENT_STATE))
863-
ntripClientSetState(ntripClientState);
863+
{
864+
systemPrintf("NTRIP Client state: %s\r\n", ntripClientStateName[ntripClientState]);
865+
PERIODIC_CLEAR(PD_NTRIP_CLIENT_STATE);
866+
}
864867
}
865868

866869
// Verify the NTRIP client tables

0 commit comments

Comments
 (0)