@@ -101,7 +101,7 @@ bool ntripServerConnectCaster()
101101 if (token != NULL )
102102 {
103103 token = strtok (NULL , " //" ); // Advance to data after //
104- if (token != NULL )
104+ if (token != NULL )
105105 strcpy (settings.ntripServer_CasterHost , token);
106106 }
107107
@@ -358,22 +358,30 @@ void ntripServerUpdate()
358358
359359 // Start WiFi
360360 case NTRIP_SERVER_ON:
361- // Pause until connection timeout has passed
362- if (millis () - ntripServerLastConnectionAttempt > ntripServerConnectionAttemptTimeout)
361+ if (strlen (settings.ntripServer_wifiSSID ) == 0 )
363362 {
364- ntripServerLastConnectionAttempt = millis ();
365- wifiStart (settings.ntripServer_wifiSSID , settings.ntripServer_wifiPW );
366- ntripServerSetState (NTRIP_SERVER_WIFI_CONNECTING);
363+ Serial.println (" Error: Please enter SSID before starting NTRIP Server" );
364+ ntripClientSetState (NTRIP_SERVER_OFF);
367365 }
368366 else
369367 {
370- if (millis () - ntripServerTimeoutPrint > 1000 )
368+ // Pause until connection timeout has passed
369+ if (millis () - ntripServerLastConnectionAttempt > ntripServerConnectionAttemptTimeout)
371370 {
372- ntripServerTimeoutPrint = millis ();
373- Serial.printf (" NTRIP Server connection timeout wait: %d of %d seconds \n\r " ,
374- (millis () - ntripServerLastConnectionAttempt) / 1000 ,
375- ntripServerConnectionAttemptTimeout / 1000
376- );
371+ ntripServerLastConnectionAttempt = millis ();
372+ wifiStart (settings.ntripServer_wifiSSID , settings.ntripServer_wifiPW );
373+ ntripServerSetState (NTRIP_SERVER_WIFI_CONNECTING);
374+ }
375+ else
376+ {
377+ if (millis () - ntripServerTimeoutPrint > 1000 )
378+ {
379+ ntripServerTimeoutPrint = millis ();
380+ Serial.printf (" NTRIP Server connection timeout wait: %d of %d seconds \n\r " ,
381+ (millis () - ntripServerLastConnectionAttempt) / 1000 ,
382+ ntripServerConnectionAttemptTimeout / 1000
383+ );
384+ }
377385 }
378386 }
379387 break ;
0 commit comments