Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
425a4fc
TCP Server: update timer after client write
PaulZC Nov 18, 2025
44ca99f
Record total bytes sent when calling ntripServer->checkBytesSentAndReset
PaulZC Nov 18, 2025
48ec988
Add pin_debug to help solve the NTRIP Server write stall
PaulZC Nov 21, 2025
34820f9
Add settings.networkClientWriteTimeout_ms and ntripServer->networkCli…
PaulZC Nov 22, 2025
1d6500b
Use semaphore to protect write from connected
PaulZC Nov 23, 2025
affa6f1
Add rtcmConsumerBuffer
PaulZC Nov 23, 2025
e4853e1
Add ntripServerSendRTCM to Developer.ino
PaulZC Nov 23, 2025
43cd008
Update comments
PaulZC Nov 23, 2025
0de67da
More comments
PaulZC Nov 23, 2025
76e99e9
Comment pin_debug for PR
PaulZC Nov 23, 2025
18e2de2
Improve buffersInUse
PaulZC Nov 24, 2025
b95c093
Update Dinger.py - add printLines
PaulZC Nov 24, 2025
2163c37
Move sendRTCMToConsumers() outside ringBufferSemaphore
PaulZC Nov 24, 2025
ddc032b
Move NTRIP_SERVER_DATA into NtripServer.ino
PaulZC Nov 24, 2025
1de1d1f
Remove redundant debugMessagePrefix
PaulZC Nov 24, 2025
0f58126
Correct debugMessagePrefix
PaulZC Nov 24, 2025
d4e188f
Require SEMP v1.0.6
PaulZC Nov 24, 2025
7653d4d
Add ntripServer_CasterEnabled
PaulZC Nov 24, 2025
2785d4a
Merge branch 'release_candidate' into pcUpdates_ntripServer_CasterEna…
PaulZC Nov 25, 2025
21739da
Add ntripServerCasterEnabled to web config
PaulZC Nov 25, 2025
ea8b034
Temporary workaround to prevent crash in bluetoothStop
PaulZC Nov 25, 2025
2132119
Correct logic when NTRIP Server settings change
PaulZC Nov 25, 2025
56aac72
Merge branch 'release_candidate' into pcUpdates_ntripServer_CasterEna…
PaulZC Nov 26, 2025
53d7757
Merge branch 'release_candidate' into pcUpdates_ntripServer_CasterEna…
PaulZC Nov 26, 2025
c350304
Nudge NTRIP Server Enable checkboxes on web config
PaulZC Nov 26, 2025
c17d700
Make rtcmConsumerBufferHead and Tail volatile
PaulZC Nov 26, 2025
0d2877c
Correct createSettingsString for tNSCEn
PaulZC Nov 26, 2025
c2263a2
Web config : handle enableExtCorrRadio
PaulZC Nov 26, 2025
8a73029
Fix compiler warnings
PaulZC Nov 26, 2025
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
2 changes: 1 addition & 1 deletion Firmware/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ RUN arduino-cli lib install "SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
RUN arduino-cli lib install "SparkFun u-blox GNSS v3"@3.1.10
RUN arduino-cli lib install "SparkFun Qwiic OLED Arduino Library"@1.0.13
RUN arduino-cli lib install [email protected]
RUN arduino-cli lib install "SparkFun Extensible Message Parser"@1.0.4
RUN arduino-cli lib install "SparkFun Extensible Message Parser"@1.0.6
RUN arduino-cli lib install "SparkFun BQ40Z50 Battery Manager Arduino Library"@1.0.0
RUN arduino-cli lib install "ArduinoMqttClient"@0.1.8
RUN arduino-cli lib install "SparkFun u-blox PointPerfect Library"@1.11.4
Expand Down
20 changes: 20 additions & 0 deletions Firmware/RTK_Everywhere/AP-Config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,11 @@
<div class="collapse" id="ntripServerConfig0">
<div class="card card-body" style="margin-top:5px;">

<div class="form-check mt-3 mb-2 box-margin20">
<label class="form-check-label" for="ntripServerCasterEnabled_0">Enable</label>
<input class="form-check-input" type="checkbox" value="" id="ntripServerCasterEnabled_0">
</div>

<div class="form-group row">
<label for="ntripServerCasterHost_0"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
Expand Down Expand Up @@ -976,6 +981,11 @@
<div class="collapse" id="ntripServerConfig1">
<div class="card card-body" style="margin-top:5px;">

<div class="form-check mt-3 mb-2 box-margin20">
<label class="form-check-label" for="ntripServerCasterEnabled_1">Enable</label>
<input class="form-check-input" type="checkbox" value="" id="ntripServerCasterEnabled_1">
</div>

<div class="form-group row">
<label for="ntripServerCasterHost_1"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
Expand Down Expand Up @@ -1049,6 +1059,11 @@
<div class="collapse" id="ntripServerConfig2">
<div class="card card-body" style="margin-top:5px;">

<div class="form-check mt-3 mb-2 box-margin20">
<label class="form-check-label" for="ntripServerCasterEnabled_2">Enable</label>
<input class="form-check-input" type="checkbox" value="" id="ntripServerCasterEnabled_2">
</div>

<div class="form-group row">
<label for="ntripServerCasterHost_2"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
Expand Down Expand Up @@ -1122,6 +1137,11 @@
<div class="collapse" id="ntripServerConfig3">
<div class="card card-body" style="margin-top:5px;">

<div class="form-check mt-3 mb-2 box-margin20">
<label class="form-check-label" for="ntripServerCasterEnabled_3">Enable</label>
<input class="form-check-input" type="checkbox" value="" id="ntripServerCasterEnabled_3">
</div>

<div class="form-group row">
<label for="ntripServerCasterHost_3"
class="box-margin20 col-sm-3 col-5 col-form-label">Caster
Expand Down
10 changes: 10 additions & 0 deletions Firmware/RTK_Everywhere/AP-Config/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,16 @@ function parseIncoming(msg) {
ge("antennaHeight_m").value = val / 1000.0;
}

//enableExtCorrRadio should be bool but is sent as uint8_t because it _could_ be 254
else if (id.includes("enableExtCorrRadio")) {
if (val == 0) {
ge(id).checked = false;
}
else {
ge(id).checked = true;
}
}

//Check boxes / radio buttons
else if (val == "true") {
try {
Expand Down
124 changes: 114 additions & 10 deletions Firmware/RTK_Everywhere/Base.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,125 @@
Base.ino
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

// This function gets called when an RTCM packet passes parser check in processUart1Message() task
// Pass data along to NTRIP Server, or ESP-NOW radio
void processRTCM(uint8_t *rtcmData, uint16_t dataLength)
// Enough storage for two rounds of RTCM 1074,1084,1094,1124,1005
// To help prevent the "no increase in file size" and "due to lack of RTCM" glitch:
// RTCM is stored in PSRAM by the processUart1Message task and written by sendRTCMToConsumers
const uint8_t rtcmConsumerBufferEntries = 16;
const uint16_t rtcmConsumerBufferEntrySize = 1032; // RTCM can be up to 1024 + 6 bytes
uint16_t rtcmConsumerBufferLengths[rtcmConsumerBufferEntries];
volatile uint8_t rtcmConsumerBufferHead;
volatile uint8_t rtcmConsumerBufferTail;
uint8_t *rtcmConsumerBufferPtr = nullptr;

//----------------------------------------
// Allocate and initialize the rtcmConsumerBuffer
//----------------------------------------
bool rtcmConsumerBufferAllocated()
{
// Give this byte to the various possible transmission methods
for (int x = 0; x < dataLength; x++)
if (rtcmConsumerBufferPtr == nullptr)
{
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
ntripServerProcessRTCM(serverIndex, rtcmData[x]);
rtcmConsumerBufferPtr = (uint8_t *)rtkMalloc(
(size_t)rtcmConsumerBufferEntrySize * (size_t)rtcmConsumerBufferEntries,
"ntripBuffer");
for (uint8_t i = 0; i < rtcmConsumerBufferEntries; i++)
rtcmConsumerBufferLengths[i] = 0;
rtcmConsumerBufferHead = 0;
rtcmConsumerBufferTail = 0;
}
if (rtcmConsumerBufferPtr == nullptr)
{
systemPrintln("rtcmConsumerBuffer malloc failed!");
return false;
}

for (int x = 0; x < dataLength; x++)
espNowProcessRTCM(rtcmData[x]);
return true;
}

loraProcessRTCM(rtcmData, dataLength);
//----------------------------------------
// Check how many RTCM buffers contain data
//----------------------------------------
uint8_t rtcmBuffersInUse()
{
if (!rtcmConsumerBufferAllocated())
return 0;

uint8_t buffersInUse = rtcmConsumerBufferHead - rtcmConsumerBufferTail;
if (buffersInUse >= rtcmConsumerBufferEntries) // Wrap if Tail is > Head
buffersInUse += rtcmConsumerBufferEntries;
return buffersInUse;
}

//----------------------------------------
// Check if any RTCM data is available
//----------------------------------------
bool rtcmDataAvailable()
{
return (rtcmBuffersInUse() > 0);
}

//----------------------------------------
// Store each RTCM message in a PSRAM buffer
// This function gets called as each complete RTCM message comes in
// The messages are written to the servers by sendRTCMToConsumers
//----------------------------------------
void storeRTCMForConsumers(uint8_t *rtcmData, uint16_t dataLength)
{
if (!rtcmConsumerBufferAllocated())
return;

// Check if a buffer is available
if (rtcmBuffersInUse() < (rtcmConsumerBufferEntries - 1))
{
uint8_t *dest = rtcmConsumerBufferPtr;
dest += (size_t)rtcmConsumerBufferEntrySize * (size_t)rtcmConsumerBufferHead;
memcpy(dest, rtcmData, dataLength); // Store the RTCM
rtcmConsumerBufferLengths[rtcmConsumerBufferHead] = dataLength; // Store the length
rtcmConsumerBufferHead = rtcmConsumerBufferHead + 1; // Increment the Head
rtcmConsumerBufferHead = rtcmConsumerBufferHead % rtcmConsumerBufferEntries; // Wrap
}
else
{
if (settings.debugNtripServerRtcm && (!inMainMenu))
systemPrintln("rtcmConsumerBuffer full. RTCM lost");
}
}

//----------------------------------------
// Send the stored RTCM to consumers: ntripServer, LoRa and ESP-NOW
//----------------------------------------
void sendRTCMToConsumers()
{
if (!rtcmConsumerBufferAllocated())
return;

while (rtcmConsumerBufferHead != rtcmConsumerBufferTail)
{
uint8_t *dest = rtcmConsumerBufferPtr;
dest += (size_t)rtcmConsumerBufferEntrySize * (size_t)rtcmConsumerBufferTail;

// NTRIP Server
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
ntripServerSendRTCM(serverIndex, dest, rtcmConsumerBufferLengths[rtcmConsumerBufferTail]);

// LoRa
loraProcessRTCM(dest, rtcmConsumerBufferLengths[rtcmConsumerBufferTail]);

// ESP-NOW
for (uint16_t x = 0; x < rtcmConsumerBufferLengths[rtcmConsumerBufferTail]; x++)
espNowProcessRTCM(dest[x]);

rtcmConsumerBufferTail = rtcmConsumerBufferTail + 1; // Increment the Tail
rtcmConsumerBufferTail = rtcmConsumerBufferTail % rtcmConsumerBufferEntries; // Wrap
}
}

//----------------------------------------
// Store data ready to be passed along to NTRIP Server, or ESP-NOW radio
// This function gets called when an RTCM packet passes parser check in processUart1Message() task
//----------------------------------------
void processRTCM(uint8_t *rtcmData, uint16_t dataLength)
{
storeRTCMForConsumers(rtcmData, dataLength);

rtcmLastPacketSent = millis();
rtcmPacketsSent++;
Expand Down
5 changes: 5 additions & 0 deletions Firmware/RTK_Everywhere/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ void beginBoard()
pin_modeButton = 0;
// 24, D2 : Status LED
pin_baseStatusLED = 2;
//pin_debug = 2; // On EVK we can use the Status LED for debug
// 29, D5 : GNSS TP via 74LVC4066 switch
pin_GNSS_TimePulse = 5;
// 14, D12 : I2C1 SDA via 74LVC4066 switch
Expand Down Expand Up @@ -421,6 +422,10 @@ void beginBoard()
pinMode(pin_baseStatusLED, OUTPUT);
baseStatusLedOff();

DMW_if systemPrintf("pin_debug: %d\r\n", pin_debug);
pinMode(pin_debug, OUTPUT);
pinDebugOff();

DMW_if systemPrintf("pin_Cellular_Network_Indicator: %d\r\n", pin_Cellular_Network_Indicator);
pinMode(pin_Cellular_Network_Indicator, INPUT);

Expand Down
8 changes: 4 additions & 4 deletions Firmware/RTK_Everywhere/Bluetooth.ino
Original file line number Diff line number Diff line change
Expand Up @@ -742,13 +742,13 @@ void bluetoothStop()
{
bluetoothSerialBle->flush(); // Complete any transfers
bluetoothSerialBle->disconnect(); // Drop any clients
bluetoothSerialBle->end(); // Release resources
//bluetoothSerialBle->end(); // Release resources : causes FreeRTOS Task "BLEFlushTask_" should not return, Aborting now!
//delete bluetoothSerialBle;
//bluetoothSerialBle = nullptr;

bluetoothSerialBleCommands->flush(); // Complete any transfers
bluetoothSerialBleCommands->disconnect(); // Drop any clients
bluetoothSerialBleCommands->end(); // Release resources
//bluetoothSerialBleCommands->end(); // Release resources : causes FreeRTOS Task "BLEFlushTask_" should not return, Aborting now!
//delete bluetoothSerialBleCommands;
//bluetoothSerialBleCommands = nullptr;

Expand Down Expand Up @@ -776,13 +776,13 @@ void bluetoothStop()
{
bluetoothSerialBle->flush(); // Complete any transfers
bluetoothSerialBle->disconnect(); // Drop any clients
bluetoothSerialBle->end(); // Release resources
//bluetoothSerialBle->end(); // Release resources : FreeRTOS Task "BLEFlushTask_" should not return, Aborting now!
//delete bluetoothSerialBle;
//bluetoothSerialBle = nullptr;

bluetoothSerialBleCommands->flush(); // Complete any transfers
bluetoothSerialBleCommands->disconnect(); // Drop any clients
bluetoothSerialBleCommands->end(); // Release resources
//bluetoothSerialBleCommands->end(); // Release resources : FreeRTOS Task "BLEFlushTask_" should not return, Aborting now!
//delete bluetoothSerialBleCommands;
//bluetoothSerialBleCommands = nullptr;

Expand Down
3 changes: 2 additions & 1 deletion Firmware/RTK_Everywhere/Developer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,11 @@ void ntripClientSettingsChanged() {}
#ifndef COMPILE_NTRIP_SERVER
bool ntripServerIsCasting(int serverIndex) {return false;}
void ntripServerPrintStatus(int serverIndex) {systemPrintf("**NTRIP Server %d not compiled**\r\n", serverIndex);}
void ntripServerProcessRTCM(int serverIndex, uint8_t incoming) {}
void ntripServerSendRTCM(int serverIndex, uint8_t *rtcmData, uint16_t dataLength) {}
void ntripServerStop(int serverIndex, bool shutdown) {online.ntripServer[serverIndex] = false;}
void ntripServerUpdate() {}
void ntripServerValidateTables() {}
void ntripServerSettingsChanged(int serverIndex) {}
#endif // COMPILE_NTRIP_SERVER

//----------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions Firmware/RTK_Everywhere/LED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ void baseStatusLedOff()
digitalWrite(pin_baseStatusLED, LOW);
}

void pinDebugOn()
{
if (pin_debug != PIN_UNDEFINED)
digitalWrite(pin_debug, HIGH);
}

void pinDebugOff()
{
if (pin_debug != PIN_UNDEFINED)
digitalWrite(pin_debug, LOW);
}

void baseStatusLedBlink()
{
if (pin_baseStatusLED != PIN_UNDEFINED)
Expand Down
17 changes: 17 additions & 0 deletions Firmware/RTK_Everywhere/NVM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ void recordSystemSettingsToFile(File *settingsFile)
}
}
break;
case tNSCEn: {
for (int x = 0; x < rtkSettingsEntries[i].qualifier; x++)
{
settingsFile->printf("%s%d=%d\r\n", rtkSettingsEntries[i].name, x,
settings.ntripServer_CasterEnabled[x]);
}
}
break;
case tNSCHost: {
for (int x = 0; x < rtkSettingsEntries[i].qualifier; x++)
{
Expand Down Expand Up @@ -1067,6 +1075,15 @@ bool parseLine(char *str)
}
}
break;
case tNSCEn: {
int server;
if (sscanf(suffix, "%d", &server) == 1)
{
settings.ntripServer_CasterEnabled[server] = d;
knownSetting = true;
}
}
break;
case tNSCHost: {
int server;
if (sscanf(suffix, "%d", &server) == 1)
Expand Down
12 changes: 6 additions & 6 deletions Firmware/RTK_Everywhere/NtripClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ unsigned long lastGGAPush;

bool ntripClientForcedShutdown = false; // NTRIP Client was turned off due to an error. Don't allow restart.

bool settingsChanged = false; // Goes true when a menu or command modified the client credentials
bool ntripClientSettingsHaveChanged = false; // Goes true when a menu or command modified the client credentials

//----------------------------------------
// NTRIP Client Routines
Expand Down Expand Up @@ -396,9 +396,9 @@ bool ntripClientEnabled(const char **line)
enabled = settings.enableNtripClient;

// Allow restart if settings change
if(settingsChanged == true)
if(ntripClientSettingsHaveChanged == true)
{
settingsChanged = false;
ntripClientSettingsHaveChanged = false;
ntripClientForcedShutdown = false;
}

Expand Down Expand Up @@ -600,7 +600,7 @@ void ntripClientSetState(uint8_t newState)
// Called from CLI call backs or serial menus to let machine know it can restart the client if it is shut down
void ntripClientSettingsChanged()
{
settingsChanged = true;
ntripClientSettingsHaveChanged = true;
}

//----------------------------------------
Expand Down Expand Up @@ -916,9 +916,9 @@ void ntripClientUpdate()
}

// Check if the there have been changes to the client settings
if(settingsChanged == true)
if(ntripClientSettingsHaveChanged == true)
{
settingsChanged = false;
ntripClientSettingsHaveChanged = false;
ntripClientRestart();
}
// Check for timeout receiving NTRIP data
Expand Down
Loading