Skip to content

Commit 9e187ce

Browse files
authored
Merge pull request #804 from sparkfun/pcUpdates
pcUpdates
2 parents 8ba8863 + 7333b30 commit 9e187ce

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

Firmware/RTK_Everywhere/NtripServer.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,10 @@ void ntripServerProcessRTCM(int serverIndex, uint8_t incoming)
434434
}
435435

436436
// If we have not gotten new RTCM bytes for a period of time, assume end of frame
437-
if (ntripServer->checkBytesSentAndReset(100) && (!inMainMenu) && settings.debugNtripServerRtcm)
437+
uint32_t totalBytesSent;
438+
if (ntripServer->checkBytesSentAndReset(100, &totalBytesSent) && (!inMainMenu) && settings.debugNtripServerRtcm)
438439
systemPrintf("NTRIP Server %d transmitted %d RTCM bytes to Caster\r\n", serverIndex,
439-
ntripServer->bytesSent);
440+
totalBytesSent);
440441

441442
if (ntripServer->networkClient && ntripServer->networkClient->connected())
442443
{

Firmware/RTK_Everywhere/TcpServer.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static const char * tcpServerName;
120120
static volatile uint8_t tcpServerClientConnected;
121121
static volatile uint8_t tcpServerClientDataSent;
122122
static volatile uint8_t tcpServerClientSendingData;
123-
static uint32_t tcpServerClientTimer[TCP_SERVER_MAX_CLIENTS];
123+
static volatile uint32_t tcpServerClientTimer[TCP_SERVER_MAX_CLIENTS];
124124
static volatile uint8_t tcpServerClientWriteError;
125125
static NetworkClient *tcpServerClient[TCP_SERVER_MAX_CLIENTS];
126126
static IPAddress tcpServerClientIpAddress[TCP_SERVER_MAX_CLIENTS];
@@ -168,9 +168,12 @@ int32_t tcpServerClientSendData(int index, uint8_t *data, uint16_t length)
168168
length = tcpServerClient[index]->write(data, length);
169169
if (length > 0)
170170
{
171-
// Update the data sent flag when data successfully sent
171+
// Update the data sent flag and timer when data successfully sent
172172
if (length > 0)
173+
{
173174
tcpServerClientDataSent = tcpServerClientDataSent | (1 << index);
175+
tcpServerClientTimer[index] = millis();
176+
}
174177
if ((settings.debugTcpServer || PERIODIC_DISPLAY(PD_TCP_SERVER_CLIENT_DATA)) && (!inMainMenu))
175178
systemPrintf("%s wrote %d bytes to %s\r\n",
176179
tcpServerName, length,

Firmware/RTK_Everywhere/settings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ typedef struct
519519
}
520520
}
521521

522-
bool checkBytesSentAndReset(uint32_t timerLimit)
522+
bool checkBytesSentAndReset(uint32_t timerLimit, uint32_t *totalBytesSent)
523523
{
524524
bool retVal = false;
525525
if (serverSemaphore == NULL)
@@ -529,6 +529,7 @@ typedef struct
529529
if (((millis() - timer) > timerLimit) && (bytesSent > 0))
530530
{
531531
retVal = true;
532+
*totalBytesSent = bytesSent;
532533
bytesSent = 0;
533534
}
534535
xSemaphoreGive(serverSemaphore);

0 commit comments

Comments
 (0)