Skip to content

Commit adf20f8

Browse files
committed
#StopVsRestart - correct NTRIP/MQTT/Client/Server stops
1 parent a4ac2e8 commit adf20f8

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

Firmware/RTK_Everywhere/MQTT_Client.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void mqttClientUpdate()
504504
if (mqttClientState > MQTT_CLIENT_OFF)
505505
{
506506
systemPrintln("MQTT Client stopping");
507-
mqttClientStop(false);
507+
mqttClientStop(true); // Was false - #StopVsRestart
508508
mqttClientConnectionAttempts = 0;
509509
mqttClientConnectionAttemptTimeout = 0;
510510
mqttClientSetState(MQTT_CLIENT_OFF);
@@ -533,7 +533,7 @@ void mqttClientUpdate()
533533
// Determine if the network has failed
534534
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
535535
// Failed to connect to the network, attempt to restart the network
536-
mqttClientRestart();
536+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
537537

538538
// Determine if the network is connected to the media
539539
else if (networkUserConnected(NETWORK_USER_MQTT_CLIENT))
@@ -548,7 +548,7 @@ void mqttClientUpdate()
548548
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
549549
{
550550
// Failed to connect to the network, attempt to restart the network
551-
mqttClientRestart();
551+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
552552
break;
553553
}
554554

@@ -652,7 +652,7 @@ void mqttClientUpdate()
652652
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
653653
{
654654
// Failed to connect to the network, attempt to restart the network
655-
mqttClientRestart();
655+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
656656
break;
657657
}
658658

@@ -661,7 +661,7 @@ void mqttClientUpdate()
661661
{
662662
mqttClientRestart();
663663
systemPrintln("ERROR: Subscription to key distribution topic failed!!");
664-
mqttClientRestart();
664+
mqttClientRestart(); // Why twice? TODO
665665
break;
666666
}
667667

@@ -678,7 +678,7 @@ void mqttClientUpdate()
678678
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
679679
{
680680
// Failed to connect to the network, attempt to restart the network
681-
mqttClientRestart();
681+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
682682
break;
683683
}
684684

@@ -689,7 +689,7 @@ void mqttClientUpdate()
689689
{
690690
mqttClientRestart();
691691
systemPrintln("ERROR: Subscription to corrections topic failed!!");
692-
mqttClientRestart();
692+
mqttClientRestart(); // Why twice? TODO
693693
break;
694694
}
695695

@@ -711,7 +711,7 @@ void mqttClientUpdate()
711711
if (networkIsShuttingDown(NETWORK_USER_MQTT_CLIENT))
712712
{
713713
// Failed to connect to the network, attempt to restart the network
714-
mqttClientRestart();
714+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
715715
break;
716716
}
717717

Firmware/RTK_Everywhere/Network.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,14 +897,14 @@ void networkStop(uint8_t networkType)
897897
serverIndex = user - NETWORK_USER_NTRIP_SERVER;
898898
if (settings.debugNetworkLayer)
899899
systemPrintln("Network layer stopping NTRIP server");
900-
ntripServerRestart(serverIndex);
900+
ntripServerStop(serverIndex, true); // Was ntripServerRestart(serverIndex); - #StopVsRestart
901901
}
902902
break;
903903

904904
case NETWORK_USER_MQTT_CLIENT:
905905
if (settings.debugNetworkLayer)
906906
systemPrintln("Network layer stopping MQTT client");
907-
mqttClientRestart();
907+
mqttClientStop(true); // Was mqttClientRestart(); - #StopVsRestart
908908
break;
909909

910910
case NETWORK_USER_NTP_SERVER:
@@ -916,7 +916,7 @@ void networkStop(uint8_t networkType)
916916
case NETWORK_USER_NTRIP_CLIENT:
917917
if (settings.debugNetworkLayer)
918918
systemPrintln("Network layer stopping NTRIP client");
919-
ntripClientRestart();
919+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
920920
break;
921921

922922
case NETWORK_USER_OTA_AUTO_UPDATE:

Firmware/RTK_Everywhere/NtripClient.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ void ntripClientUpdate()
546546
{
547547
if (ntripClientState > NTRIP_CLIENT_OFF)
548548
{
549-
ntripClientStop(false);
549+
ntripClientStop(true); // Was false - #StopVsRestart
550550
ntripClientConnectionAttempts = 0;
551551
ntripClientConnectionAttemptTimeout = 0;
552552
ntripClientSetState(NTRIP_CLIENT_OFF);
@@ -573,7 +573,7 @@ void ntripClientUpdate()
573573
// Determine if the network has failed
574574
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
575575
// Failed to connect to to the network, attempt to restart the network
576-
ntripClientRestart();
576+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
577577

578578
// Determine if the network is connected to the media
579579
else if (networkUserConnected(NETWORK_USER_NTRIP_CLIENT))
@@ -600,7 +600,7 @@ void ntripClientUpdate()
600600
// Determine if the network has failed
601601
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
602602
// Failed to connect to to the network, attempt to restart the network
603-
ntripClientRestart();
603+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
604604

605605
// If GGA transmission is enabled, wait for GNSS lock before connecting to NTRIP Caster
606606
// If GGA transmission is not enabled, start connecting to NTRIP Caster
@@ -633,7 +633,7 @@ void ntripClientUpdate()
633633
// Determine if the network has failed
634634
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
635635
// Failed to connect to to the network, attempt to restart the network
636-
ntripClientRestart();
636+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
637637

638638
// Check for no response from the caster service
639639
else if (ntripClientReceiveDataAvailable() <
@@ -753,7 +753,7 @@ void ntripClientUpdate()
753753
// Determine if the network has failed
754754
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
755755
// Failed to connect to to the network, attempt to restart the network
756-
ntripClientRestart();
756+
ntripClientStop(true); // Was ntripClientRestart(); - #StopVsRestart
757757

758758
// Check for a broken connection
759759
else if (!ntripClient->connected())

Firmware/RTK_Everywhere/NtripServer.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ void ntripServerUpdate(int serverIndex)
580580
{
581581
if (ntripServer->state > NTRIP_SERVER_OFF)
582582
{
583-
ntripServerStop(serverIndex, false);
583+
ntripServerStop(serverIndex, true); // Was false - #StopVsRestart
584584
ntripServer->connectionAttempts = 0;
585585
ntripServer->connectionAttemptTimeout = 0;
586586
ntripServerSetState(ntripServer, NTRIP_SERVER_OFF);
@@ -610,7 +610,7 @@ void ntripServerUpdate(int serverIndex)
610610
// Determine if the network has failed
611611
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
612612
// Failed to connect to to the network, attempt to restart the network
613-
ntripServerRestart(serverIndex);
613+
ntripServerStop(serverIndex, true); // Was ntripServerRestart(serverIndex); - #StopVsRestart
614614

615615
// Determine if the network is connected to the media
616616
else if (networkUserConnected(NETWORK_USER_NTRIP_SERVER + serverIndex))
@@ -638,7 +638,7 @@ void ntripServerUpdate(int serverIndex)
638638
// Determine if the network has failed
639639
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
640640
// Failed to connect to to the network, attempt to restart the network
641-
ntripServerRestart(serverIndex);
641+
ntripServerStop(serverIndex, true); // Was ntripServerRestart(serverIndex); - #StopVsRestart
642642

643643
else if (settings.enableNtripServer &&
644644
(millis() - ntripServer->lastConnectionAttempt > ntripServer->connectionAttemptTimeout))
@@ -656,7 +656,7 @@ void ntripServerUpdate(int serverIndex)
656656
// Determine if the network has failed
657657
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
658658
// Failed to connect to to the network, attempt to restart the network
659-
ntripServerRestart(serverIndex);
659+
ntripServerStop(serverIndex, true); // Was ntripServerRestart(serverIndex); - #StopVsRestart
660660

661661
// State change handled in ntripServerProcessRTCM
662662
break;
@@ -666,7 +666,7 @@ void ntripServerUpdate(int serverIndex)
666666
// Determine if the network has failed
667667
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
668668
// Failed to connect to to the network, attempt to restart the network
669-
ntripServerRestart(serverIndex);
669+
ntripServerStop(serverIndex, true); // Was ntripServerRestart(serverIndex); - #StopVsRestart
670670

671671
// Delay before opening the NTRIP server connection
672672
else if ((millis() - ntripServer->timer) >= ntripServer->connectionAttemptTimeout)
@@ -694,7 +694,7 @@ void ntripServerUpdate(int serverIndex)
694694
// Determine if the network has failed
695695
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
696696
// Failed to connect to to the network, attempt to restart the network
697-
ntripServerRestart(serverIndex);
697+
ntripServerStop(serverIndex, true); // Was ntripServerRestart(serverIndex); - #StopVsRestart
698698

699699
// Check if caster service responded
700700
else if (ntripServer->networkClient->available() <
@@ -788,7 +788,7 @@ void ntripServerUpdate(int serverIndex)
788788
// Determine if the network has failed
789789
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
790790
// Failed to connect to the network, attempt to restart the network
791-
ntripServerRestart(serverIndex);
791+
ntripServerStop(serverIndex, true); // Was ntripServerRestart(serverIndex); - #StopVsRestart
792792

793793
// Check for a broken connection
794794
else if (!ntripServer->networkClient->connected())

0 commit comments

Comments
 (0)