Skip to content

Commit 669108c

Browse files
authored
Merge pull request #766 from LeeLeahy2/ntrip-server
Increase NTRIP_SERVER_MAX from 1 to 2
2 parents 0ea041b + 1623da9 commit 669108c

18 files changed

+788
-383
lines changed

Firmware/RTK_Surveyor/AP-Config/index.html

Lines changed: 82 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -814,66 +814,128 @@
814814

815815
<div id="ntripServerConfig" class="collapse mb-2">
816816
<div class="form-group row">
817-
<label for="ntripServer_CasterHost"
817+
<label for="ntripServer_CasterHost_0"
818818
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
819-
Host:</label>
819+
Host 0:</label>
820820
<div class="col-sm-8 col-6">
821-
<input type="text" class="form-control" id="ntripServer_CasterHost">
821+
<input type="text" class="form-control" id="ntripServer_CasterHost_0">
822822
<p id="ntripServer_CasterHostError" class="inlineError"></p>
823823
</div>
824824
</div>
825825

826826
<div class="form-group row">
827-
<label for="ntripServer_CasterPort"
827+
<label for="ntripServerCasterPort_0"
828828
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
829-
Port:</label>
829+
Port 0:</label>
830830
<div class="col-sm-8 col-6">
831-
<input type="number" class="form-control" id="ntripServer_CasterPort">
831+
<input type="number" class="form-control" id="ntripServerCasterPort_0">
832832
<p id="ntripServer_CasterPortError" class="inlineError"></p>
833833
</div>
834834
</div>
835835

836836
<div class="form-group row">
837-
<label for="ntripServer_CasterUser"
837+
<label for="ntripServerCasterUser_0"
838838
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
839-
User:</label>
839+
User 0:</label>
840840
<div class="col-sm-8 col-6">
841-
<input type="text" class="form-control" id="ntripServer_CasterUser">
841+
<input type="text" class="form-control" id="ntripServerCasterUser_0">
842842
<p id="ntripServer_CasterUserError" class="inlineError"></p>
843843
</div>
844844
</div>
845845

846846
<div class="form-group row">
847-
<label for="ntripServer_CasterUserPW"
847+
<label for="ntripServerCasterUserPW_0"
848848
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
849-
User PW:</label>
849+
User PW 0:</label>
850850
<div class="col-sm-8 col-6">
851-
<input type="text" class="form-control" id="ntripServer_CasterUserPW">
851+
<input type="text" class="form-control" id="ntripServerCasterUserPW_0">
852852
<p id="ntripServer_CasterUserPWError" class="inlineError"></p>
853853
</div>
854854
</div>
855855

856856
<div class="form-group row">
857-
<label for="ntripServer_MountPoint" class="box-margin20 col-sm-3 col-5 col-form-label">Mount
858-
Point:</label>
857+
<label for="ntripServerMountPoint_0" class="box-margin20 col-sm-3 col-5 col-form-label">Mount
858+
Point 0:</label>
859859
<div class="col-sm-8 col-6">
860-
<input type="text" class="form-control" id="ntripServer_MountPoint">
860+
<input type="text" class="form-control" id="ntripServerMountPoint_0">
861861
<p id="ntripServer_MountPointError" class="inlineError"></p>
862862
</div>
863863
</div>
864864

865865
<div class="form-group row">
866-
<label for="ntripServer_MountPointPW"
866+
<label for="ntripServerMountPointPW_0"
867867
class="box-margin20 col-sm-4 col-6 col-form-label">Mount
868868
Point
869-
PW:</label>
869+
PW 0:</label>
870870
<div class="col-sm-7 col-5">
871-
<input type="text" class="form-control" id="ntripServer_MountPointPW">
871+
<input type="text" class="form-control" id="ntripServerMountPointPW_0">
872872
<p id="ntripServer_MountPointPWError" class="inlineError"></p>
873873
</div>
874874
</div>
875875

876-
<!-- For future expansion
876+
<br>
877+
878+
<div class="form-group row">
879+
<label for="ntripServer_CasterHost_1"
880+
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
881+
Host 1:</label>
882+
<div class="col-sm-8 col-6">
883+
<input type="text" class="form-control" id="ntripServer_CasterHost_1">
884+
<p id="ntripServer_CasterHostError" class="inlineError"></p>
885+
</div>
886+
</div>
887+
888+
<div class="form-group row">
889+
<label for="ntripServerCasterPort_1"
890+
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
891+
Port 1:</label>
892+
<div class="col-sm-8 col-6">
893+
<input type="number" class="form-control" id="ntripServerCasterPort_1">
894+
<p id="ntripServer_CasterPortError" class="inlineError"></p>
895+
</div>
896+
</div>
897+
898+
<div class="form-group row">
899+
<label for="ntripServerCasterUser_1"
900+
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
901+
User 1:</label>
902+
<div class="col-sm-8 col-6">
903+
<input type="text" class="form-control" id="ntripServerCasterUser_1">
904+
<p id="ntripServer_CasterUserError" class="inlineError"></p>
905+
</div>
906+
</div>
907+
908+
<div class="form-group row">
909+
<label for="ntripServerCasterUserPW_1"
910+
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
911+
User PW 1:</label>
912+
<div class="col-sm-8 col-6">
913+
<input type="text" class="form-control" id="ntripServerCasterUserPW_1">
914+
<p id="ntripServer_CasterUserPWError" class="inlineError"></p>
915+
</div>
916+
</div>
917+
918+
<div class="form-group row">
919+
<label for="ntripServerMountPoint_1" class="box-margin20 col-sm-3 col-5 col-form-label">Mount
920+
Point 1:</label>
921+
<div class="col-sm-8 col-6">
922+
<input type="text" class="form-control" id="ntripServerMountPoint_1">
923+
<p id="ntripServer_MountPointError" class="inlineError"></p>
924+
</div>
925+
</div>
926+
927+
<div class="form-group row">
928+
<label for="ntripServerMountPointPW_1"
929+
class="box-margin20 col-sm-4 col-6 col-form-label">Mount
930+
Point
931+
PW 1:</label>
932+
<div class="col-sm-7 col-5">
933+
<input type="text" class="form-control" id="ntripServerMountPointPW_1">
934+
<p id="ntripServer_MountPointPWError" class="inlineError"></p>
935+
</div>
936+
</div>
937+
938+
<!-- For future expansion
877939
<div id="allowWiFiOverEthernetServer">
878940
<div class="form-check mt-1 box-margin20">
879941
<label class="form-check-label" for="ntripUseWiFiNotEthernet">Use WiFi for NTRIP Server - not Ethernet</label>
@@ -1948,4 +2010,4 @@
19482010
</script>
19492011
</body>
19502012

1951-
</html>
2013+
</html>

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

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -547,18 +547,32 @@ function validateFields() {
547547
}
548548

549549
if (ge("enableNtripServer").checked == true) {
550-
checkElementString("ntripServer_CasterHost", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
551-
checkElementValue("ntripServer_CasterPort", 1, 99999, "Must be 1 to 99999", "collapseBaseConfig");
552-
checkElementString("ntripServer_MountPoint", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
553-
checkElementString("ntripServer_MountPointPW", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
550+
checkElementString("ntripServerCasterHost_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
551+
checkElementValue("ntripServerCasterPort_0", 1, 99999, "Must be 1 to 99999", "collapseBaseConfig");
552+
checkElementString("ntripServerUser_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
553+
checkElementString("ntripServerUserPW_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
554+
checkElementString("ntripServerMountPoint_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
555+
checkElementString("ntripServerMountPointPW_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
556+
checkElementString("ntripServerCasterHost_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
557+
checkElementValue("ntripServerCasterPort_1", 1, 99999, "Must be 1 to 99999", "collapseBaseConfig");
558+
checkElementString("ntripServerUser_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
559+
checkElementString("ntripServerUserPW_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
560+
checkElementString("ntripServerMountPoint_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
561+
checkElementString("ntripServerMountPointPW_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
554562
}
555563
else {
556-
clearElement("ntripServer_CasterHost", "rtk2go.com");
557-
clearElement("ntripServer_CasterPort", 2101);
558-
clearElement("ntripServer_CasterUser", "");
559-
clearElement("ntripServer_CasterUserPW", "");
560-
clearElement("ntripServer_MountPoint", "bldr_dwntwn2");
561-
clearElement("ntripServer_MountPointPW", "WR5wRo4H");
564+
clearElement("ntripServerCasterHost_0", "rtk2go.com");
565+
clearElement("ntripServerCasterPort_0", 2101);
566+
clearElement("ntripServerCasterUser_0", "[email protected]");
567+
clearElement("ntripServerCasterUserPW_0", "");
568+
clearElement("ntripServerMountPoint_0", "bldr_dwntwn2");
569+
clearElement("ntripServerMountPointPW_0", "WR5wRo4H");
570+
clearElement("ntripServerCasterHost_1", "");
571+
clearElement("ntripServerCasterPort_1", 0);
572+
clearElement("ntripServerCasterUser_1", "");
573+
clearElement("ntripServerCasterUserPW_1", "");
574+
clearElement("ntripServerMountPoint_1", "");
575+
clearElement("ntripServerMountPointPW_1", "");
562576
}
563577
}
564578

@@ -2006,4 +2020,4 @@ function printableInputType(coordinateInputType) {
20062020
break;
20072021
}
20082022
return ("Unknown");
2009-
}
2023+
}

Firmware/RTK_Surveyor/Base.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ void DevUBLOXGNSS::processRTCM(uint8_t incoming)
349349
rtcmLastReceived = millis();
350350
rtcmBytesSent++;
351351

352-
ntripServerProcessRTCM(incoming);
352+
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
353+
ntripServerProcessRTCM(serverIndex, incoming);
353354

354355
espnowProcessRTCM(incoming);
355356
}
@@ -391,7 +392,8 @@ void processRTCMBuffer()
391392
rtcmLastReceived = millis();
392393
rtcmBytesSent++;
393394

394-
ntripServerProcessRTCM(incoming);
395+
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
396+
ntripServerProcessRTCM(serverIndex, incoming);
395397

396398
espnowProcessRTCM(incoming);
397399
}

Firmware/RTK_Surveyor/Developer.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void ntripClientValidateTables() {}
5959
// NTRIP server
6060
//----------------------------------------
6161

62-
bool ntripServerIsCasting() {return false;}
63-
void ntripServerPrintStatus() {systemPrint("NTRIP Server not compiled");}
64-
void ntripServerProcessRTCM(uint8_t incoming) {}
65-
void ntripServerStop(bool clientAllocated) {online.ntripServer = false;}
62+
bool ntripServerIsCasting(int serverIndex) {return false;}
63+
void ntripServerPrintStatus(int serverIndex) {systemPrintf("**NTRIP Server %d not compiled**\r\n", serverIndex);}
64+
void ntripServerProcessRTCM(int serverIndex, uint8_t incoming) {}
65+
void ntripServerStop(int serverIndex, bool clientAllocated) {online.ntripServer = false;}
6666
void ntripServerUpdate() {}
6767
void ntripServerValidateTables() {}
6868

Firmware/RTK_Surveyor/Display.ino

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ uint32_t setRadioIcons()
760760

761761
// Count the number of radios in use
762762
uint8_t numberOfRadios = 1; // Bluetooth always indicated. TODO don't count if BT radio type is OFF.
763-
if (wifiState > WIFI_OFF)
763+
if (wifiState > WIFI_STATE_OFF)
764764
numberOfRadios++;
765765
if (espnowState > ESPNOW_OFF)
766766
numberOfRadios++;
@@ -778,7 +778,7 @@ uint32_t setRadioIcons()
778778
icons |= setBluetoothIcon_TwoRadios();
779779

780780
// Do we have WiFi or ESP
781-
if (wifiState > WIFI_OFF)
781+
if (wifiState > WIFI_STATE_OFF)
782782
icons |= setWiFiIcon_TwoRadios();
783783
else if (espnowState > ESPNOW_OFF)
784784
icons |= setESPNowIcon_TwoRadios();
@@ -976,7 +976,7 @@ uint32_t setWiFiIcon_TwoRadios()
976976
{
977977
uint32_t icons = 0;
978978

979-
if (wifiState == WIFI_CONNECTED)
979+
if (wifiState == WIFI_STATE_CONNECTED)
980980
{
981981
// Limit how often we update this spot
982982
if (millis() - firstRadioSpotTimer > 2000)
@@ -1063,7 +1063,7 @@ uint32_t setWiFiIcon_ThreeRadios()
10631063
{
10641064
uint32_t icons = 0;
10651065

1066-
if (wifiState == WIFI_CONNECTED)
1066+
if (wifiState == WIFI_STATE_CONNECTED)
10671067
{
10681068
// Limit how often we update this spot
10691069
if (millis() - thirdRadioSpotTimer > 2000)
@@ -1152,7 +1152,7 @@ uint32_t setWiFiIcon()
11521152

11531153
if (online.display == true)
11541154
{
1155-
if (wifiState == WIFI_CONNECTED)
1155+
if (wifiState == WIFI_STATE_CONNECTED)
11561156
{
11571157
icons |= ICON_WIFI_SYMBOL_3_RIGHT;
11581158
}
@@ -1734,7 +1734,13 @@ void printTextwithKerning(const char *newText, uint8_t xPos, uint8_t yPos, uint8
17341734
void paintRTCM()
17351735
{
17361736
int yPos = 17;
1737-
if (ntripServerIsCasting())
1737+
1738+
// Determine if the NTRIP Server is casting
1739+
bool casting = false;
1740+
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
1741+
casting |= online.ntripServer[serverIndex];
1742+
1743+
if (casting)
17381744
printTextCenter("Casting", yPos, QW_FONT_8X16, 1, false); // text, y, font type, kerning, inverted
17391745
else
17401746
printTextCenter("Xmitting", yPos, QW_FONT_8X16, 1, false); // text, y, font type, kerning, inverted
@@ -3392,7 +3398,7 @@ const uint8_t *getMacAddress()
33923398
return btMACAddress;
33933399
#endif // COMPILE_BT
33943400
#ifdef COMPILE_WIFI
3395-
if (wifiState != WIFI_OFF)
3401+
if (wifiState != WIFI_STATE_OFF)
33963402
return wifiMACAddress;
33973403
#endif // COMPILE_WIFI
33983404
#ifdef COMPILE_ETHERNET

Firmware/RTK_Surveyor/ESPNOW.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void espnowStart()
9898

9999
esp_err_t response;
100100

101-
if (wifiState == WIFI_OFF && espnowState == ESPNOW_OFF)
101+
if (wifiState == WIFI_STATE_OFF && espnowState == ESPNOW_OFF)
102102
{
103103
if (WiFi.getMode() != WIFI_STA)
104104
WiFi.mode(WIFI_STA);
@@ -112,7 +112,7 @@ void espnowStart()
112112
log_d("WiFi off, ESP-Now added to protocols");
113113
}
114114
// If WiFi is on but ESP NOW is off, then enable LR protocol
115-
else if (wifiState > WIFI_OFF && espnowState == ESPNOW_OFF)
115+
else if (wifiState > WIFI_STATE_OFF && espnowState == ESPNOW_OFF)
116116
{
117117
if (WiFi.getMode() != WIFI_STA)
118118
WiFi.mode(WIFI_STA);
@@ -239,15 +239,15 @@ void espnowStop()
239239

240240
espnowSetState(ESPNOW_OFF);
241241

242-
if (wifiState == WIFI_OFF)
242+
if (wifiState == WIFI_STATE_OFF)
243243
{
244244
// ESP Now was the only thing using the radio so turn WiFi radio off entirely
245245
WiFi.mode(WIFI_OFF);
246246

247247
log_d("WiFi Radio off entirely");
248248
}
249249
// If WiFi is on, then restart WiFi
250-
else if (wifiState > WIFI_OFF)
250+
else if (wifiState > WIFI_STATE_OFF)
251251
{
252252
log_d("ESP-Now starting WiFi");
253253
wifiStart(); // Force WiFi to restart

0 commit comments

Comments
 (0)