Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Firmware/RTK_Everywhere/NtripServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,10 @@ void ntripServerProcessRTCM(int serverIndex, uint8_t incoming)
}

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

if (ntripServer->networkClient && ntripServer->networkClient->connected())
{
Expand Down
7 changes: 5 additions & 2 deletions Firmware/RTK_Everywhere/TcpServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static const char * tcpServerName;
static volatile uint8_t tcpServerClientConnected;
static volatile uint8_t tcpServerClientDataSent;
static volatile uint8_t tcpServerClientSendingData;
static uint32_t tcpServerClientTimer[TCP_SERVER_MAX_CLIENTS];
static volatile uint32_t tcpServerClientTimer[TCP_SERVER_MAX_CLIENTS];
static volatile uint8_t tcpServerClientWriteError;
static NetworkClient *tcpServerClient[TCP_SERVER_MAX_CLIENTS];
static IPAddress tcpServerClientIpAddress[TCP_SERVER_MAX_CLIENTS];
Expand Down Expand Up @@ -168,9 +168,12 @@ int32_t tcpServerClientSendData(int index, uint8_t *data, uint16_t length)
length = tcpServerClient[index]->write(data, length);
if (length > 0)
{
// Update the data sent flag when data successfully sent
// Update the data sent flag and timer when data successfully sent
if (length > 0)
{
tcpServerClientDataSent = tcpServerClientDataSent | (1 << index);
tcpServerClientTimer[index] = millis();
}
if ((settings.debugTcpServer || PERIODIC_DISPLAY(PD_TCP_SERVER_CLIENT_DATA)) && (!inMainMenu))
systemPrintf("%s wrote %d bytes to %s\r\n",
tcpServerName, length,
Expand Down
3 changes: 2 additions & 1 deletion Firmware/RTK_Everywhere/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ typedef struct
}
}

bool checkBytesSentAndReset(uint32_t timerLimit)
bool checkBytesSentAndReset(uint32_t timerLimit, uint32_t *totalBytesSent)
{
bool retVal = false;
if (serverSemaphore == NULL)
Expand All @@ -529,6 +529,7 @@ typedef struct
if (((millis() - timer) > timerLimit) && (bytesSent > 0))
{
retVal = true;
*totalBytesSent = bytesSent;
bytesSent = 0;
}
xSemaphoreGive(serverSemaphore);
Expand Down