1+ #if !COMPILE_NETWORK
2+
3+ void ntripServerProcessRTCM (uint8_t incoming) {}
4+ void ntripServerStart ()
5+ {
6+ systemPrintln (" NTRIP Server not available: Ethernet and WiFi not compiled" );
7+ }
8+ void ntripServerStop (bool clientAllocated) {online.ntripServer = false ;}
9+ void ntripServerUpdate () {}
10+
11+ #else // COMPILE_NETWORK
12+
113/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
214 NTRIP Server States:
315 NTRIP_SERVER_OFF: WiFi off or using NTRIP Client
@@ -60,9 +72,7 @@ static const int MAX_NTRIP_SERVER_CONNECTION_ATTEMPTS = 30;
6072// ----------------------------------------
6173
6274// WiFi connection used to push RTCM to NTRIP caster over WiFi
63- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
6475static NTRIPClient *ntripServer;
65- #endif // COMPILE_WIFI || COMPILE_ETHERNET
6676
6777// Count of bytes sent by the NTRIP server to the NTRIP caster
6878uint32_t ntripServerBytesSent = 0 ;
@@ -82,7 +92,6 @@ static uint32_t ntripServerStateLastDisplayed = 0;
8292// Initiate a connection to the NTRIP caster
8393bool ntripServerConnectCaster ()
8494{
85- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
8695 const int SERVER_BUFFER_SIZE = 512 ;
8796 char serverBuffer[SERVER_BUFFER_SIZE];
8897
@@ -119,9 +128,6 @@ bool ntripServerConnectCaster()
119128 // Send the authorization credentials to the NTRIP caster
120129 ntripServer->write ((const uint8_t *)serverBuffer, strlen (serverBuffer));
121130 return true ;
122- #else // COMPILE_WIFI || COMPILE_ETHERNET
123- return false ;
124- #endif // COMPILE_WIFI || COMPILE_ETHERNET
125131}
126132
127133// Determine if the connection limit has been reached
@@ -164,7 +170,6 @@ bool ntripServerConnectLimitReached()
164170// Read the authorization response from the NTRIP caster
165171void ntripServerResponse (char *response, size_t maxLength)
166172{
167- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
168173 char *responseEnd;
169174
170175 // Make sure that we can zero terminate the response
@@ -173,7 +178,6 @@ void ntripServerResponse(char *response, size_t maxLength)
173178 // Read bytes from the caster and store them
174179 while ((response < responseEnd) && ntripServer->available ())
175180 *response++ = ntripServer->read ();
176- #endif // COMPILE_WIFI || COMPILE_ETHERNET
177181
178182 // Zero terminate the response
179183 *response = ' \0 ' ;
@@ -224,7 +228,6 @@ void ntripServerSetState(NTRIPServerState newState)
224228// This function gets called as each RTCM byte comes in
225229void ntripServerProcessRTCM (uint8_t incoming)
226230{
227- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
228231 if (ntripServerState == NTRIP_SERVER_CASTING)
229232 {
230233 // Generate and print timestamp if needed
@@ -273,13 +276,11 @@ void ntripServerProcessRTCM(uint8_t incoming)
273276 ntripServerSetState (NTRIP_SERVER_CONNECTING);
274277 rtcmParsingState = RTCM_TRANSPORT_STATE_WAIT_FOR_PREAMBLE_D3;
275278 }
276- #endif // COMPILE_WIFI || COMPILE_ETHERNET
277279}
278280
279281// Start the NTRIP server
280282void ntripServerStart ()
281283{
282- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
283284 // Stop NTRIP server and WiFi
284285 ntripServerStop (true ); // Don't allocate new wifiClient
285286
@@ -298,15 +299,11 @@ void ntripServerStart()
298299 }
299300
300301 ntripServerConnectionAttempts = 0 ;
301- #else // COMPILE_WIFI || COMPILE_ETHERNET
302- systemPrintln (" NTRIP Server not available: Ethernet and WiFi not compiled" );
303- #endif // COMPILE_WIFI || COMPILE_ETHERNET
304302}
305303
306304// Stop the NTRIP server
307305void ntripServerStop (bool wifiClientAllocated)
308306{
309- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
310307 if (ntripServer)
311308 {
312309 // Break the NTRIP server connection if necessary
@@ -333,8 +330,6 @@ void ntripServerStop(bool wifiClientAllocated)
333330
334331 // Determine the next NTRIP server state
335332 ntripServerSetState ((ntripServer && (wifiClientAllocated == false )) ? NTRIP_SERVER_ON : NTRIP_SERVER_OFF);
336- #endif // COMPILE_WIFI || COMPILE_ETHERNET
337-
338333 online.ntripServer = false ;
339334}
340335
@@ -487,7 +482,6 @@ void ntripServerUpdate()
487482 // Wait for authorization response
488483 case NTRIP_SERVER_AUTHORIZATION:
489484 // Check if caster service responded
490- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
491485 if (ntripServer->available () < strlen (" ICY 200 OK" )) // Wait until at least a few bytes have arrived
492486 {
493487 // Check for response timeout
@@ -571,11 +565,9 @@ void ntripServerUpdate()
571565 }
572566 }
573567 }
574- #endif // COMPILE_WIFI || COMPILE_ETHERNET
575568 break ;
576569 // NTRIP server authorized to send RTCM correction data to NTRIP caster
577570 case NTRIP_SERVER_CASTING:
578- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
579571 // Check for a broken connection
580572 if (!ntripServer->connected ())
581573 {
@@ -594,7 +586,8 @@ void ntripServerUpdate()
594586 // All is well
595587 cyclePositionLEDs ();
596588 }
597- #endif // COMPILE_WIFI || COMPILE_ETHERNET
598589 break ;
599590 }
600591}
592+
593+ #endif // COMPILE_NETWORK
0 commit comments