Merge pull request #148 from sparkfun/release_candidate

v2.2.13
This commit is contained in:
Paul
2022-08-03 09:46:01 +01:00
committed by GitHub
3 changed files with 118 additions and 122 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS Arduino Library name=SparkFun u-blox GNSS Arduino Library
version=2.2.12 version=2.2.13
author=SparkFun Electronics <techsupport@sparkfun.com> author=SparkFun Electronics <techsupport@sparkfun.com>
maintainer=SparkFun Electronics <sparkfun.com> maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/> sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>
+53 -55
View File
@@ -345,7 +345,7 @@ void SFE_UBLOX_GNSS::end(void)
{ {
if (packetUBXRXMQZSSL6message->callbackData != NULL) if (packetUBXRXMQZSSL6message->callbackData != NULL)
{ {
delete [] packetUBXRXMQZSSL6message->callbackData; delete[] packetUBXRXMQZSSL6message->callbackData;
} }
delete packetUBXRXMQZSSL6message; delete packetUBXRXMQZSSL6message;
packetUBXRXMQZSSL6message = NULL; // Redundant? packetUBXRXMQZSSL6message = NULL; // Redundant?
@@ -1284,7 +1284,7 @@ bool SFE_UBLOX_GNSS::checkUbloxSpi(ubxPacket *incomingUBX, uint8_t requestedClas
// If we are not receiving a sentence (currentSentence == NONE) and the byteReturned is 0xFF, // If we are not receiving a sentence (currentSentence == NONE) and the byteReturned is 0xFF,
// i.e. the module has no data for us, then delay for // i.e. the module has no data for us, then delay for
if ((byteReturned == 0xFF) && (currentSentence == NONE)) if ((byteReturned == 0xFF) && (currentSentence == SFE_UBLOX_SENTENCE_TYPE_NONE))
{ {
digitalWrite(_csPin, HIGH); digitalWrite(_csPin, HIGH);
_spiPort->endTransaction(); _spiPort->endTransaction();
@@ -1292,7 +1292,7 @@ bool SFE_UBLOX_GNSS::checkUbloxSpi(ubxPacket *incomingUBX, uint8_t requestedClas
return (true); return (true);
} }
while ((byteReturned != 0xFF) || (currentSentence != NONE)) while ((byteReturned != 0xFF) || (currentSentence != SFE_UBLOX_SENTENCE_TYPE_NONE))
{ {
process(byteReturned, incomingUBX, requestedClass, requestedID); process(byteReturned, incomingUBX, requestedClass, requestedID);
byteReturned = _spiPort->transfer(0xFF); byteReturned = _spiPort->transfer(0xFF);
@@ -1686,14 +1686,14 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
{ {
if (_outputPort != NULL) if (_outputPort != NULL)
_outputPort->write(incoming); // Echo this byte to the serial port _outputPort->write(incoming); // Echo this byte to the serial port
if ((currentSentence == NONE) || (currentSentence == NMEA)) if ((currentSentence == SFE_UBLOX_SENTENCE_TYPE_NONE) || (currentSentence == SFE_UBLOX_SENTENCE_TYPE_NMEA))
{ {
if (incoming == UBX_SYNCH_1) // UBX binary frames start with 0xB5, aka μ if (incoming == UBX_SYNCH_1) // UBX binary frames start with 0xB5, aka μ
{ {
// This is the start of a binary sentence. Reset flags. // This is the start of a binary sentence. Reset flags.
// We still don't know the response class // We still don't know the response class
ubxFrameCounter = 0; ubxFrameCounter = 0;
currentSentence = UBX; currentSentence = SFE_UBLOX_SENTENCE_TYPE_UBX;
// Reset the packetBuf.counter even though we will need to reset it again when ubxFrameCounter == 2 // Reset the packetBuf.counter even though we will need to reset it again when ubxFrameCounter == 2
packetBuf.counter = 0; packetBuf.counter = 0;
ignoreThisPayload = false; // We should not ignore this payload - yet ignoreThisPayload = false; // We should not ignore this payload - yet
@@ -1703,12 +1703,12 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
else if (incoming == '$') else if (incoming == '$')
{ {
nmeaByteCounter = 0; // Reset the NMEA byte counter nmeaByteCounter = 0; // Reset the NMEA byte counter
currentSentence = NMEA; currentSentence = SFE_UBLOX_SENTENCE_TYPE_NMEA;
} }
else if (incoming == 0xD3) // RTCM frames start with 0xD3 else if (incoming == 0xD3) // RTCM frames start with 0xD3
{ {
rtcmFrameCounter = 0; rtcmFrameCounter = 0;
currentSentence = RTCM; currentSentence = SFE_UBLOX_SENTENCE_TYPE_RTCM;
} }
else else
{ {
@@ -1717,13 +1717,13 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
} }
// Depending on the sentence, pass the character to the individual processor // Depending on the sentence, pass the character to the individual processor
if (currentSentence == UBX) if (currentSentence == SFE_UBLOX_SENTENCE_TYPE_UBX)
{ {
// Decide what type of response this is // Decide what type of response this is
if ((ubxFrameCounter == 0) && (incoming != UBX_SYNCH_1)) // ISO 'μ' if ((ubxFrameCounter == 0) && (incoming != UBX_SYNCH_1)) // ISO 'μ'
currentSentence = NONE; // Something went wrong. Reset. currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; // Something went wrong. Reset.
else if ((ubxFrameCounter == 1) && (incoming != UBX_SYNCH_2)) // ASCII 'b' else if ((ubxFrameCounter == 1) && (incoming != UBX_SYNCH_2)) // ASCII 'b'
currentSentence = NONE; // Something went wrong. Reset. currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; // Something went wrong. Reset.
// Note to future self: // Note to future self:
// There may be some duplication / redundancy in the next few lines as processUBX will also // There may be some duplication / redundancy in the next few lines as processUBX will also
// load information into packetBuf, but we'll do it here too for clarity // load information into packetBuf, but we'll do it here too for clarity
@@ -1936,15 +1936,15 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
// Finally, increment the frame counter // Finally, increment the frame counter
ubxFrameCounter++; ubxFrameCounter++;
} }
else if (currentSentence == NMEA) // Process incoming NMEA mesages. Selectively log if desired. else if (currentSentence == SFE_UBLOX_SENTENCE_TYPE_NMEA) // Process incoming NMEA mesages. Selectively log if desired.
{ {
if ((nmeaByteCounter == 0) && (incoming != '$')) if ((nmeaByteCounter == 0) && (incoming != '$'))
{ {
currentSentence = NONE; // Something went wrong. Reset. (Almost certainly redundant!) currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; // Something went wrong. Reset. (Almost certainly redundant!)
} }
else if ((nmeaByteCounter == 1) && (incoming != 'G')) else if ((nmeaByteCounter == 1) && (incoming != 'G'))
{ {
currentSentence = NONE; // Something went wrong. Reset. currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; // Something went wrong. Reset.
} }
else if ((nmeaByteCounter >= 0) && (nmeaByteCounter <= 5)) else if ((nmeaByteCounter >= 0) && (nmeaByteCounter <= 5))
{ {
@@ -2028,8 +2028,8 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
nmeaByteCounter++; // Increment the byte counter nmeaByteCounter++; // Increment the byte counter
if (nmeaByteCounter == maxNMEAByteCount) // Check if we have processed too many bytes if (nmeaByteCounter == maxNMEAByteCount) // Check if we have processed too many bytes
currentSentence = NONE; // Something went wrong. Reset. currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; // Something went wrong. Reset.
if (nmeaByteCounter == 0) // Check if we are done if (nmeaByteCounter == 0) // Check if we are done
{ {
@@ -2109,12 +2109,12 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
} }
} }
#endif #endif
currentSentence = NONE; // All done! currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; // All done!
} }
} }
else if (currentSentence == RTCM) else if (currentSentence == SFE_UBLOX_SENTENCE_TYPE_RTCM)
{ {
processRTCMframe(incoming); // Deal with RTCM bytes currentSentence = processRTCMframe(incoming, &rtcmFrameCounter); // Deal with RTCM bytes
} }
} }
@@ -2876,13 +2876,15 @@ nmeaAutomaticFlags *SFE_UBLOX_GNSS::getNMEAFlagsPtr()
// Byte 2: 10-bits of length of this packet including the first two-ish header bytes, + 6. // Byte 2: 10-bits of length of this packet including the first two-ish header bytes, + 6.
// byte 3 + 4 bits: Msg type 12 bits // byte 3 + 4 bits: Msg type 12 bits
// Example: D3 00 7C 43 F0 ... / 0x7C = 124+6 = 130 bytes in this packet, 0x43F = Msg type 1087 // Example: D3 00 7C 43 F0 ... / 0x7C = 124+6 = 130 bytes in this packet, 0x43F = Msg type 1087
void SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming) SFE_UBLOX_GNSS::sfe_ublox_sentence_types_e SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming, uint16_t *rtcmFrameCounter)
{ {
if (rtcmFrameCounter == 1) static uint16_t rtcmLen = 0;
if (*rtcmFrameCounter == 1)
{ {
rtcmLen = (incoming & 0x03) << 8; // Get the last two bits of this byte. Bits 8&9 of 10-bit length rtcmLen = (incoming & 0x03) << 8; // Get the last two bits of this byte. Bits 8&9 of 10-bit length
} }
else if (rtcmFrameCounter == 2) else if (*rtcmFrameCounter == 2)
{ {
rtcmLen |= incoming; // Bits 0-7 of packet length rtcmLen |= incoming; // Bits 0-7 of packet length
rtcmLen += 6; // There are 6 additional bytes of what we presume is header, msgType, CRC, and stuff rtcmLen += 6; // There are 6 additional bytes of what we presume is header, msgType, CRC, and stuff
@@ -2896,15 +2898,12 @@ void SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming)
rtcmMsgType |= (incoming >> 4); //Message Type, bits 0-7 rtcmMsgType |= (incoming >> 4); //Message Type, bits 0-7
}*/ }*/
rtcmFrameCounter++; *rtcmFrameCounter = *rtcmFrameCounter + 1;
processRTCM(incoming); // Here is where we expose this byte to the user processRTCM(incoming); // Here is where we expose this byte to the user
if (rtcmFrameCounter == rtcmLen) // Reset and start looking for next sentence type when done
{ return (*rtcmFrameCounter == rtcmLen) ? SFE_UBLOX_SENTENCE_TYPE_NONE : SFE_UBLOX_SENTENCE_TYPE_RTCM;
// We're done!
currentSentence = NONE; // Reset and start looking for next sentence type
}
} }
// This function is called for each byte of an RTCM frame // This function is called for each byte of an RTCM frame
@@ -2912,9 +2911,6 @@ void SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming)
// Bytes can be piped to Serial or other interface. The consumer could be a radio or the internet (Ntrip broadcaster) // Bytes can be piped to Serial or other interface. The consumer could be a radio or the internet (Ntrip broadcaster)
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming) void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
{ {
uint8_t ignoreMe = incoming;
ignoreMe += 0; // Do something with incoming just to get rid of the pesky compiler warning!
// Radio.sendReliable((String)incoming); //An example of passing this byte to a radio // Radio.sendReliable((String)incoming); //An example of passing this byte to a radio
//_debugSerial->write(incoming); //An example of passing this byte out the serial port //_debugSerial->write(incoming); //An example of passing this byte out the serial port
@@ -2924,6 +2920,8 @@ void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
// if(incoming < 0x10) _debugSerial->print(F("0")); // if(incoming < 0x10) _debugSerial->print(F("0"));
// _debugSerial->print(incoming, HEX); // _debugSerial->print(incoming, HEX);
// if(rtcmFrameCounter % 16 == 0) _debugSerial->println(); // if(rtcmFrameCounter % 16 == 0) _debugSerial->println();
(void)incoming; // Do something with incoming just to get rid of the pesky compiler warning!
} }
// Given a character, file it away into the uxb packet structure // Given a character, file it away into the uxb packet structure
@@ -2996,7 +2994,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_
{ {
incomingUBX->checksumB = incoming; incomingUBX->checksumB = incoming;
currentSentence = NONE; // We're done! Reset the sentence to being looking for a new start char currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; // We're done! Reset the sentence to being looking for a new start char
// Validate this sentence // Validate this sentence
if ((incomingUBX->checksumA == rollingChecksumA) && (incomingUBX->checksumB == rollingChecksumB)) if ((incomingUBX->checksumA == rollingChecksumA) && (incomingUBX->checksumB == rollingChecksumB))
@@ -3164,7 +3162,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_
if (overrun || ((incomingUBX->counter == maximum_payload_size + 6) && (ignoreThisPayload == false))) if (overrun || ((incomingUBX->counter == maximum_payload_size + 6) && (ignoreThisPayload == false)))
{ {
// Something has gone very wrong // Something has gone very wrong
currentSentence = NONE; // Reset the sentence to being looking for a new start char currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; // Reset the sentence to being looking for a new start char
#ifndef SFE_UBLOX_REDUCED_PROG_MEM #ifndef SFE_UBLOX_REDUCED_PROG_MEM
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
{ {
@@ -3616,8 +3614,8 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
packetUBXNAVTIMEUTC->moduleQueried.moduleQueried.all = 0xFFFFFFFF; packetUBXNAVTIMEUTC->moduleQueried.moduleQueried.all = 0xFFFFFFFF;
// Check if we need to copy the data for the callback // Check if we need to copy the data for the callback
if ((packetUBXNAVTIMEUTC->callbackData != NULL) // If RAM has been allocated for the copy of the data if ((packetUBXNAVTIMEUTC->callbackData != NULL) // If RAM has been allocated for the copy of the data
&& (packetUBXNAVTIMEUTC->automaticFlags.flags.bits.callbackCopyValid == false)) // AND the data is stale && (packetUBXNAVTIMEUTC->automaticFlags.flags.bits.callbackCopyValid == false)) // AND the data is stale
{ {
memcpy(&packetUBXNAVTIMEUTC->callbackData->iTOW, &packetUBXNAVTIMEUTC->data.iTOW, sizeof(UBX_NAV_TIMEUTC_data_t)); memcpy(&packetUBXNAVTIMEUTC->callbackData->iTOW, &packetUBXNAVTIMEUTC->data.iTOW, sizeof(UBX_NAV_TIMEUTC_data_t));
packetUBXNAVTIMEUTC->automaticFlags.flags.bits.callbackCopyValid = true; packetUBXNAVTIMEUTC->automaticFlags.flags.bits.callbackCopyValid = true;
@@ -3945,8 +3943,10 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
// Note: the field positions depend on the version // Note: the field positions depend on the version
{ {
// Full QZSSL6 message, including Class, ID and checksum // Full QZSSL6 message, including Class, ID and checksum
for (int ch = 0; ch < UBX_RXM_QZSSL6_NUM_CHANNELS; ch ++) { for (int ch = 0; ch < UBX_RXM_QZSSL6_NUM_CHANNELS; ch++)
if (0 == (packetUBXRXMQZSSL6message->automaticFlags.flags.bits.callbackCopyValid & (1 << ch))) { {
if (0 == (packetUBXRXMQZSSL6message->automaticFlags.flags.bits.callbackCopyValid & (1 << ch)))
{
packetUBXRXMQZSSL6message->callbackData[ch].sync1 = UBX_SYNCH_1; packetUBXRXMQZSSL6message->callbackData[ch].sync1 = UBX_SYNCH_1;
packetUBXRXMQZSSL6message->callbackData[ch].sync2 = UBX_SYNCH_2; packetUBXRXMQZSSL6message->callbackData[ch].sync2 = UBX_SYNCH_2;
@@ -4621,9 +4621,6 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::sendCommand(ubxPacket *outgoingUBX, uint16_t
// Returns false if sensor fails to respond to I2C traffic // Returns false if sensor fails to respond to I2C traffic
sfe_ublox_status_e SFE_UBLOX_GNSS::sendI2cCommand(ubxPacket *outgoingUBX, uint16_t maxWait) sfe_ublox_status_e SFE_UBLOX_GNSS::sendI2cCommand(ubxPacket *outgoingUBX, uint16_t maxWait)
{ {
uint16_t ignoreMe = maxWait;
ignoreMe += 0; // Do something with maxWait just to avoid the pesky compiler warnings!
// From the integration guide: // From the integration guide:
// "The receiver does not provide any write access except for writing UBX and NMEA messages to the // "The receiver does not provide any write access except for writing UBX and NMEA messages to the
// receiver, such as configuration or aiding data. Therefore, the register set mentioned in section Read // receiver, such as configuration or aiding data. Therefore, the register set mentioned in section Read
@@ -4755,6 +4752,8 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::sendI2cCommand(ubxPacket *outgoingUBX, uint16
if (_i2cPort->endTransmission() != 0) if (_i2cPort->endTransmission() != 0)
return (SFE_UBLOX_STATUS_I2C_COMM_FAILURE); // Sensor did not ACK return (SFE_UBLOX_STATUS_I2C_COMM_FAILURE); // Sensor did not ACK
(void)maxWait; // Do something with maxWait just to avoid the pesky compiler warnings!
return (SFE_UBLOX_STATUS_SUCCESS); return (SFE_UBLOX_STATUS_SUCCESS);
} }
@@ -4785,7 +4784,7 @@ void SFE_UBLOX_GNSS::sendSerialCommand(ubxPacket *outgoingUBX)
void SFE_UBLOX_GNSS::spiTransfer(uint8_t byteToTransfer) void SFE_UBLOX_GNSS::spiTransfer(uint8_t byteToTransfer)
{ {
uint8_t returnedByte = _spiPort->transfer(byteToTransfer); uint8_t returnedByte = _spiPort->transfer(byteToTransfer);
if ((spiBufferIndex < getSpiTransactionSize()) && (returnedByte != 0xFF || currentSentence != NONE)) if ((spiBufferIndex < getSpiTransactionSize()) && (returnedByte != 0xFF || currentSentence != SFE_UBLOX_SENTENCE_TYPE_NONE))
{ {
spiBuffer[spiBufferIndex] = returnedByte; spiBuffer[spiBufferIndex] = returnedByte;
spiBufferIndex++; spiBufferIndex++;
@@ -5469,9 +5468,9 @@ void SFE_UBLOX_GNSS::checkCallbacks(void)
packetUBXNAVPVAT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale packetUBXNAVPVAT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale
} }
if ((packetUBXNAVTIMEUTC != NULL) // If RAM has been allocated for message storage if ((packetUBXNAVTIMEUTC != NULL) // If RAM has been allocated for message storage
&& (packetUBXNAVTIMEUTC->callbackData != NULL) // If RAM has been allocated for the copy of the data && (packetUBXNAVTIMEUTC->callbackData != NULL) // If RAM has been allocated for the copy of the data
&& (packetUBXNAVTIMEUTC->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid && (packetUBXNAVTIMEUTC->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid
{ {
if (packetUBXNAVTIMEUTC->callbackPointerPtr != NULL) // If the pointer to the callback has been defined if (packetUBXNAVTIMEUTC->callbackPointerPtr != NULL) // If the pointer to the callback has been defined
{ {
@@ -5571,9 +5570,9 @@ void SFE_UBLOX_GNSS::checkCallbacks(void)
packetUBXNAVAOPSTATUS->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale packetUBXNAVAOPSTATUS->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale
} }
if ((packetUBXNAVEOE != NULL) // If RAM has been allocated for message storage if ((packetUBXNAVEOE != NULL) // If RAM has been allocated for message storage
&& (packetUBXNAVEOE->callbackData != NULL) // If RAM has been allocated for the copy of the data && (packetUBXNAVEOE->callbackData != NULL) // If RAM has been allocated for the copy of the data
&& (packetUBXNAVEOE->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid && (packetUBXNAVEOE->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid
{ {
if (packetUBXNAVEOE->callbackPointerPtr != NULL) // If the pointer to the callback has been defined if (packetUBXNAVEOE->callbackPointerPtr != NULL) // If the pointer to the callback has been defined
{ {
@@ -5606,15 +5605,16 @@ void SFE_UBLOX_GNSS::checkCallbacks(void)
packetUBXRXMPMPmessage->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale packetUBXRXMPMPmessage->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale
} }
if ((packetUBXRXMQZSSL6message != NULL) && // If RAM has been allocated for message storage if ((packetUBXRXMQZSSL6message != NULL) && // If RAM has been allocated for message storage
(packetUBXRXMQZSSL6message->callbackData != NULL) && // If RAM has been allocated for the copy of the data (packetUBXRXMQZSSL6message->callbackData != NULL) && // If RAM has been allocated for the copy of the data
(packetUBXRXMQZSSL6message->callbackPointerPtr != NULL)) // If the pointer to the callback has been defined (packetUBXRXMQZSSL6message->callbackPointerPtr != NULL)) // If the pointer to the callback has been defined
{ {
for (int ch = 0; ch < UBX_RXM_QZSSL6_NUM_CHANNELS; ch ++) { for (int ch = 0; ch < UBX_RXM_QZSSL6_NUM_CHANNELS; ch++)
{
if (packetUBXRXMQZSSL6message->automaticFlags.flags.bits.callbackCopyValid & (1 << ch)) // If the copy of the data is valid if (packetUBXRXMQZSSL6message->automaticFlags.flags.bits.callbackCopyValid & (1 << ch)) // If the copy of the data is valid
{ {
packetUBXRXMQZSSL6message->callbackPointerPtr( &packetUBXRXMQZSSL6message->callbackData[ch] ); // Call the callback packetUBXRXMQZSSL6message->callbackPointerPtr(&packetUBXRXMQZSSL6message->callbackData[ch]); // Call the callback
packetUBXRXMQZSSL6message->automaticFlags.flags.bits.callbackCopyValid &= ~(1 << ch); // clear it packetUBXRXMQZSSL6message->automaticFlags.flags.bits.callbackCopyValid &= ~(1 << ch); // clear it
} }
} }
} }
@@ -13130,7 +13130,6 @@ bool SFE_UBLOX_GNSS::initPacketUBXRXMQZSSL6message()
return (true); return (true);
} }
bool SFE_UBLOX_GNSS::setRXMCORcallbackPtr(void (*callbackPointer)(UBX_RXM_COR_data_t *)) bool SFE_UBLOX_GNSS::setRXMCORcallbackPtr(void (*callbackPointer)(UBX_RXM_COR_data_t *))
{ {
if (packetUBXRXMCOR == NULL) if (packetUBXRXMCOR == NULL)
@@ -17498,8 +17497,7 @@ uint16_t SFE_UBLOX_GNSS::getMagAcc(uint16_t maxWait)
// getGeoidSeparation is currently redundant. The geoid separation seems to only be provided in NMEA GGA and GNS messages. // getGeoidSeparation is currently redundant. The geoid separation seems to only be provided in NMEA GGA and GNS messages.
int32_t SFE_UBLOX_GNSS::getGeoidSeparation(uint16_t maxWait) int32_t SFE_UBLOX_GNSS::getGeoidSeparation(uint16_t maxWait)
{ {
uint16_t ignoreMe = maxWait; (void)maxWait; // Do something with maxWait just to get rid of the pesky compiler warning
ignoreMe += 0; // Do something with maxWait just to get rid of the pesky compiler warning
return (0); return (0);
} }
+57 -59
View File
@@ -646,6 +646,15 @@ public:
SFE_UBLOX_GNSS(void); SFE_UBLOX_GNSS(void);
~SFE_UBLOX_GNSS(void); ~SFE_UBLOX_GNSS(void);
// Depending on the sentence type the processor will load characters into different arrays
enum sfe_ublox_sentence_types_e
{
SFE_UBLOX_SENTENCE_TYPE_NONE = 0,
SFE_UBLOX_SENTENCE_TYPE_NMEA,
SFE_UBLOX_SENTENCE_TYPE_UBX,
SFE_UBLOX_SENTENCE_TYPE_RTCM
} currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE;
// A default of 250ms for maxWait seems fine for I2C but is not enough for SerialUSB. // A default of 250ms for maxWait seems fine for I2C but is not enough for SerialUSB.
// If you know you are only going to be using I2C / Qwiic communication, you can // If you know you are only going to be using I2C / Qwiic communication, you can
// safely reduce defaultMaxWait to 250. // safely reduce defaultMaxWait to 250.
@@ -736,12 +745,12 @@ public:
// Process the incoming data // Process the incoming data
void process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); // Processes NMEA and UBX binary sentences one byte at a time void process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); // Processes NMEA and UBX binary sentences one byte at a time
void processNMEA(char incoming) __attribute__((weak)); // Given a NMEA character, do something with it. User can overwrite if desired to use something like tinyGPS or MicroNMEA libraries void processNMEA(char incoming) __attribute__((weak)); // Given a NMEA character, do something with it. User can overwrite if desired to use something like tinyGPS or MicroNMEA libraries
void processRTCMframe(uint8_t incoming); // Monitor the incoming bytes for start and length bytes sfe_ublox_sentence_types_e processRTCMframe(uint8_t incoming, uint16_t *rtcmFrameCounter) __attribute__((weak)); // Monitor the incoming bytes for start and length bytes
void processRTCM(uint8_t incoming) __attribute__((weak)); // Given rtcm byte, do something with it. User can overwrite if desired to pipe bytes to radio, internet, etc. void processRTCM(uint8_t incoming) __attribute__((weak)); // Given rtcm byte, do something with it. User can overwrite if desired to pipe bytes to radio, internet, etc.
void processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); // Given a character, file it away into the uxb packet structure void processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); // Given a character, file it away into the uxb packet structure
void processUBXpacket(ubxPacket *msg); // Once a packet has been received and validated, identify this packet's class/id and update internal flags void processUBXpacket(ubxPacket *msg); // Once a packet has been received and validated, identify this packet's class/id and update internal flags
// Send I2C/Serial/SPI commands to the module // Send I2C/Serial/SPI commands to the module
@@ -1543,12 +1552,12 @@ public:
UBX_NAV_RELPOSNED_t *packetUBXNAVRELPOSNED = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_NAV_RELPOSNED_t *packetUBXNAVRELPOSNED = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_NAV_AOPSTATUS_t *packetUBXNAVAOPSTATUS = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_NAV_AOPSTATUS_t *packetUBXNAVAOPSTATUS = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_RXM_PMP_t *packetUBXRXMPMP = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_RXM_PMP_t *packetUBXRXMPMP = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_RXM_PMP_message_t *packetUBXRXMPMPmessage = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_RXM_PMP_message_t *packetUBXRXMPMPmessage = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_RXM_QZSSL6_message_t *packetUBXRXMQZSSL6message = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_RXM_QZSSL6_message_t *packetUBXRXMQZSSL6message = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_RXM_COR_t *packetUBXRXMCOR = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_RXM_COR_t *packetUBXRXMCOR = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_RXM_SFRBX_t *packetUBXRXMSFRBX = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_RXM_SFRBX_t *packetUBXRXMSFRBX = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_RXM_RAWX_t *packetUBXRXMRAWX = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_RXM_RAWX_t *packetUBXRXMRAWX = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_CFG_PRT_t *packetUBXCFGPRT = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_CFG_PRT_t *packetUBXCFGPRT = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
UBX_CFG_RATE_t *packetUBXCFGRATE = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_CFG_RATE_t *packetUBXCFGRATE = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
@@ -1582,15 +1591,6 @@ public:
uint16_t rtcmFrameCounter = 0; // Tracks the type of incoming byte inside RTCM frame uint16_t rtcmFrameCounter = 0; // Tracks the type of incoming byte inside RTCM frame
private: private:
// Depending on the sentence type the processor will load characters into different arrays
enum SentenceTypes
{
NONE = 0,
NMEA,
UBX,
RTCM
} currentSentence = NONE;
// Depending on the ubx binary response class, store binary responses into different places // Depending on the ubx binary response class, store binary responses into different places
enum classTypes enum classTypes
{ {
@@ -1626,44 +1626,44 @@ private:
// The initPacket functions need to be private as they don't check if memory has already been allocated. // The initPacket functions need to be private as they don't check if memory has already been allocated.
// Functions like setAutoNAVPOSECEF will check that memory has not been allocated before calling initPacket. // Functions like setAutoNAVPOSECEF will check that memory has not been allocated before calling initPacket.
bool initPacketUBXNAVPOSECEF(); // Allocate RAM for packetUBXNAVPOSECEF and initialize it bool initPacketUBXNAVPOSECEF(); // Allocate RAM for packetUBXNAVPOSECEF and initialize it
bool initPacketUBXNAVSTATUS(); // Allocate RAM for packetUBXNAVSTATUS and initialize it bool initPacketUBXNAVSTATUS(); // Allocate RAM for packetUBXNAVSTATUS and initialize it
bool initPacketUBXNAVDOP(); // Allocate RAM for packetUBXNAVDOP and initialize it bool initPacketUBXNAVDOP(); // Allocate RAM for packetUBXNAVDOP and initialize it
bool initPacketUBXNAVATT(); // Allocate RAM for packetUBXNAVATT and initialize it bool initPacketUBXNAVATT(); // Allocate RAM for packetUBXNAVATT and initialize it
bool initPacketUBXNAVPVT(); // Allocate RAM for packetUBXNAVPVT and initialize it bool initPacketUBXNAVPVT(); // Allocate RAM for packetUBXNAVPVT and initialize it
bool initPacketUBXNAVODO(); // Allocate RAM for packetUBXNAVODO and initialize it bool initPacketUBXNAVODO(); // Allocate RAM for packetUBXNAVODO and initialize it
bool initPacketUBXNAVVELECEF(); // Allocate RAM for packetUBXNAVVELECEF and initialize it bool initPacketUBXNAVVELECEF(); // Allocate RAM for packetUBXNAVVELECEF and initialize it
bool initPacketUBXNAVVELNED(); // Allocate RAM for packetUBXNAVVELNED and initialize it bool initPacketUBXNAVVELNED(); // Allocate RAM for packetUBXNAVVELNED and initialize it
bool initPacketUBXNAVHPPOSECEF(); // Allocate RAM for packetUBXNAVHPPOSECEF and initialize it bool initPacketUBXNAVHPPOSECEF(); // Allocate RAM for packetUBXNAVHPPOSECEF and initialize it
bool initPacketUBXNAVHPPOSLLH(); // Allocate RAM for packetUBXNAVHPPOSLLH and initialize it bool initPacketUBXNAVHPPOSLLH(); // Allocate RAM for packetUBXNAVHPPOSLLH and initialize it
bool initPacketUBXNAVPVAT(); // Allocate RAM for packetUBXNAVPVAT and initialize it bool initPacketUBXNAVPVAT(); // Allocate RAM for packetUBXNAVPVAT and initialize it
bool initPacketUBXNAVTIMEUTC(); // Allocate RAM for packetUBXNAVTIMEUTC and initialize it bool initPacketUBXNAVTIMEUTC(); // Allocate RAM for packetUBXNAVTIMEUTC and initialize it
bool initPacketUBXNAVCLOCK(); // Allocate RAM for packetUBXNAVCLOCK and initialize it bool initPacketUBXNAVCLOCK(); // Allocate RAM for packetUBXNAVCLOCK and initialize it
bool initPacketUBXNAVTIMELS(); // Allocate RAM for packetUBXNAVTIMELS and initialize it bool initPacketUBXNAVTIMELS(); // Allocate RAM for packetUBXNAVTIMELS and initialize it
bool initPacketUBXNAVSVIN(); // Allocate RAM for packetUBXNAVSVIN and initialize it bool initPacketUBXNAVSVIN(); // Allocate RAM for packetUBXNAVSVIN and initialize it
bool initPacketUBXNAVSAT(); // Allocate RAM for packetUBXNAVSAT and initialize it bool initPacketUBXNAVSAT(); // Allocate RAM for packetUBXNAVSAT and initialize it
bool initPacketUBXNAVRELPOSNED(); // Allocate RAM for packetUBXNAVRELPOSNED and initialize it bool initPacketUBXNAVRELPOSNED(); // Allocate RAM for packetUBXNAVRELPOSNED and initialize it
bool initPacketUBXNAVAOPSTATUS(); // Allocate RAM for packetUBXNAVAOPSTATUS and initialize it bool initPacketUBXNAVAOPSTATUS(); // Allocate RAM for packetUBXNAVAOPSTATUS and initialize it
bool initPacketUBXNAVEOE(); // Allocate RAM for packetUBXNAVEOE and initialize it bool initPacketUBXNAVEOE(); // Allocate RAM for packetUBXNAVEOE and initialize it
bool initPacketUBXRXMPMP(); // Allocate RAM for packetUBXRXMPMP and initialize it bool initPacketUBXRXMPMP(); // Allocate RAM for packetUBXRXMPMP and initialize it
bool initPacketUBXRXMPMPmessage(); // Allocate RAM for packetUBXRXMPMPRaw and initialize it bool initPacketUBXRXMPMPmessage(); // Allocate RAM for packetUBXRXMPMPRaw and initialize it
bool initPacketUBXRXMQZSSL6message(); // Allocate RAM for packetUBXRXMQZSSL6raw and initialize it bool initPacketUBXRXMQZSSL6message(); // Allocate RAM for packetUBXRXMQZSSL6raw and initialize it
bool initPacketUBXRXMCOR(); // Allocate RAM for packetUBXRXMCOR and initialize it bool initPacketUBXRXMCOR(); // Allocate RAM for packetUBXRXMCOR and initialize it
bool initPacketUBXRXMSFRBX(); // Allocate RAM for packetUBXRXMSFRBX and initialize it bool initPacketUBXRXMSFRBX(); // Allocate RAM for packetUBXRXMSFRBX and initialize it
bool initPacketUBXRXMRAWX(); // Allocate RAM for packetUBXRXMRAWX and initialize it bool initPacketUBXRXMRAWX(); // Allocate RAM for packetUBXRXMRAWX and initialize it
bool initPacketUBXCFGPRT(); // Allocate RAM for packetUBXCFGPRT and initialize it bool initPacketUBXCFGPRT(); // Allocate RAM for packetUBXCFGPRT and initialize it
bool initPacketUBXCFGRATE(); // Allocate RAM for packetUBXCFGRATE and initialize it bool initPacketUBXCFGRATE(); // Allocate RAM for packetUBXCFGRATE and initialize it
bool initPacketUBXTIMTM2(); // Allocate RAM for packetUBXTIMTM2 and initialize it bool initPacketUBXTIMTM2(); // Allocate RAM for packetUBXTIMTM2 and initialize it
bool initPacketUBXESFALG(); // Allocate RAM for packetUBXESFALG and initialize it bool initPacketUBXESFALG(); // Allocate RAM for packetUBXESFALG and initialize it
bool initPacketUBXESFSTATUS(); // Allocate RAM for packetUBXESFSTATUS and initialize it bool initPacketUBXESFSTATUS(); // Allocate RAM for packetUBXESFSTATUS and initialize it
bool initPacketUBXESFINS(); // Allocate RAM for packetUBXESFINS and initialize it bool initPacketUBXESFINS(); // Allocate RAM for packetUBXESFINS and initialize it
bool initPacketUBXESFMEAS(); // Allocate RAM for packetUBXESFMEAS and initialize it bool initPacketUBXESFMEAS(); // Allocate RAM for packetUBXESFMEAS and initialize it
bool initPacketUBXESFRAW(); // Allocate RAM for packetUBXESFRAW and initialize it bool initPacketUBXESFRAW(); // Allocate RAM for packetUBXESFRAW and initialize it
bool initPacketUBXHNRATT(); // Allocate RAM for packetUBXHNRATT and initialize it bool initPacketUBXHNRATT(); // Allocate RAM for packetUBXHNRATT and initialize it
bool initPacketUBXHNRINS(); // Allocate RAM for packetUBXHNRINS and initialize it bool initPacketUBXHNRINS(); // Allocate RAM for packetUBXHNRINS and initialize it
bool initPacketUBXHNRPVT(); // Allocate RAM for packetUBXHNRPVT and initialize it bool initPacketUBXHNRPVT(); // Allocate RAM for packetUBXHNRPVT and initialize it
bool initPacketUBXMGAACK(); // Allocate RAM for packetUBXMGAACK and initialize it bool initPacketUBXMGAACK(); // Allocate RAM for packetUBXMGAACK and initialize it
bool initPacketUBXMGADBD(); // Allocate RAM for packetUBXMGADBD and initialize it bool initPacketUBXMGADBD(); // Allocate RAM for packetUBXMGADBD and initialize it
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA #ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
bool initStorageNMEAGPGGA(); // Allocate RAM for incoming NMEA GPGGA messages and initialize it bool initStorageNMEAGPGGA(); // Allocate RAM for incoming NMEA GPGGA messages and initialize it
@@ -1761,8 +1761,6 @@ private:
uint8_t getNMEAMaxLength(); // Get the maximum length of this NMEA message uint8_t getNMEAMaxLength(); // Get the maximum length of this NMEA message
nmeaAutomaticFlags *getNMEAFlagsPtr(); // Get a pointer to the flags nmeaAutomaticFlags *getNMEAFlagsPtr(); // Get a pointer to the flags
uint16_t rtcmLen = 0;
// Flag to prevent reentry into checkCallbacks // Flag to prevent reentry into checkCallbacks
// Prevent badness if the user accidentally calls checkCallbacks from inside a callback // Prevent badness if the user accidentally calls checkCallbacks from inside a callback
volatile bool checkCallbacksReentrant = false; volatile bool checkCallbacksReentrant = false;