Skip to content

Commit 18ad8f3

Browse files
committed
Increase aggressiveness of reconnect timeout
1 parent 517d359 commit 18ad8f3

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

Firmware/RTK_Surveyor/NtripClient.ino

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,17 @@ bool ntripClientConnectLimitReached()
317317

318318
if (limitReached == false)
319319
{
320-
ntripClientConnectionAttemptTimeout =
321-
ntripClientConnectionAttempts * 15 * 1000L; // Wait 15, 30, 45, etc seconds between attempts
320+
if (ntripClientConnectionAttempts == 1)
321+
ntripClientConnectionAttemptTimeout = 15 * 1000L; // Wait 15s
322+
else if (ntripClientConnectionAttempts == 2)
323+
ntripClientConnectionAttemptTimeout = 30 * 1000L; // Wait 30s
324+
else if (ntripClientConnectionAttempts == 3)
325+
ntripClientConnectionAttemptTimeout = 1 * 60 * 1000L; // Wait 1 minute
326+
else if (ntripClientConnectionAttempts == 4)
327+
ntripClientConnectionAttemptTimeout = 2 * 60 * 1000L; // Wait 2 minutes
328+
else
329+
ntripClientConnectionAttemptTimeout =
330+
(ntripClientConnectionAttempts - 4) * 5 * 60 * 1000L; // Wait 5, 10, 15, etc minutes between attempts
322331

323332
// Display the delay before starting the NTRIP client
324333
if (settings.debugNtripClientState && ntripClientConnectionAttemptTimeout)
@@ -668,19 +677,17 @@ void ntripClientUpdate()
668677
// We got a response, now check it for possible errors
669678
if (strcasestr(response, "banned") != nullptr)
670679
{
671-
systemPrintf("NTRIP Client connected to caster but caster responded with problem: %s\r\n",
680+
systemPrintf("NTRIP Client connected to caster but caster responded with banned error: %s\r\n",
672681
response);
673682

674-
// Stop NTRIP client operations
675-
ntripClientShutdown();
683+
ntripClientConnectLimitReached(); //Re-attempted after a period of time. Shuts down NTRIP Client if limit reached.
676684
}
677685
else if (strcasestr(response, "sandbox") != nullptr)
678686
{
679-
systemPrintf("NTRIP Client connected to caster but caster responded with problem: %s\r\n",
687+
systemPrintf("NTRIP Client connected to caster but caster responded with sandbox error: %s\r\n",
680688
response);
681689

682-
// Stop NTRIP client operations
683-
ntripClientShutdown();
690+
ntripClientConnectLimitReached(); //Re-attempted after a period of time. Shuts down NTRIP Client if limit reached.
684691
}
685692
else if (strcasestr(response, "SOURCETABLE") != nullptr)
686693
{
@@ -744,7 +751,7 @@ void ntripClientUpdate()
744751
{
745752
// Look for '401 Unauthorized'
746753
systemPrintf(
747-
"NTRIP Caster responded with bad news: %s. Are you sure your caster credentials are correct?\r\n",
754+
"NTRIP Caster responded with unauthorized error: %s. Are you sure your caster credentials are correct?\r\n",
748755
response);
749756

750757
// Stop NTRIP client operations

0 commit comments

Comments
 (0)