Skip to content

Commit 29a5eb8

Browse files
author
Lee Leahy
committed
NTRIP Client: Print NTRIP client connection and timeout times
1 parent 1bc049e commit 29a5eb8

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

Firmware/RTK_Surveyor/NtripClient.ino

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,27 @@ void ntripClientUpdate()
661661
// Look for various responses
662662
if (strstr(response, "200") != nullptr) //'200' found
663663
{
664-
systemPrintf("NTRIP Client connected to %s:%d\r\n",
665-
settings.ntripClient_CasterHost,
666-
settings.ntripClient_CasterPort);
664+
// Timeout receiving NTRIP data, retry the NTRIP client connection
665+
if (online.rtc && online.gnss)
666+
{
667+
int hours;
668+
int minutes;
669+
int seconds;
670+
671+
seconds = rtc.getLocalEpoch() % SECONDS_IN_A_DAY;
672+
hours = seconds / SECONDS_IN_AN_HOUR;
673+
seconds -= hours * SECONDS_IN_AN_HOUR;
674+
minutes = seconds / SECONDS_IN_A_MINUTE;
675+
seconds -= minutes * SECONDS_IN_A_MINUTE;
676+
systemPrintf("NTRIP Client connected to %s:%d at %d:%02d:%02d\r\n",
677+
settings.ntripClient_CasterHost,
678+
settings.ntripClient_CasterPort,
679+
hours, minutes, seconds);
680+
}
681+
else
682+
systemPrintf("NTRIP Client connected to %s:%d\r\n",
683+
settings.ntripClient_CasterHost,
684+
settings.ntripClient_CasterPort);
667685

668686
// Connection is now open, start the NTRIP receive data timer
669687
ntripClientTimer = millis();
@@ -763,10 +781,26 @@ void ntripClientUpdate()
763781
// Check for timeout receiving NTRIP data
764782
if (ntripClientReceiveDataAvailable() == 0)
765783
{
784+
// Don't fail during retransmission attempts
766785
if ((millis() - ntripClientTimer) > NTRIP_CLIENT_RECEIVE_DATA_TIMEOUT)
767786
{
768787
// Timeout receiving NTRIP data, retry the NTRIP client connection
769-
systemPrintln("NTRIP Client timeout receiving data");
788+
if (online.rtc && online.gnss)
789+
{
790+
int hours;
791+
int minutes;
792+
int seconds;
793+
794+
seconds = rtc.getLocalEpoch() % SECONDS_IN_A_DAY;
795+
hours = seconds / SECONDS_IN_AN_HOUR;
796+
seconds -= hours * SECONDS_IN_AN_HOUR;
797+
minutes = seconds / SECONDS_IN_A_MINUTE;
798+
seconds -= minutes * SECONDS_IN_A_MINUTE;
799+
systemPrintf("NTRIP Client timeout receiving data at %d:%02d:%02d\r\n",
800+
hours, minutes, seconds);
801+
}
802+
else
803+
systemPrintln("NTRIP Client timeout receiving data");
770804
ntripClientRestart();
771805
}
772806
}

0 commit comments

Comments
 (0)