@@ -91,7 +91,7 @@ NtripClient.ino
9191
9292 NTRIP_CLIENT_OFF
9393 | ^
94- ntripClientStart | | ntripClientShutdown ()
94+ ntripClientStart | | ntripClientForceShutdown ()
9595 v |
9696 NTRIP_CLIENT_ON <--------------.
9797 | |
@@ -198,6 +198,8 @@ static uint32_t ntripClientStartTime; // For calculating uptime
198198// Throttle GGA transmission to Caster to 1 report every 5 seconds
199199unsigned long lastGGAPush;
200200
201+ bool ntripClientForcedShutdown = false ; // NTRIP Client was turned off due to an error. Don't allow restart.
202+
201203// ----------------------------------------
202204// NTRIP Client Routines
203205// ----------------------------------------
@@ -474,9 +476,10 @@ void ntripClientSetState(uint8_t newState)
474476}
475477
476478// Shutdown the NTRIP client
477- void ntripClientShutdown ()
479+ void ntripClientForceShutdown ()
478480{
479481 ntripClientStop (true );
482+ ntripClientForcedShutdown = true ; // NTRIP Client was turned off due to an error. Don't allow restart.
480483}
481484
482485// Start the NTRIP client
@@ -525,7 +528,6 @@ void ntripClientStop(bool shutdown)
525528 if (shutdown)
526529 {
527530 ntripClientSetState (NTRIP_CLIENT_OFF);
528- settings.enableNtripClient = false ;
529531 ntripClientConnectionAttempts = 0 ;
530532 ntripClientConnectionAttemptTimeout = 0 ;
531533 }
@@ -555,7 +557,8 @@ void ntripClientUpdate()
555557 switch (ntripClientState)
556558 {
557559 case NTRIP_CLIENT_OFF:
558- if (EQ_RTK_MODE (ntripClientMode) && settings.enableNtripClient )
560+ // Don't allow the client to restart if a forced shutdown occured
561+ if (ntripClientForcedShutdown == false && EQ_RTK_MODE (ntripClientMode) && settings.enableNtripClient )
559562 ntripClientStart ();
560563 break ;
561564
@@ -581,7 +584,7 @@ void ntripClientUpdate()
581584 {
582585 // Failed to allocate the ntripClient structure
583586 systemPrintln (" ERROR: Failed to allocate the ntripClient structure!" );
584- ntripClientShutdown ();
587+ ntripClientForceShutdown ();
585588 }
586589 else
587590 {
@@ -681,7 +684,7 @@ void ntripClientUpdate()
681684 settings.ntripClient_MountPoint , response);
682685
683686 // Stop NTRIP client operations
684- ntripClientShutdown ();
687+ ntripClientForceShutdown ();
685688 }
686689 else
687690 {
@@ -733,15 +736,15 @@ void ntripClientUpdate()
733736 response);
734737
735738 // Stop NTRIP client operations
736- ntripClientShutdown ();
739+ ntripClientForceShutdown ();
737740 }
738741 // Other errors returned by the caster
739742 else
740743 {
741744 systemPrintf (" NTRIP Client connected but caster responded with problem: %s\r\n " , response);
742745
743746 // Stop NTRIP client operations
744- ntripClientShutdown ();
747+ ntripClientForceShutdown ();
745748 }
746749 }
747750 break ;
0 commit comments