Skip to content
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
59 changes: 31 additions & 28 deletions Firmware/RTK_Everywhere/Developer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,6 @@ void networkUserRemove(NETCONSUMER_t consumer, const char * fileName, uint32_t l
void networkValidateIndex(NetIndex_t index) {}
void networkVerifyTables() {}

//----------------------------------------
// NTRIP client
//----------------------------------------

void ntripClientPrintStatus() {systemPrintln("**NTRIP Client not compiled**");}
void ntripClientStop(bool clientAllocated) {online.ntripClient = false;}
void ntripClientUpdate() {}
void ntripClientValidateTables() {}

//----------------------------------------
// NTRIP server
//----------------------------------------

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 shutdown) {online.ntripServer[serverIndex] = false;}
void ntripServerUpdate() {}
void ntripServerValidateTables() {}
bool ntripServerIsCasting(int serverIndex) {
return (false);
}

//----------------------------------------
// TCP client
//----------------------------------------
Expand Down Expand Up @@ -131,6 +109,18 @@ void otaVerifyTables() {}

#endif // COMPILE_OTA_AUTO

//----------------------------------------
// HTTP Client
//----------------------------------------

#ifndef COMPILE_HTTP_CLIENT

void httpClientPrintStatus() {}
void httpClientUpdate() {}
void httpClientValidateTables() {}

#endif // COMPILE_HTTP_CLIENT

//----------------------------------------
// MQTT Client
//----------------------------------------
Expand All @@ -147,16 +137,29 @@ void mqttClientValidateTables() {}
#endif // COMPILE_MQTT_CLIENT

//----------------------------------------
// HTTP Client
// NTRIP client
//----------------------------------------

#ifndef COMPILE_HTTP_CLIENT
#ifndef COMPILE_NTRIP_CLIENT
void ntripClientPrintStatus() {systemPrintln("**NTRIP Client not compiled**");}
void ntripClientPushGGA(const char * ggaString) {}
void ntripClientStop(bool clientAllocated) {online.ntripClient = false;}
void ntripClientUpdate() {}
void ntripClientValidateTables() {}
#endif // COMPILE_NTRIP_CLIENT

void httpClientPrintStatus() {}
void httpClientUpdate() {}
void httpClientValidateTables() {}
//----------------------------------------
// NTRIP server
//----------------------------------------

#endif // COMPILE_HTTP_CLIENT
#ifndef COMPILE_NTRIP_SERVER
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 shutdown) {online.ntripServer[serverIndex] = false;}
void ntripServerUpdate() {}
void ntripServerValidateTables() {}
#endif // COMPILE_NTRIP_SERVER

//----------------------------------------
// Web Server
Expand Down
46 changes: 10 additions & 36 deletions Firmware/RTK_Everywhere/GNSS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ GNSS.ino
GNSS layer implementation
------------------------------------------------------------------------------*/

extern int NTRIPCLIENT_MS_BETWEEN_GGA;

#ifdef COMPILE_NETWORK
extern NetworkClient *ntripClient;
#endif // COMPILE_NETWORK

extern unsigned long lastGGAPush;

//----------------------------------------
// Setup the general configuration of the GNSS
// Not Rover or Base specific (ie, baud rates)
Expand Down Expand Up @@ -92,38 +84,20 @@ static void pushGPGGA(char *ggaData)

if (xSemaphoreTake(reentrant, 10 / portTICK_PERIOD_MS) == pdPASS)
{
if (ggaData)
{
snprintf(storedGPGGA, sizeof(storedGPGGA), "%s", ggaData);
xSemaphoreGive(reentrant);
return;
}

#ifdef COMPILE_NETWORK
// Wait until the client has been created
if (ntripClient != nullptr)
do
{
// Provide the caster with our current position as needed
if (ntripClient->connected() && settings.ntripClient_TransmitGGA == true)
// Save the ggaData string
if (ggaData)
{
if ((millis() - lastGGAPush) > NTRIPCLIENT_MS_BETWEEN_GGA)
{
lastGGAPush = millis();

if ((settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_GGA)) && !inMainMenu)
{
PERIODIC_CLEAR(PD_NTRIP_CLIENT_GGA);
systemPrintf("NTRIP Client pushing GGA to server: %s", (const char *)storedGPGGA);
}

// Push our current GGA sentence to caster
if (strlen(storedGPGGA) > 0)
ntripClient->write((const uint8_t *)storedGPGGA, strlen(storedGPGGA));
}
snprintf(storedGPGGA, sizeof(storedGPGGA), "%s", ggaData);
break;
}
}
#endif // COMPILE_NETWORK

// Verify that a GGA string has been saved
if (storedGPGGA[0])
// Push our current GGA sentence to caster
ntripClientPushGGA(storedGPGGA);
} while (0);
xSemaphoreGive(reentrant);
}
}
Expand Down
32 changes: 30 additions & 2 deletions Firmware/RTK_Everywhere/NtripClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ NtripClient.ino

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#ifdef COMPILE_NETWORK
#ifdef COMPILE_NTRIP_CLIENT

//----------------------------------------
// Constants
Expand Down Expand Up @@ -494,6 +494,34 @@ void ntripClientPrintStatus()
}
}

//----------------------------------------
// Push GGA string to the NTRIP caster
//----------------------------------------
void ntripClientPushGGA(const char * ggaString)
{
// Wait until the client has been created
if (ntripClient != nullptr)
{
// Provide the caster with our current position as needed
if (ntripClient->connected() && settings.ntripClient_TransmitGGA == true)
{
if ((millis() - lastGGAPush) > NTRIPCLIENT_MS_BETWEEN_GGA)
{
lastGGAPush = millis();

if ((settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_GGA)) && !inMainMenu)
{
PERIODIC_CLEAR(PD_NTRIP_CLIENT_GGA);
systemPrintf("NTRIP Client pushing GGA to server: %s", ggaString);
}

// Push the current GGA sentence to caster
ntripClient->write((const uint8_t *)ggaString, strlen(ggaString));
}
}
}
}

//----------------------------------------
// Determine if NTRIP client data is available
//----------------------------------------
Expand Down Expand Up @@ -972,4 +1000,4 @@ void ntripClientValidateTables()
reportFatalError("Fix ntripClientStateNameEntries to match NTRIPClientState");
}

#endif // COMPILE_NETWORK
#endif // COMPILE_NTRIP_CLIENT
4 changes: 2 additions & 2 deletions Firmware/RTK_Everywhere/NtripServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ NtripServer.ino

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#ifdef COMPILE_NETWORK
#ifdef COMPILE_NTRIP_SERVER

//----------------------------------------
// Constants
Expand Down Expand Up @@ -877,4 +877,4 @@ void ntripServerValidateTables()
reportFatalError("Fix ntripServerStateNameEntries to match NTRIPServerState");
}

#endif // COMPILE_NETWORK
#endif // COMPILE_NTRIP_SERVER
10 changes: 6 additions & 4 deletions Firmware/RTK_Everywhere/RTK_Everywhere.ino
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@

#if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET) || defined(COMPILE_CELLULAR)
#define COMPILE_NETWORK
#define COMPILE_MQTT_CLIENT // Comment out to remove MQTT Client functionality
#define COMPILE_OTA_AUTO // Comment out to disable automatic over-the-air firmware update
#define COMPILE_HTTP_CLIENT // Comment out to disable HTTP Client (PointPerfect ZTP) functionality
#define COMPILE_MQTT_CLIENT // Comment out to remove MQTT Client functionality
#define COMPILE_NTRIP_CLIENT // Comment out to remove NTRIP client functionality
#define COMPILE_NTRIP_SERVER // Comment out to remove NTRIP server functionality
#define COMPILE_OTA_AUTO // Comment out to disable automatic over-the-air firmware update
#define COMPILE_HTTP_CLIENT // Comment out to disable HTTP Client (PointPerfect ZTP) functionality
#endif // COMPILE_WIFI || COMPILE_ETHERNET || COMPILE_CELLULAR

// Always define ENABLE_DEVELOPER to enable its use in conditional statements
Expand Down Expand Up @@ -1592,7 +1594,7 @@ bool logLengthExceeded() // Limit individual files to maxLogLength_minutes

if (nextLogTime_ms == 0) // Keep logging if nextLogTime_ms has not been set
return false;

// Note: this will roll over every 49.71 days...
// Solution: https://stackoverflow.com/a/3097744 - see issue #742
return (!((long)(nextLogTime_ms - millis()) > 0));
Expand Down
10 changes: 10 additions & 0 deletions Firmware/RTK_Everywhere/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ sed -i 's|#define COMPILE_MOSAICX5|//#define COMPILE_MOSAICX5|' RTK_Everywhere.i
make
git reset --hard --quiet HEAD

# NTRIP Client
sed -i 's|#define COMPILE_NTRIP_CLIENT|//#define COMPILE_NTRIP_CLIENT|' RTK_Everywhere.ino
make
git reset --hard --quiet HEAD

# NTRIP Server
sed -i 's|#define COMPILE_NTRIP_SERVER|//#define COMPILE_NTRIP_SERVER|' RTK_Everywhere.ino
make
git reset --hard --quiet HEAD

# UM980
sed -i 's|#define COMPILE_UM980|//#define COMPILE_UM980|' RTK_Everywhere.ino
make
Expand Down