Skip to content

Commit 3e3d20d

Browse files
author
Lee Leahy
committed
NTRIP Client: Receive up to a buffer at once from the network
1 parent ab994bf commit 3e3d20d

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Firmware/RTK_Surveyor/NtripClient.ino

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -758,25 +758,25 @@ void ntripClientUpdate()
758758
size_t rtcmCount = 0;
759759

760760
// Collect any available RTCM data
761-
while (ntripClientReceiveDataAvailable() > 0)
761+
if (ntripClientReceiveDataAvailable() > 0)
762762
{
763-
rtcmData[rtcmCount++] = ntripClient->read();
764-
if (rtcmCount == sizeof(rtcmData))
765-
break;
766-
}
767-
768-
// Restart the NTRIP receive data timer
769-
ntripClientTimer = millis();
770-
771-
// Push RTCM to GNSS module over I2C / SPI
772-
theGNSS.pushRawData(rtcmData, rtcmCount);
773-
netIncomingRTCM = true;
774-
775-
if ((settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_DATA))
776-
&& (!inMainMenu))
777-
{
778-
PERIODIC_CLEAR(PD_NTRIP_CLIENT_DATA);
779-
systemPrintf("NTRIP Client received %d RTCM bytes, pushed to ZED\r\n", rtcmCount);
763+
rtcmCount = ntripClient->read(rtcmData, sizeof(rtcmData));
764+
if (rtcmCount)
765+
{
766+
// Restart the NTRIP receive data timer
767+
ntripClientTimer = millis();
768+
769+
// Push RTCM to GNSS module over I2C / SPI
770+
theGNSS.pushRawData(rtcmData, rtcmCount);
771+
netIncomingRTCM = true;
772+
773+
if ((settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_DATA))
774+
&& (!inMainMenu))
775+
{
776+
PERIODIC_CLEAR(PD_NTRIP_CLIENT_DATA);
777+
systemPrintf("NTRIP Client received %d RTCM bytes, pushed to ZED\r\n", rtcmCount);
778+
}
779+
}
780780
}
781781
}
782782
}

0 commit comments

Comments
 (0)