@@ -155,130 +155,6 @@ bool startFixedBase()
155155 return (response);
156156}
157157
158- // Call regularly to push latest u-blox data out over local WiFi
159- // We make sure we are connected to WiFi, then
160- bool updateNtripServer ()
161- {
162- // Is WiFi setup?
163- if (WiFi.isConnected () == false )
164- {
165- // Turn off Bluetooth and turn on WiFi
166- endBluetooth ();
167-
168- Serial.printf (" Connecting to local WiFi: %s" , settings.wifiSSID );
169- WiFi.begin (settings.wifiSSID , settings.wifiPW );
170-
171- int maxTime = 10000 ;
172- long startTime = millis ();
173- while (WiFi.status () != WL_CONNECTED) {
174- delay (500 );
175- Serial.print (F (" ." ));
176-
177- if (millis () - startTime > maxTime)
178- {
179- Serial.println (F (" \n Failed to connect to WiFi. Are you sure your WiFi credentials are correct?" ));
180- return (false );
181- }
182-
183- if (Serial.available ()) return (false ); // User has pressed a key
184- }
185- Serial.println ();
186-
187- radioState = WIFI_CONNECTED;
188- } // End WiFi connect check
189-
190- // Are we connected to caster?
191- if (caster.connected () == false )
192- {
193- Serial.printf (" Opening socket to %s\n " , settings.casterHost );
194-
195- if (caster.connect (settings.casterHost , settings.casterPort ) == true ) // Attempt connection
196- {
197- Serial.printf (" Connected to %s:%d\n " , settings.casterHost , settings.casterPort );
198-
199- const int SERVER_BUFFER_SIZE = 512 ;
200- char serverBuffer[SERVER_BUFFER_SIZE];
201-
202- snprintf (serverBuffer, SERVER_BUFFER_SIZE, " SOURCE %s /%s\r\n Source-Agent: NTRIP %s/%s\r\n\r\n " ,
203- settings.mountPointPW , settings.mountPoint , ntrip_server_name, " App Version 1.0" );
204-
205- Serial.printf (" Sending credentials:\n %s\n " , serverBuffer);
206- caster.write (serverBuffer, strlen (serverBuffer));
207-
208- // Wait for response
209- unsigned long timeout = millis ();
210- while (caster.available () == 0 )
211- {
212- if (millis () - timeout > 5000 )
213- {
214- Serial.println (F (" Caster failed to respond. Do you have your caster address and port correct?" ));
215- caster.stop ();
216- delay (10 );
217- return (false );
218- }
219- delay (10 );
220- }
221-
222- delay (10 ); // Yield to RTOS
223-
224- // Check reply
225- bool connectionSuccess = false ;
226- char response[512 ];
227- int responseSpot = 0 ;
228- while (caster.available ())
229- {
230- response[responseSpot++] = caster.read ();
231- if (strstr (response, " 200" ) > 0 ) // Look for 'ICY 200 OK'
232- connectionSuccess = true ;
233- if (responseSpot == 512 - 1 ) break ;
234- }
235- response[responseSpot] = ' \0 ' ;
236- Serial.printf (" Caster responded with: %s\n " , response);
237-
238- if (connectionSuccess == false )
239- {
240- Serial.printf (" Caster responded with bad news: %s. Are you sure your caster credentials are correct?" , response);
241- }
242- else
243- {
244- // We're connected!
245- Serial.println (F (" Connected to caster" ));
246-
247- // Reset flags
248- lastServerReport_ms = millis ();
249- lastServerSent_ms = millis ();
250- casterBytesSent = 0 ;
251- }
252- } // End attempt to connect
253- else
254- {
255- Serial.println (F (" Failed to connect to caster. Are you sure your Caster address is correct?" ));
256- delay (10 ); // Give RTOS some time
257- return (false );
258- }
259- } // End connected == false
260-
261-
262- // Close socket if we don't have new data for 10s
263- // RTK2Go will ban your IP address if you abuse it. See http://www.rtk2go.com/how-to-get-your-ip-banned/
264- // So let's not leave the socket open/hanging without data
265- if (millis () - lastServerSent_ms > maxTimeBeforeHangup_ms)
266- {
267- Serial.println (F (" RTCM timeout. Disconnecting from caster." ));
268- caster.stop ();
269- return (false );
270- }
271-
272- // Report some statistics every 250
273- if (millis () - lastServerReport_ms > 250 )
274- {
275- lastServerReport_ms = millis ();
276- Serial.printf (" Total bytes sent to caster: %d\n " , casterBytesSent);
277- }
278-
279- return (true );
280- }
281-
282158// This function gets called from the SparkFun u-blox Arduino Library.
283159// As each RTCM byte comes in you can specify what to do with it
284160// Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
@@ -295,7 +171,7 @@ void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
295171 // Check for too many digits
296172 if (logIncreasing == true )
297173 {
298- if (rtcmPacketsSent > 999 ) rtcmPacketsSent = 1 ; // Trim to three digits to avoid logging icon
174+ if (rtcmPacketsSent > 999 ) rtcmPacketsSent = 1 ; // Trim to three digits to avoid log icon
299175 }
300176 else
301177 {
0 commit comments