Skip to content

Commit

Permalink
Merge pull request #270 from sparkfun/Resolve_#267
Browse files Browse the repository at this point in the history
Resolve #267
  • Loading branch information
nseidle authored May 1, 2024
2 parents 3f68aeb + cf0eb4f commit ed8602c
Show file tree
Hide file tree
Showing 9 changed files with 1,815 additions and 1,775 deletions.
2 changes: 1 addition & 1 deletion Firmware/RTK_Everywhere/GNSS.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Connect to ZED module and identify particulars
// Connect to GNSS and identify particulars
void gnssBegin()
{
if (present.gnss_zedf9p)
Expand Down
6 changes: 3 additions & 3 deletions Firmware/RTK_Everywhere/MQTT_Client.ino
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void mqttClientReceiveMessage(int messageSize)

if (mqttCount > 0)
{
// Correction data from PP can go direct to ZED module
// Correction data from PP can go direct to GNSS
if (present.gnss_zedf9p)
{
// Only push SPARTN if the priority says we can
Expand All @@ -316,7 +316,7 @@ void mqttClientReceiveMessage(int messageSize)
if (isHighestRegisteredCorrectionsSource(CORR_IP))
{
if (((settings.debugMqttClientData == true) || (settings.debugCorrections == true)) && !inMainMenu)
systemPrintf("Pushing %d bytes from %s topic to ZED\r\n", mqttCount, topic);
systemPrintf("Pushing %d bytes from %s topic to GNSS\r\n", mqttCount, topic);

updateZEDCorrectionsSource(0); // Set SOURCE to 0 (IP) if needed

Expand All @@ -326,7 +326,7 @@ void mqttClientReceiveMessage(int messageSize)
else
{
if (((settings.debugMqttClientData == true) || (settings.debugCorrections == true)) && !inMainMenu)
systemPrintf("NOT pushing %d bytes from %s topic to ZED due to priority\r\n", mqttCount, topic);
systemPrintf("NOT pushing %d bytes from %s topic to GNSS due to priority\r\n", mqttCount, topic);
}
}
// Always push KEYS and MGA to the ZED
Expand Down
4 changes: 2 additions & 2 deletions Firmware/RTK_Everywhere/NtripClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -836,15 +836,15 @@ void ntripClientUpdate()
if ((settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_DATA)) && (!inMainMenu))
{
PERIODIC_CLEAR(PD_NTRIP_CLIENT_DATA);
systemPrintf("NTRIP Client received %d RTCM bytes, pushed to ZED\r\n", rtcmCount);
systemPrintf("NTRIP Client received %d RTCM bytes, pushed to GNSS\r\n", rtcmCount);
}
}
else
{
if ((settings.debugNtripClientRtcm || PERIODIC_DISPLAY(PD_NTRIP_CLIENT_DATA)) && (!inMainMenu))
{
PERIODIC_CLEAR(PD_NTRIP_CLIENT_DATA);
systemPrintf("NTRIP Client received %d RTCM bytes, NOT pushed to ZED due to priority\r\n", rtcmCount);
systemPrintf("NTRIP Client received %d RTCM bytes, NOT pushed to GNSS due to priority\r\n", rtcmCount);
}
}
}
Expand Down
34 changes: 30 additions & 4 deletions Firmware/RTK_Everywhere/PointPerfectLibrary.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ void updatePplTask(void *e)
{
if (rtcmLength > 0)
{
updateCorrectionsLastSeen(CORR_LBAND);
if (isHighestRegisteredCorrectionsSource(CORR_LBAND))
updateCorrectionsLastSeen(pplCorrectionsSource);
if (isHighestRegisteredCorrectionsSource(pplCorrectionsSource))
{
// Set ZED SOURCE to 1 (L-Band) if needed
// Note: this is almost certainly redundant. It would only be used if we
Expand Down Expand Up @@ -318,17 +318,18 @@ bool sendGnssToPpl(uint8_t *buffer, int numDataBytes)
return false;
}

// Send Spartn packets from PointPerfect (either IP or L-Band) to PPL
// Send Spartn packets from PointPerfect to PPL
bool sendSpartnToPpl(uint8_t *buffer, int numDataBytes)
{
if (online.ppl == true)
{
pplCorrectionsSource = CORR_IP;

ePPL_ReturnStatus result = PPL_SendSpartn(buffer, numDataBytes);
if (result != ePPL_Success)
{
if (settings.debugCorrections == true)
systemPrintf("ERROR processRXMPMP PPL_SendSpartn: %s\r\n", PPLReturnStatusToStr(result));
systemPrintf("ERROR PPL_SendSpartn: %s\r\n", PPLReturnStatusToStr(result));
return false;
}
lastMqttToPpl = millis();
Expand All @@ -342,6 +343,31 @@ bool sendSpartnToPpl(uint8_t *buffer, int numDataBytes)
return false;
}

// Send raw L-Band Spartn packets from mosaic X5 to PPL
bool sendAuxSpartnToPpl(uint8_t *buffer, int numDataBytes)
{
if (online.ppl == true)
{
pplCorrectionsSource = CORR_LBAND;

ePPL_ReturnStatus result = PPL_SendAuxSpartn(buffer, numDataBytes);
if (result != ePPL_Success)
{
if (settings.debugCorrections == true)
systemPrintf("ERROR PPL_SendAuxSpartn: %s\r\n", PPLReturnStatusToStr(result));
return false;
}
lastMqttToPpl = millis();
return true;
}
else
{
pplLBandCorrections = true; // Notify updatePPL() that L-Band is online
}

return false;
}

// Print human-readable PPL status
const char *PPLReturnStatusToStr(ePPL_ReturnStatus status)
{
Expand Down
7 changes: 6 additions & 1 deletion Firmware/RTK_Everywhere/RTK_Everywhere.ino
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ uint8_t *pplRtcmBuffer;
bool pplAttemptedStart = false;
bool pplGnssOutput = false;
bool pplMqttCorrections = false;
bool pplLBandCorrections = false; // Raw L-Band - e.g. from mosaic X5
unsigned long pplKeyExpirationMs = 0; // Milliseconds until the current PPL key expires

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Expand Down Expand Up @@ -692,7 +693,7 @@ uint32_t triggerTowMsR; // Global copy - Time Of Week of rising edge (ms)
uint32_t triggerTowSubMsR; // Global copy - Millisecond fraction of Time Of Week of rising edge in nanoseconds
uint32_t triggerAccEst; // Global copy - Accuracy estimate in nanoseconds

bool firstPowerOn = true; // After boot, apply new settings to ZED if the user switches between base or rover
bool firstPowerOn = true; // After boot, apply new settings to GNSS if the user switches between base or rover
unsigned long splashStart; // Controls how long the splash is displayed for. Currently min of 2s.
bool restartBase; // If the user modifies any NTRIP Server settings, we need to restart the base
bool restartRover; // If the user modifies any NTRIP Client or PointPerfect settings, we need to restart the rover
Expand Down Expand Up @@ -723,6 +724,10 @@ uint16_t failedParserMessages_UBX;
uint16_t failedParserMessages_RTCM;
uint16_t failedParserMessages_NMEA;

// Corrections Priorities Support
std::vector<registeredCorrectionsSource> registeredCorrectionsSources; // vector (linked list) of registered corrections sources for this device
correctionsSource pplCorrectionsSource = CORR_NUM; // Record which source is feeding the PPL

// configureViaEthernet:
// Set to true if configureViaEthernet.txt exists in LittleFS.
// Causes setup and loop to skip any code which would cause SPI or interrupts to be initialized.
Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Everywhere/Tasks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void btReadTask(void *e)
systemPrintln("btReadTask running");
}

// Receive RTCM corrections or UBX config messages over bluetooth and pass them along to ZED
// Receive RTCM corrections or UBX config messages over bluetooth and pass them along to GNSS
rxBytes = 0;
if (bluetoothGetState() == BT_CONNECTED)
{
Expand Down
Loading

0 comments on commit ed8602c

Please sign in to comment.