Skip to content

Commit 1623da9

Browse files
authored
Merge branch 'Multiple_NTRIP' into ntrip-server
2 parents 0287433 + 0ea041b commit 1623da9

File tree

15 files changed

+1933
-1759
lines changed

15 files changed

+1933
-1759
lines changed

Firmware/RTK_Surveyor/AP-Config/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,19 @@
10911091
</span>
10921092
</div>
10931093

1094+
<div id="geographicRegionDropdown">
1095+
<label for="geographicRegion">Geographic Region:</label>
1096+
<select name="geographicRegion" id="geographicRegion" class="form-dropdown mb-2">
1097+
<option value="0">US</option>
1098+
<option value="1">EU</option>
1099+
</select>
1100+
<span class="tt" data-bs-placement="right"
1101+
title="Select your geographic region. This defines the default L-Band frequency. Default: US">
1102+
<span class="icon-info-circle text-primary ms-2"></span>
1103+
</span>
1104+
<br>
1105+
</div>
1106+
10941107
<div id="ppSettingsConfig">
10951108
<div class="form-check mt-3">
10961109
<label class="form-check-label" for="autoKeyRenewal">Auto Key Renewal </label>

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

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,25 +1382,41 @@ function loadGeodetic() {
13821382
var val = ge("StationCoordinatesGeodetic").value;
13831383
if (val > "") {
13841384
var parts = recordsGeodetic[val].split(' ');
1385-
ge("nicknameGeodetic").value = parts[0];
1386-
ge("fixedLatText").value = parts[1];
1387-
ge("fixedLongText").value = parts[2];
1388-
ge("antennaHeight").value = parts[4];
1389-
ge("antennaReferencePoint").value = parts[5];
1385+
var numParts = parts.length;
1386+
if (numParts >= 6) {
1387+
var latParts = (numParts - 4) / 2;
1388+
ge("nicknameGeodetic").value = parts[0];
1389+
ge("fixedLatText").value = parts[1];
1390+
if (latParts > 1) {
1391+
for (let moreParts = 1; moreParts < latParts; moreParts++) {
1392+
ge("fixedLatText").value += ' ' + parts[moreParts + 1];
1393+
}
1394+
}
1395+
ge("fixedLongText").value = parts[1 + latParts];
1396+
if (latParts > 1) {
1397+
for (let moreParts = 1; moreParts < latParts; moreParts++) {
1398+
ge("fixedLongText").value += ' ' + parts[moreParts + 1 + latParts];
1399+
}
1400+
}
1401+
ge("fixedAltitude").value = parts[numParts - 3];
1402+
ge("antennaHeight").value = parts[numParts - 2];
1403+
ge("antennaReferencePoint").value = parts[numParts - 1];
13901404

1391-
ge("fixedAltitude").value = parts[3];
1405+
$("input[name=markRadio][value=1]").prop('checked', false);
1406+
$("input[name=markRadio][value=2]").prop('checked', true);
13921407

1393-
$("input[name=markRadio][value=1]").prop('checked', false);
1394-
$("input[name=markRadio][value=2]").prop('checked', true);
1408+
adjustHAE();
13951409

1396-
adjustHAE();
1397-
1398-
clearError("nicknameGeodetic");
1399-
clearError("fixedLatText");
1400-
clearError("fixedLongText");
1401-
clearError("fixedAltitude");
1402-
clearError("antennaHeight");
1403-
clearError("antennaReferencePoint");
1410+
clearError("nicknameGeodetic");
1411+
clearError("fixedLatText");
1412+
clearError("fixedLongText");
1413+
clearError("fixedAltitude");
1414+
clearError("antennaHeight");
1415+
clearError("antennaReferencePoint");
1416+
}
1417+
else {
1418+
console.log("stationGeodetic split error");
1419+
}
14041420
}
14051421
}
14061422

@@ -1780,9 +1796,15 @@ function identifyInputType(userEntry) {
17801796
if (dashCount > 3) return (CoordinateTypes.COORDINATE_INPUT_TYPE_INVALID_UNKNOWN); //Only 0, 1, 2, or 3 allowed. -105-11-05.1629 is valid.
17811797
if (lengthOfLeadingNumber > 7) return (CoordinateTypes.COORDINATE_INPUT_TYPE_INVALID_UNKNOWN); //Only 7 or fewer. -1051105.188992 (DDDMMSS or DDMMSS) is valid
17821798

1799+
//console.log("userEntry: " + userEntry);
1800+
//console.log("decimalCount: " + decimalCount);
1801+
//console.log("spaceCount: " + spaceCount);
1802+
//console.log("dashCount: " + dashCount);
1803+
//console.log("lengthOfLeadingNumber: " + lengthOfLeadingNumber);
1804+
17831805
var negativeSign = false;
17841806
if (userEntry[0] == '-') {
1785-
userEntry = setCharAt(userEntry, 0, ''); //Remove leading space
1807+
userEntry = setCharAt(userEntry, 0, ''); //Remove leading minus
17861808
negativeSign = true;
17871809
dashCount--; //Use dashCount as the internal dashes only, not the leading negative sign
17881810
}
@@ -1804,7 +1826,7 @@ function identifyInputType(userEntry) {
18041826
seconds -= (decimal * 10000); //Remove DDD
18051827
seconds -= (minutes * 100); //Remove MM
18061828
convertedCoordinate = decimal + (minutes / 60.0) + (seconds / 3600.0);
1807-
if (convertedCoordinate) convertedCoordinate *= -1;
1829+
if (negativeSign) convertedCoordinate *= -1;
18081830
}
18091831
else if (spaceCount == 0 && dashCount == 0 && (lengthOfLeadingNumber == 5 || lengthOfLeadingNumber == 4)) //DDMM.mmmmmmm
18101832
{
@@ -1816,7 +1838,7 @@ function identifyInputType(userEntry) {
18161838
var minutes = userEntry; //Get DDDMM.mmmmmmm
18171839
minutes -= (decimal * 100); //Remove DDD
18181840
convertedCoordinate = decimal + (minutes / 60.0);
1819-
if (negativeSign) convertedCoordinate *= -1;
1841+
if (negativeSign) convertedCoordinate *= -1.0;
18201842
}
18211843

18221844
else if (dashCount == 1) //DD-MM.mmmmmmm
@@ -1827,7 +1849,7 @@ function identifyInputType(userEntry) {
18271849
var decimal = Number(data[0]); //Get DD
18281850
var minutes = Number(data[1]); //Get MM.mmmmmmm
18291851
convertedCoordinate = decimal + (minutes / 60.0);
1830-
if (negativeSign) convertedCoordinate *= -1;
1852+
if (negativeSign) convertedCoordinate *= -1.0;
18311853
}
18321854
else if (dashCount == 2) //DD-MM-SS.ssss
18331855
{
@@ -1843,13 +1865,13 @@ function identifyInputType(userEntry) {
18431865

18441866
var seconds = Number(data[2]); //Get SS.ssssss
18451867
convertedCoordinate = decimal + (minutes / 60.0) + (seconds / 3600.0);
1846-
if (negativeSign) convertedCoordinate *= -1;
1868+
if (negativeSign) convertedCoordinate *= -1.0;
18471869
}
18481870
else if (spaceCount == 0) //DD.ddddddddd
18491871
{
18501872
coordinateInputType = CoordinateTypes.COORDINATE_INPUT_TYPE_DD;
18511873
convertedCoordinate = userEntry;
1852-
if (negativeSign) convertedCoordinate *= -1;
1874+
if (negativeSign) convertedCoordinate *= -1.0;
18531875
}
18541876
else if (spaceCount == 1) //DD MM.mmmmmmm
18551877
{
@@ -1859,7 +1881,7 @@ function identifyInputType(userEntry) {
18591881
var decimal = Number(data[0]); //Get DD
18601882
var minutes = Number(data[1]); //Get MM.mmmmmmm
18611883
convertedCoordinate = decimal + (minutes / 60.0);
1862-
if (negativeSign) convertedCoordinate *= -1;
1884+
if (negativeSign) convertedCoordinate *= -1.0;
18631885
}
18641886
else if (spaceCount == 2) //DD MM SS.ssssss
18651887
{
@@ -1875,10 +1897,11 @@ function identifyInputType(userEntry) {
18751897

18761898
var seconds = Number(data[2]); //Get SS.ssssss
18771899
convertedCoordinate = decimal + (minutes / 60.0) + (seconds / 3600.0);
1878-
if (negativeSign) convertedCoordinate *= -1;
1900+
if (negativeSign) convertedCoordinate *= -1.0;
18791901
}
18801902

1881-
//console.log("convertedCoordinate: " + convertedCoordinate.toFixed(9));
1903+
//console.log("convertedCoordinate: " + Number(convertedCoordinate).toFixed(9));
1904+
//console.log("Detected type: " + printableInputType(coordinateInputType));
18821905
return (coordinateInputType);
18831906
}
18841907

@@ -1983,6 +2006,9 @@ function printableInputType(coordinateInputType) {
19832006
case (CoordinateTypes.COORDINATE_INPUT_TYPE_DD_MM_SS):
19842007
return ("DD MM SS.ssssss");
19852008
break;
2009+
case (CoordinateTypes.COORDINATE_INPUT_TYPE_DD_MM_SS_DASH):
2010+
return ("DD-MM-SS.ssssss");
2011+
break;
19862012
case (CoordinateTypes.COORDINATE_INPUT_TYPE_DDMMSS_NO_DECIMAL):
19872013
return ("DDMMSS");
19882014
break;

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ void beginBoard()
283283
settings.enablePrintBatteryMessages = false; // No pesky battery messages
284284
}
285285

286+
displaySfeFlame();
287+
286288
char versionString[21];
287289
getFirmwareVersion(versionString, sizeof(versionString), true);
288290
systemPrintf("SparkFun RTK %s %s\r\n", platformPrefix, versionString);
@@ -361,6 +363,9 @@ void beginBoard()
361363

362364
void beginSD()
363365
{
366+
if(sdCardForcedOffline == true)
367+
return;
368+
364369
bool gotSemaphore;
365370

366371
online.microSD = false;
@@ -445,6 +450,8 @@ void beginSD()
445450
systemPrintln("SD init failed - using SPI and SdFat. Is card formatted?");
446451
digitalWrite(pin_microSD_CS, HIGH); // Be sure SD is deselected
447452

453+
sdCardForcedOffline = true; //Prevent future scans for SD cards
454+
448455
// Check reset count and prevent rolling reboot
449456
if (settings.resetCount < 5)
450457
{

Firmware/RTK_Surveyor/Display.ino

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ void beginDisplay()
116116

117117
systemPrintln("Display started");
118118

119-
// Display the SparkFun LOGO
120119
oled.erase();
121-
displayBitmap(0, 0, logoSparkFun_Width, logoSparkFun_Height, logoSparkFun);
122-
oled.display();
123-
splashStart = millis();
124120
return;
125121
}
126122

@@ -130,6 +126,18 @@ void beginDisplay()
130126
systemPrintln("Display not detected");
131127
}
132128

129+
// Display the SparkFun logo
130+
void displaySfeFlame()
131+
{
132+
if (online.display == true)
133+
{
134+
oled.erase();
135+
displayBitmap(0, 0, logoSparkFun_Width, logoSparkFun_Height, logoSparkFun);
136+
oled.display();
137+
splashStart = millis();
138+
}
139+
}
140+
133141
// Avoid code repetition
134142
void displayBatteryVsEthernet()
135143
{
@@ -1891,17 +1899,17 @@ void displayNoWiFi(uint16_t displayTime)
18911899

18921900
void displayNoSSIDs(uint16_t displayTime)
18931901
{
1894-
displayMessage("No SSIDs", displayTime);
1902+
displayMessage("No SSIDs", displayTime);
18951903
}
18961904

18971905
void displayAccountExpired(uint16_t displayTime)
18981906
{
1899-
displayMessage("Account Expired", displayTime);
1907+
displayMessage("Account Expired", displayTime);
19001908
}
19011909

19021910
void displayNotListed(uint16_t displayTime)
19031911
{
1904-
displayMessage("Not Listed", displayTime);
1912+
displayMessage("Not Listed", displayTime);
19051913
}
19061914

19071915
void displayRoverStart(uint16_t displayTime)
@@ -2048,11 +2056,11 @@ void displayWiFiConfig()
20482056
snprintf(mySSID, sizeof(mySSID), "%s", "RTK Config");
20492057
else
20502058
{
2051-
if(WiFi.getMode() == WIFI_STA)
2059+
if (WiFi.getMode() == WIFI_STA)
20522060
snprintf(mySSID, sizeof(mySSID), "%s", WiFi.SSID().c_str());
20532061

2054-
//If we failed to connect to a friendly WiFi, and then fell back to AP mode, still display RTK Config
2055-
else if(WiFi.getMode() == WIFI_AP)
2062+
// If we failed to connect to a friendly WiFi, and then fell back to AP mode, still display RTK Config
2063+
else if (WiFi.getMode() == WIFI_AP)
20562064
snprintf(mySSID, sizeof(mySSID), "%s", "RTK Config");
20572065

20582066
else
@@ -2450,7 +2458,7 @@ void paintSystemTest()
24502458
else
24512459
oled.print("FAIL");
24522460
} // End display 0
2453-
} // End Facet L-Band testing
2461+
} // End Facet L-Band testing
24542462
}
24552463
}
24562464

Firmware/RTK_Surveyor/Form.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ void createSettingsString(char *newSettings)
813813
stringRecord(newSettings, "pointPerfectDeviceProfileToken", settings.pointPerfectDeviceProfileToken);
814814
stringRecord(newSettings, "enablePointPerfectCorrections", settings.enablePointPerfectCorrections);
815815
stringRecord(newSettings, "autoKeyRenewal", settings.autoKeyRenewal);
816+
stringRecord(newSettings, "geographicRegion", settings.geographicRegion);
816817

817818
// External PPS/Triggers
818819
stringRecord(newSettings, "enableExternalPulse", settings.enableExternalPulse);
@@ -1172,6 +1173,7 @@ void updateSettingWithValue(const char *settingName, const char *settingValueStr
11721173
}
11731174
else if (strcmp(settingName, "fixedLongText") == 0)
11741175
{
1176+
// Lat defines the settings.coordinateInputType. Don't update it here
11751177
double newCoordinate = 0.0;
11761178
if (coordinateIdentifyInputType((char *)settingValueStr, &newCoordinate) ==
11771179
COORDINATE_INPUT_TYPE_INVALID_UNKNOWN)
@@ -1384,6 +1386,9 @@ void updateSettingWithValue(const char *settingName, const char *settingValueStr
13841386
else if (strcmp(settingName, "autoFirmwareCheckMinutes") == 0)
13851387
settings.autoFirmwareCheckMinutes = settingValueBool;
13861388

1389+
else if (strcmp(settingName, "geographicRegion") == 0)
1390+
settings.geographicRegion = settingValue;
1391+
13871392
// Unused variables - read to avoid errors
13881393
else if (strcmp(settingName, "measurementRateSec") == 0)
13891394
{

Firmware/RTK_Surveyor/NVM.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ void recordSystemSettingsToFile(File *settingsFile)
280280
settingsFile->printf("%s=%d\r\n", "debugPpCertificate", settings.debugPpCertificate);
281281

282282
settingsFile->printf("%s=%d\r\n", "updateZEDSettings", settings.updateZEDSettings);
283-
settingsFile->printf("%s=%d\r\n", "LBandFreq", settings.LBandFreq);
284283
settingsFile->printf("%s=%d\r\n", "enableLogging", settings.enableLogging);
285284
settingsFile->printf("%s=%d\r\n", "enableARPLogging", settings.enableARPLogging);
286285
settingsFile->printf("%s=%d\r\n", "ARPLoggingInterval_s", settings.ARPLoggingInterval_s);
@@ -454,6 +453,8 @@ void recordSystemSettingsToFile(File *settingsFile)
454453
settingsFile->printf("%s=%d\r\n", "enableZedUsb", settings.enableZedUsb);
455454
settingsFile->printf("%s=%d\r\n", "debugWiFiConfig", settings.debugWiFiConfig);
456455

456+
settingsFile->printf("%s=%d\r\n", "geographicRegion", settings.geographicRegion);
457+
457458
// Add new settings above <------------------------------------------------------------>
458459
}
459460

@@ -1080,8 +1081,6 @@ bool parseLine(char *str, Settings *settings)
10801081
if (settings->updateZEDSettings != d)
10811082
settings->updateZEDSettings = true; // If there is a discrepancy, push ZED reconfig
10821083
}
1083-
else if (strcmp(settingName, "LBandFreq") == 0)
1084-
settings->LBandFreq = d;
10851084
else if (strcmp(settingName, "timeZoneHours") == 0)
10861085
settings->timeZoneHours = d;
10871086
else if (strcmp(settingName, "timeZoneMinutes") == 0)
@@ -1368,6 +1367,9 @@ bool parseLine(char *str, Settings *settings)
13681367
else if (strcmp(settingName, "debugWiFiConfig") == 0)
13691368
settings->debugWiFiConfig = d;
13701369

1370+
else if (strcmp(settingName, "geographicRegion") == 0)
1371+
settings->geographicRegion = d;
1372+
13711373
// Add new settings above
13721374
//<------------------------------------------------------------>
13731375

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ uint32_t lastRTCAttempt = 0; // Wait 1000ms between checking GNSS for curre
632632
uint32_t lastRTCSync = 0; // Time in millis when the RTC was last sync'd
633633
bool rtcSyncd = false; // Set to true when the RTC has been sync'd via TP pulse
634634
uint32_t lastPrintPosition = 0; // For periodic display of the position
635+
uint32_t lastPrintState = 0; // For periodic display of the RTK state (solution)
635636

636637
uint32_t lastBaseIconUpdate = 0;
637638
bool baseIconDisplayed = false; // Toggles as lastBaseIconUpdate goes above 1000ms
@@ -721,6 +722,9 @@ unsigned long shutdownNoChargeTimer = 0;
721722

722723
RtkMode_t rtkMode; // Mode of operation
723724

725+
bool sdCardForcedOffline = false; //Goes true if a isPresent() test passes, but then sdFat fails to mount SD card.
726+
//See issue: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/758
727+
724728
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
725729

726730
#define DEAD_MAN_WALKING_ENABLED 0
@@ -1033,6 +1037,9 @@ void loop()
10331037
DMW_c("printPosition");
10341038
printPosition(); // Periodically print GNSS coordinates if enabled
10351039

1040+
DMW_c("printRTKState");
1041+
printRTKState(); // Periodically print RTK state (solution) if enabled
1042+
10361043
// A small delay prevents panic if no other I2C or functions are called
10371044
delay(10);
10381045
}

Firmware/RTK_Surveyor/States.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void updateSystemState()
2727
}
2828
}
2929

30-
if (settings.enablePrintState && ((millis() - lastStateTime) > 15000))
30+
if (settings.enablePrintStates && ((millis() - lastStateTime) > 15000))
3131
{
3232
changeState(systemState);
3333
lastStateTime = millis();

0 commit comments

Comments
 (0)