Skip to content

Commit 0b5f737

Browse files
authored
Merge pull request #515 from LeeLeahy2/issue-429-ntrip-server-restart
NTRIP Server: Fix WiFi retry cases
2 parents 7aa7e6d + 23ebabe commit 0b5f737

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

Firmware/RTK_Surveyor/NtripServer.ino

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ bool ntripServerConnectLimitReached()
140140
if (ntripServerConnectionAttempts == 1)
141141
ntripServerConnectionAttemptTimeout = 15 * 1000L; // Wait 15s
142142
else if (ntripServerConnectionAttempts == 2)
143-
ntripServerConnectionAttemptTimeout = 30 * 1000L; // Wait 30s
143+
ntripServerConnectionAttemptTimeout = 30 * 1000L; // Wait 30s
144144
else if (ntripServerConnectionAttempts == 3)
145145
ntripServerConnectionAttemptTimeout = 1 * 60 * 1000L; // Wait 1 minute
146146
else if (ntripServerConnectionAttempts == 4)
147-
ntripServerConnectionAttemptTimeout = 2 * 60 * 1000L; // Wait 2 minutes
148-
else
147+
ntripServerConnectionAttemptTimeout = 2 * 60 * 1000L; // Wait 2 minutes
148+
else
149149
ntripServerConnectionAttemptTimeout =
150150
(ntripServerConnectionAttempts - 4) * 5 * 60 * 1000L; // Wait 5, 10, 15, etc minutes between attempts
151151

@@ -464,10 +464,8 @@ void ntripServerUpdate()
464464
{
465465
// Assume service not available
466466
if (ntripServerConnectLimitReached()) // Update ntripServerConnectionAttemptTimeout
467-
{
468467
systemPrintln("NTRIP Server failed to connect! Do you have your caster address and port correct?");
469-
}
470-
else
468+
else
471469
{
472470
if (ntripServerConnectionAttemptTimeout / 1000 < 120)
473471
systemPrintf("NTRIP Server failed to connect to caster. Trying again in %d seconds.\r\n",
@@ -495,12 +493,7 @@ void ntripServerUpdate()
495493
if (millis() - ntripServerTimer > 10000)
496494
{
497495
if (ntripServerConnectLimitReached())
498-
{
499496
systemPrintln("Caster failed to respond. Do you have your caster address and port correct?");
500-
501-
// Give up - Shutdown NTRIP server, no further retries
502-
ntripServerStop(true);
503-
}
504497
else
505498
{
506499
if (ntripServerConnectionAttemptTimeout / 1000 < 120)
@@ -563,13 +556,8 @@ void ntripServerUpdate()
563556

564557
// Check for connection limit
565558
if (ntripServerConnectLimitReached())
566-
{
567559
systemPrintln("NTRIP Server retry limit reached; do you have your caster address and port correct?");
568560

569-
// Give up - Shutdown NTRIP server, no further retries
570-
ntripServerStop(true);
571-
}
572-
573561
// Attempt to reconnect after throttle controlled timeout
574562
else
575563
{
@@ -579,9 +567,6 @@ void ntripServerUpdate()
579567
else
580568
systemPrintf("NTRIP Server attempting connection in %d minutes.\r\n",
581569
ntripServerConnectionAttemptTimeout / 1000 / 60);
582-
583-
// Restart network operation after delay
584-
ntripServerStop(false);
585570
}
586571
}
587572
}

0 commit comments

Comments
 (0)