Skip to content

Add NTRIP Client #92

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 6 commits into from
Apr 4, 2022
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
38 changes: 20 additions & 18 deletions Firmware/RTK_Surveyor/AP-Config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -874,55 +874,57 @@ <h2>
</div>

<div class="form-group row">
<label for="wifiSSID" class="box-margin20 col-sm-3 col-4 col-form-label">WiFi
<label for="ntripServer_wifiSSID" class="box-margin20 col-sm-3 col-4 col-form-label">WiFi
SSID:</label>
<div class="col-sm-8 col-7">
<input type="text" class="form-control" id="wifiSSID">
<p id="wifiSSIDError" class="inlineError"></p>
<input type="text" class="form-control" id="ntripServer_wifiSSID">
<p id="ntripServer_wifiSSIDError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="wifiPW" class="box-margin20 col-sm-3 col-4 col-form-label">WiFi PW:</label>
<label for="ntripServer_wifiPW" class="box-margin20 col-sm-3 col-4 col-form-label">WiFi
PW:</label>
<div class="col-sm-8 col-7">
<input type="text" class="form-control" id="wifiPW">
<p id="wifiPWError" class="inlineError"></p>
<input type="text" class="form-control" id="ntripServer_wifiPW">
<p id="ntripServer_wifiPWError" class="inlineError"></p>
</div>
</div>

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

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

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

<div class="form-group row">
<label for="mountPointUploadPW" class="box-margin20 col-sm-4 col-6 col-form-label">Mount Point
<label for="ntripServer_MountPointPW" class="box-margin20 col-sm-4 col-6 col-form-label">Mount
Point
PW:</label>
<div class="col-sm-7 col-5">
<input type="text" class="form-control" id="mountPointUploadPW">
<p id="mountPointUploadPWError" class="inlineError"></p>
<input type="text" class="form-control" id="ntripServer_MountPointPW">
<p id="ntripServer_MountPointPWError" class="inlineError"></p>
</div>
</div>
</div>
Expand Down
36 changes: 18 additions & 18 deletions Firmware/RTK_Surveyor/AP-Config/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ function validateFields() {
checkElementValue("fixedLong", -180, 180, "Must be -180 to 180", "collapseBaseConfig");
checkElementValue("fixedAltitude", 0, 8849, "Must be 0 to 8849", "collapseBaseConfig");

checkElementString("wifiSSID", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
checkElementString("wifiPW", 0, 30, "Must be 0 to 30 characters", "collapseBaseConfig");
checkElementString("casterHost", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
checkElementValue("casterPort", 1, 99999, "Must be 1 to 99999", "collapseBaseConfig");
checkElementString("mountPointUpload", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
checkElementString("mountPointUploadPW", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
checkElementString("ntripServer_wifiSSID", 1, 30, "Must be 1 to 30 characters", "collapseBaseConfig");
checkElementString("ntripServer_wifiPW", 0, 30, "Must be 0 to 30 characters", "collapseBaseConfig");
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");

//System Config
checkElementValue("maxLogTime_minutes", 1, 2880, "Must be 1 to 2880", "collapseSystemConfig");
Expand Down Expand Up @@ -610,21 +610,21 @@ document.addEventListener("DOMContentLoaded", (event) => {
ge("enableNtripServer").addEventListener("change", function () {
if (ge("enableNtripServer").checked) {
//Enable NTRIP inputs
ge("wifiSSID").disabled = false;
ge("wifiPW").disabled = false;
ge("casterHost").disabled = false;
ge("casterPort").disabled = false;
ge("mountPointUpload").disabled = false;
ge("mountPointUploadPW").disabled = false;
ge("ntripServer_wifiSSID").disabled = false;
ge("ntripServer_wifiPW").disabled = false;
ge("ntripServer_CasterHost").disabled = false;
ge("ntripServer_CasterPort").disabled = false;
ge("ntripServer_MountPoint").disabled = false;
ge("ntripServer_MountPointPW").disabled = false;
}
else {
//Disable NTRIP inputs
ge("wifiSSID").disabled = true;
ge("wifiPW").disabled = true;
ge("casterHost").disabled = true;
ge("casterPort").disabled = true;
ge("mountPointUpload").disabled = true;
ge("mountPointUploadPW").disabled = true;
ge("ntripServer_wifiSSID").disabled = true;
ge("ntripServer_wifiPW").disabled = true;
ge("ntripServer_CasterHost").disabled = true;
ge("ntripServer_CasterPort").disabled = true;
ge("ntripServer_MountPoint").disabled = true;
ge("ntripServer_MountPointPW").disabled = true;
}
});

Expand Down
7 changes: 5 additions & 2 deletions Firmware/RTK_Surveyor/Base.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ bool configureUbloxModuleBase()

i2cGNSS.checkUblox(); //Regularly poll to get latest data and any RTCM

i2cGNSS.setNMEAGPGGAcallbackPtr(NULL); // Disable GPGGA call back that may have been set during Rover Client mode
i2cGNSS.disableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C); // Disable NMEA message

if (i2cGNSS.getSurveyInActive() == true)
{
log_d("Disabling survey");
Expand Down Expand Up @@ -250,9 +253,9 @@ void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
}

#ifdef COMPILE_WIFI
if (caster.connected() == true)
if (ntripServer.connected() == true)
{
caster.write(incoming); //Send this byte to socket
ntripServer.write(incoming); //Send this byte to socket
casterBytesSent++;
lastServerSent_ms = millis();
}
Expand Down
24 changes: 15 additions & 9 deletions Firmware/RTK_Surveyor/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,20 @@ void beginSD()

if (settings.enableSD == true)
{
//Max power up time is 250ms: https://www.kingston.com/datasheets/SDCIT-specsheet-64gb_en.pdf
//Max current is 200mA average across 1s, peak 300mA
delay(10);

//Do a quick test to see if a card is present
if (sdPresent() == false)
int tries = 0;
int maxTries = 5;
while (tries++ < maxTries)
{
log_d("SD card not detected");
return;
if (sdPresent() == true) break;
log_d("SD present failed. Trying again %d out of %d", tries + 1, maxTries);

//Max power up time is 250ms: https://www.kingston.com/datasheets/SDCIT-specsheet-64gb_en.pdf
//Max current is 200mA average across 1s, peak 300mA
delay(10);
}
if (tries == maxTries) return;

//If an SD card is present, allow SdFat to take over
log_d("SD card detected");

Expand All @@ -189,8 +193,8 @@ void beginSD()

if (sd.begin(SdSpiConfig(pin_microSD_CS, SHARED_SPI, SD_SCK_MHZ(settings.spiFrequency))) == false)
{
int tries = 0;
int maxTries = 1;
tries = 0;
maxTries = 1;
for ( ; tries < maxTries ; tries++)
{
log_d("SD init failed. Trying again %d out of %d", tries + 1, maxTries);
Expand Down Expand Up @@ -315,6 +319,8 @@ void stopUART2Tasks()

void beginFS()
{
#define FORMAT_LITTLEFS_IF_FAILED true

if (online.fs == false)
{
Serial.println("Starting FS");
Expand Down
46 changes: 39 additions & 7 deletions Firmware/RTK_Surveyor/Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ void updateDisplay()
case (STATE_ROVER_RTK_FIX):
paintRoverRTKFix();
break;

case (STATE_ROVER_CLIENT_WIFI_STARTED):
paintRoverWiFiStarted();
break;
case (STATE_ROVER_CLIENT_WIFI_CONNECTED):
paintRoverWiFiStarted();
break;
case (STATE_ROVER_CLIENT_STARTED):
paintRoverWiFiStarted();
break;

case (STATE_BASE_NOT_STARTED):
//Do nothing. Static display shown during state change.
break;
Expand Down Expand Up @@ -230,7 +241,7 @@ void paintWirelessIcon()
wifiIconDisplayed = true;

//Draw the icon
displayBitmap(6, 1, WiFi_Symbol_Width, WiFi_Symbol_Height, WiFi_Symbol);
displayBitmap(0, 1, WiFi_Symbol_Width, WiFi_Symbol_Height, WiFi_Symbol);
}
else
wifiIconDisplayed = false;
Expand All @@ -239,7 +250,14 @@ void paintWirelessIcon()
else if (radioState == WIFI_CONNECTED)
{
//Solid WiFi icon
displayBitmap(6, 1, WiFi_Symbol_Width, WiFi_Symbol_Height, WiFi_Symbol);
displayBitmap(0, 1, WiFi_Symbol_Width, WiFi_Symbol_Height, WiFi_Symbol);

//If we are connected to NTRIP Client, show download arrow
if(online.ntripClient == true)
displayBitmap(18, 1, DownloadArrow_Width, DownloadArrow_Height, DownloadArrow);

oled.line(0, 11, 16, 11);

}
else
{
Expand Down Expand Up @@ -480,7 +498,6 @@ void paintSIV()
if (online.display == true && online.gnss == true)
{
//Blink satellite dish icon if we don't have a fix
uint8_t fixType = fixType;
if (fixType == 3 || fixType == 4 || fixType == 5) //3D, 3D+DR, or Time
{
//Fix, turn on icon
Expand Down Expand Up @@ -509,13 +526,9 @@ void paintSIV()
oled.print(":");

if (fixType == 0) //0 = No Fix
{
oled.print("0");
}
else
{
oled.print(numSV);
}

paintResets();
} //End gnss online
Expand Down Expand Up @@ -672,6 +685,25 @@ void paintRoverRTKFix()
}
}

//Display Blinking WiFi
void paintRoverWiFiStarted()
{
if (online.display == true)
{
paintBatteryLevel(); //Top right corner

paintWirelessIcon(); //Top left corner

paintBaseState(); //Top center

paintHorizontalAccuracy();

paintSIV();

paintLogging();
}
}

//Start of base / survey in / NTRIP mode
//Screen is displayed while we are waiting for horz accuracy to drop to appropriate level
//Blink crosshair icon until we have we have horz accuracy < user defined level
Expand Down
Loading