Skip to content

Increase NTRIP_SERVER_MAX from 1 to 2 #766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 82 additions & 20 deletions Firmware/RTK_Surveyor/AP-Config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -814,66 +814,128 @@

<div id="ntripServerConfig" class="collapse mb-2">
<div class="form-group row">
<label for="ntripServer_CasterHost"
<label for="ntripServer_CasterHost_0"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
Host:</label>
Host 0:</label>
<div class="col-sm-8 col-6">
<input type="text" class="form-control" id="ntripServer_CasterHost">
<input type="text" class="form-control" id="ntripServer_CasterHost_0">
<p id="ntripServer_CasterHostError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServer_CasterPort"
<label for="ntripServerCasterPort_0"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
Port:</label>
Port 0:</label>
<div class="col-sm-8 col-6">
<input type="number" class="form-control" id="ntripServer_CasterPort">
<input type="number" class="form-control" id="ntripServerCasterPort_0">
<p id="ntripServer_CasterPortError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServer_CasterUser"
<label for="ntripServerCasterUser_0"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
User:</label>
User 0:</label>
<div class="col-sm-8 col-6">
<input type="text" class="form-control" id="ntripServer_CasterUser">
<input type="text" class="form-control" id="ntripServerCasterUser_0">
<p id="ntripServer_CasterUserError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServer_CasterUserPW"
<label for="ntripServerCasterUserPW_0"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
User PW:</label>
User PW 0:</label>
<div class="col-sm-8 col-6">
<input type="text" class="form-control" id="ntripServer_CasterUserPW">
<input type="text" class="form-control" id="ntripServerCasterUserPW_0">
<p id="ntripServer_CasterUserPWError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServer_MountPoint" class="box-margin20 col-sm-3 col-5 col-form-label">Mount
Point:</label>
<label for="ntripServerMountPoint_0" class="box-margin20 col-sm-3 col-5 col-form-label">Mount
Point 0:</label>
<div class="col-sm-8 col-6">
<input type="text" class="form-control" id="ntripServer_MountPoint">
<input type="text" class="form-control" id="ntripServerMountPoint_0">
<p id="ntripServer_MountPointError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServer_MountPointPW"
<label for="ntripServerMountPointPW_0"
class="box-margin20 col-sm-4 col-6 col-form-label">Mount
Point
PW:</label>
PW 0:</label>
<div class="col-sm-7 col-5">
<input type="text" class="form-control" id="ntripServer_MountPointPW">
<input type="text" class="form-control" id="ntripServerMountPointPW_0">
<p id="ntripServer_MountPointPWError" class="inlineError"></p>
</div>
</div>

<!-- For future expansion
<br>

<div class="form-group row">
<label for="ntripServer_CasterHost_1"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
Host 1:</label>
<div class="col-sm-8 col-6">
<input type="text" class="form-control" id="ntripServer_CasterHost_1">
<p id="ntripServer_CasterHostError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServerCasterPort_1"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
Port 1:</label>
<div class="col-sm-8 col-6">
<input type="number" class="form-control" id="ntripServerCasterPort_1">
<p id="ntripServer_CasterPortError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServerCasterUser_1"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
User 1:</label>
<div class="col-sm-8 col-6">
<input type="text" class="form-control" id="ntripServerCasterUser_1">
<p id="ntripServer_CasterUserError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServerCasterUserPW_1"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
User PW 1:</label>
<div class="col-sm-8 col-6">
<input type="text" class="form-control" id="ntripServerCasterUserPW_1">
<p id="ntripServer_CasterUserPWError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServerMountPoint_1" class="box-margin20 col-sm-3 col-5 col-form-label">Mount
Point 1:</label>
<div class="col-sm-8 col-6">
<input type="text" class="form-control" id="ntripServerMountPoint_1">
<p id="ntripServer_MountPointError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="ntripServerMountPointPW_1"
class="box-margin20 col-sm-4 col-6 col-form-label">Mount
Point
PW 1:</label>
<div class="col-sm-7 col-5">
<input type="text" class="form-control" id="ntripServerMountPointPW_1">
<p id="ntripServer_MountPointPWError" class="inlineError"></p>
</div>
</div>

<!-- For future expansion
<div id="allowWiFiOverEthernetServer">
<div class="form-check mt-1 box-margin20">
<label class="form-check-label" for="ntripUseWiFiNotEthernet">Use WiFi for NTRIP Server - not Ethernet</label>
Expand Down Expand Up @@ -1948,4 +2010,4 @@
</script>
</body>

</html>
</html>
36 changes: 25 additions & 11 deletions Firmware/RTK_Surveyor/AP-Config/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,18 +547,32 @@ function validateFields() {
}

if (ge("enableNtripServer").checked == true) {
checkElementString("ntripServer_CasterHost", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
checkElementValue("ntripServer_CasterPort", 1, 99999, "Must be 1 to 99999", "collapseBaseConfig");
checkElementString("ntripServer_MountPoint", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
checkElementString("ntripServer_MountPointPW", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
checkElementString("ntripServerCasterHost_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementValue("ntripServerCasterPort_0", 1, 99999, "Must be 1 to 99999", "collapseBaseConfig");
checkElementString("ntripServerUser_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementString("ntripServerUserPW_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementString("ntripServerMountPoint_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementString("ntripServerMountPointPW_0", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementString("ntripServerCasterHost_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementValue("ntripServerCasterPort_1", 1, 99999, "Must be 1 to 99999", "collapseBaseConfig");
checkElementString("ntripServerUser_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementString("ntripServerUserPW_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementString("ntripServerMountPoint_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkElementString("ntripServerMountPointPW_1", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
}
else {
clearElement("ntripServer_CasterHost", "rtk2go.com");
clearElement("ntripServer_CasterPort", 2101);
clearElement("ntripServer_CasterUser", "");
clearElement("ntripServer_CasterUserPW", "");
clearElement("ntripServer_MountPoint", "bldr_dwntwn2");
clearElement("ntripServer_MountPointPW", "WR5wRo4H");
clearElement("ntripServerCasterHost_0", "rtk2go.com");
clearElement("ntripServerCasterPort_0", 2101);
clearElement("ntripServerCasterUser_0", "[email protected]");
clearElement("ntripServerCasterUserPW_0", "");
clearElement("ntripServerMountPoint_0", "bldr_dwntwn2");
clearElement("ntripServerMountPointPW_0", "WR5wRo4H");
clearElement("ntripServerCasterHost_1", "");
clearElement("ntripServerCasterPort_1", 0);
clearElement("ntripServerCasterUser_1", "");
clearElement("ntripServerCasterUserPW_1", "");
clearElement("ntripServerMountPoint_1", "");
clearElement("ntripServerMountPointPW_1", "");
}
}

Expand Down Expand Up @@ -2006,4 +2020,4 @@ function printableInputType(coordinateInputType) {
break;
}
return ("Unknown");
}
}
6 changes: 4 additions & 2 deletions Firmware/RTK_Surveyor/Base.ino
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ void DevUBLOXGNSS::processRTCM(uint8_t incoming)
rtcmLastReceived = millis();
rtcmBytesSent++;

ntripServerProcessRTCM(incoming);
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
ntripServerProcessRTCM(serverIndex, incoming);

espnowProcessRTCM(incoming);
}
Expand Down Expand Up @@ -391,7 +392,8 @@ void processRTCMBuffer()
rtcmLastReceived = millis();
rtcmBytesSent++;

ntripServerProcessRTCM(incoming);
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
ntripServerProcessRTCM(serverIndex, incoming);

espnowProcessRTCM(incoming);
}
Expand Down
8 changes: 4 additions & 4 deletions Firmware/RTK_Surveyor/Developer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ void ntripClientValidateTables() {}
// NTRIP server
//----------------------------------------

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

Expand Down
20 changes: 13 additions & 7 deletions Firmware/RTK_Surveyor/Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ uint32_t setRadioIcons()

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

// Do we have WiFi or ESP
if (wifiState > WIFI_OFF)
if (wifiState > WIFI_STATE_OFF)
icons |= setWiFiIcon_TwoRadios();
else if (espnowState > ESPNOW_OFF)
icons |= setESPNowIcon_TwoRadios();
Expand Down Expand Up @@ -976,7 +976,7 @@ uint32_t setWiFiIcon_TwoRadios()
{
uint32_t icons = 0;

if (wifiState == WIFI_CONNECTED)
if (wifiState == WIFI_STATE_CONNECTED)
{
// Limit how often we update this spot
if (millis() - firstRadioSpotTimer > 2000)
Expand Down Expand Up @@ -1063,7 +1063,7 @@ uint32_t setWiFiIcon_ThreeRadios()
{
uint32_t icons = 0;

if (wifiState == WIFI_CONNECTED)
if (wifiState == WIFI_STATE_CONNECTED)
{
// Limit how often we update this spot
if (millis() - thirdRadioSpotTimer > 2000)
Expand Down Expand Up @@ -1152,7 +1152,7 @@ uint32_t setWiFiIcon()

if (online.display == true)
{
if (wifiState == WIFI_CONNECTED)
if (wifiState == WIFI_STATE_CONNECTED)
{
icons |= ICON_WIFI_SYMBOL_3_RIGHT;
}
Expand Down Expand Up @@ -1734,7 +1734,13 @@ void printTextwithKerning(const char *newText, uint8_t xPos, uint8_t yPos, uint8
void paintRTCM()
{
int yPos = 17;
if (ntripServerIsCasting())

// Determine if the NTRIP Server is casting
bool casting = false;
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
casting |= online.ntripServer[serverIndex];

if (casting)
printTextCenter("Casting", yPos, QW_FONT_8X16, 1, false); // text, y, font type, kerning, inverted
else
printTextCenter("Xmitting", yPos, QW_FONT_8X16, 1, false); // text, y, font type, kerning, inverted
Expand Down Expand Up @@ -3392,7 +3398,7 @@ const uint8_t *getMacAddress()
return btMACAddress;
#endif // COMPILE_BT
#ifdef COMPILE_WIFI
if (wifiState != WIFI_OFF)
if (wifiState != WIFI_STATE_OFF)
return wifiMACAddress;
#endif // COMPILE_WIFI
#ifdef COMPILE_ETHERNET
Expand Down
8 changes: 4 additions & 4 deletions Firmware/RTK_Surveyor/ESPNOW.ino
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void espnowStart()

esp_err_t response;

if (wifiState == WIFI_OFF && espnowState == ESPNOW_OFF)
if (wifiState == WIFI_STATE_OFF && espnowState == ESPNOW_OFF)
{
if (WiFi.getMode() != WIFI_STA)
WiFi.mode(WIFI_STA);
Expand All @@ -112,7 +112,7 @@ void espnowStart()
log_d("WiFi off, ESP-Now added to protocols");
}
// If WiFi is on but ESP NOW is off, then enable LR protocol
else if (wifiState > WIFI_OFF && espnowState == ESPNOW_OFF)
else if (wifiState > WIFI_STATE_OFF && espnowState == ESPNOW_OFF)
{
if (WiFi.getMode() != WIFI_STA)
WiFi.mode(WIFI_STA);
Expand Down Expand Up @@ -239,15 +239,15 @@ void espnowStop()

espnowSetState(ESPNOW_OFF);

if (wifiState == WIFI_OFF)
if (wifiState == WIFI_STATE_OFF)
{
// ESP Now was the only thing using the radio so turn WiFi radio off entirely
WiFi.mode(WIFI_OFF);

log_d("WiFi Radio off entirely");
}
// If WiFi is on, then restart WiFi
else if (wifiState > WIFI_OFF)
else if (wifiState > WIFI_STATE_OFF)
{
log_d("ESP-Now starting WiFi");
wifiStart(); // Force WiFi to restart
Expand Down
Loading