Skip to content

Commit d9c1ba0

Browse files
committed
Reset NTRIP connection attempts every 6 hours
1 parent c7b5c30 commit d9c1ba0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Firmware/RTK_Surveyor/NtripServer.ino

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ static uint32_t ntripServerStateLastDisplayed = 0;
7676
// * Receive RTCM correction data timeout
7777
static uint32_t ntripServerTimer;
7878

79+
//Record last connection attempt
80+
//After 6 hours, reset the connectionAttempts to enable
81+
//multi week/month base installations
82+
static uint32_t lastConnectionAttempt = 0;
83+
7984
//----------------------------------------
8085
// NTRIP Server Routines - compiled out
8186
//----------------------------------------
@@ -508,6 +513,8 @@ void ntripServerUpdate()
508513
{
509514
log_d("NTRIP Server caster failed to connect. Trying again.");
510515

516+
lastConnectionAttempt = millis();
517+
511518
//Assume service not available
512519
if (ntripServerConnectLimitReached())
513520
Serial.println("NTRIP Server failed to connect! Do you have your caster address and port correct?");
@@ -581,8 +588,19 @@ void ntripServerUpdate()
581588
ntripServerStop(false); //Allocate new wifiClient
582589
}
583590
else
591+
{
592+
//All is well
584593
cyclePositionLEDs();
585594

595+
//There may be intermintant disconnects over days or weeks
596+
//Reset the reconnect attempts every 6 hours
597+
if (ntripServerConnectionAttempts > 0 && (millis() - lastConnectionAttempt) > (1000L * 60 * 60 * 6))
598+
{
599+
ntripServerConnectionAttempts = 0;
600+
log_d("Resetting connection attempts");
601+
}
602+
}
603+
586604
break;
587605
}
588606
#endif //COMPILE_WIFI

0 commit comments

Comments
 (0)