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
@@ -118,9 +127,6 @@ bool ntripServerConnectCaster()
118127 // Send the authorization credentials to the NTRIP caster
119128 ntripServer->write ((const uint8_t *)serverBuffer, strlen (serverBuffer));
120129 return true ;
121- #else // COMPILE_WIFI || COMPILE_ETHERNET
122- return false ;
123- #endif // COMPILE_WIFI || COMPILE_ETHERNET
124130}
125131
126132// Determine if the connection limit has been reached
@@ -163,7 +169,6 @@ bool ntripServerConnectLimitReached()
163169// Read the authorization response from the NTRIP caster
164170void ntripServerResponse (char *response, size_t maxLength)
165171{
166- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
167172 char *responseEnd;
168173
169174 // Make sure that we can zero terminate the response
@@ -172,7 +177,6 @@ void ntripServerResponse(char *response, size_t maxLength)
172177 // Read bytes from the caster and store them
173178 while ((response < responseEnd) && ntripServer->available ())
174179 *response++ = ntripServer->read ();
175- #endif // COMPILE_WIFI || COMPILE_ETHERNET
176180
177181 // Zero terminate the response
178182 *response = ' \0 ' ;
@@ -223,7 +227,6 @@ void ntripServerSetState(NTRIPServerState newState)
223227// This function gets called as each RTCM byte comes in
224228void ntripServerProcessRTCM (uint8_t incoming)
225229{
226- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
227230 if (ntripServerState == NTRIP_SERVER_CASTING)
228231 {
229232 // Generate and print timestamp if needed
@@ -272,13 +275,11 @@ void ntripServerProcessRTCM(uint8_t incoming)
272275 ntripServerSetState (NTRIP_SERVER_CONNECTING);
273276 rtcmParsingState = RTCM_TRANSPORT_STATE_WAIT_FOR_PREAMBLE_D3;
274277 }
275- #endif // COMPILE_WIFI || COMPILE_ETHERNET
276278}
277279
278280// Start the NTRIP server
279281void ntripServerStart ()
280282{
281- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
282283 // Stop NTRIP server and WiFi
283284 ntripServerStop (true ); // Don't allocate new wifiClient
284285
@@ -297,15 +298,11 @@ void ntripServerStart()
297298 }
298299
299300 ntripServerConnectionAttempts = 0 ;
300- #else // COMPILE_WIFI || COMPILE_ETHERNET
301- systemPrintln (" NTRIP Server not available: Ethernet and WiFi not compiled" );
302- #endif // COMPILE_WIFI || COMPILE_ETHERNET
303301}
304302
305303// Stop the NTRIP server
306304void ntripServerStop (bool wifiClientAllocated)
307305{
308- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
309306 if (ntripServer)
310307 {
311308 // Break the NTRIP server connection if necessary
@@ -332,8 +329,6 @@ void ntripServerStop(bool wifiClientAllocated)
332329
333330 // Determine the next NTRIP server state
334331 ntripServerSetState ((ntripServer && (wifiClientAllocated == false )) ? NTRIP_SERVER_ON : NTRIP_SERVER_OFF);
335- #endif // COMPILE_WIFI || COMPILE_ETHERNET
336-
337332 online.ntripServer = false ;
338333}
339334
@@ -486,7 +481,6 @@ void ntripServerUpdate()
486481 // Wait for authorization response
487482 case NTRIP_SERVER_AUTHORIZATION:
488483 // Check if caster service responded
489- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
490484 if (ntripServer->available () < strlen (" ICY 200 OK" )) // Wait until at least a few bytes have arrived
491485 {
492486 // Check for response timeout
@@ -570,11 +564,9 @@ void ntripServerUpdate()
570564 }
571565 }
572566 }
573- #endif // COMPILE_WIFI || COMPILE_ETHERNET
574567 break ;
575568 // NTRIP server authorized to send RTCM correction data to NTRIP caster
576569 case NTRIP_SERVER_CASTING:
577- #if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET)
578570 // Check for a broken connection
579571 if (!ntripServer->connected ())
580572 {
@@ -593,7 +585,8 @@ void ntripServerUpdate()
593585 // All is well
594586 cyclePositionLEDs ();
595587 }
596- #endif // COMPILE_WIFI || COMPILE_ETHERNET
597588 break ;
598589 }
599590}
591+
592+ #endif // COMPILE_NETWORK
0 commit comments