diff --git a/Adding_New_Messages.md b/Adding_New_Messages.md index e5c6b98..41b0728 100644 --- a/Adding_New_Messages.md +++ b/Adding_New_Messages.md @@ -129,21 +129,23 @@ See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Libra See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/b746d8e2742961ede95e2d06d5db3a3a557e571d) for the changes. -#### Step 6.3: Update processUBXpacket() +#### Step 6.3: Update getMaxPayloadSize() + +#### Step 6.4: Update processUBXpacket() Take time to double-check that you have used the correct data width, signed/unsigned and position for each field. See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/8eecdd5044f810b0e2b567150ff63a17c219fe8e) for the changes. -#### Step 6.4: Update checkCallbacks() +#### Step 6.5: Update checkCallbacks() See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/b53bffaa3ae12482cfb268f23796963d0b8519c9) for the changes. -#### Step 6.5: Add the "auto" functions +#### Step 6.6: Add the "auto" functions See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/e394ae003ad38117d150598774d0552059416473) for the changes. -#### Step 6.6: Add the helper functions (if any) +#### Step 6.7: Add the helper functions (if any) See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/318e76383e96d6676bbb57294c25e665c0d4a31f) for the changes. diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp index ac25f36..c80a9ca 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp @@ -274,6 +274,16 @@ void SFE_UBLOX_GNSS::end(void) packetUBXNAVAOPSTATUS = NULL; // Redundant? } + if (packetUBXRXMPMP != NULL) + { + if (packetUBXRXMPMP->callbackData != NULL) + { + delete packetUBXRXMPMP->callbackData; + } + delete packetUBXRXMPMP; + packetUBXRXMPMP = NULL; // Redundant? + } + if (packetUBXRXMSFRBX != NULL) { if (packetUBXRXMSFRBX->callbackData != NULL) @@ -766,8 +776,14 @@ bool SFE_UBLOX_GNSS::isConnected(uint16_t maxWait) return false; //Sensor did not ack } - // Query navigation rate to see whether we get a meaningful response - return (getNavigationFrequencyInternal(maxWait)); + // Query port configuration to see whether we get a meaningful response + // We could simply request the config for any port but, just for giggles, let's request the config for most appropriate port + if (commType == COMM_TYPE_I2C) + return (getPortSettingsInternal(COM_PORT_I2C, maxWait)); + else if (commType == COMM_TYPE_SERIAL) + return (getPortSettingsInternal(COM_PORT_UART1, maxWait)); // Could be UART2 - but this is just a response check + else // if (commType == COMM_TYPE_SPI) + return (getPortSettingsInternal(COM_PORT_SPI, maxWait)); } //Enable or disable the printing of sent/response HEX values. @@ -899,11 +915,13 @@ bool SFE_UBLOX_GNSS::checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedClas uint8_t i2cError = _i2cPort->endTransmission(false); //Always send a restart command. Do not release the bus. ESP32 supports this. if (i2cError != 0) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("checkUbloxI2C: I2C error: endTransmission returned ")); _debugSerial->println(i2cError); } +#endif return (false); //Sensor did not ACK } @@ -911,11 +929,13 @@ bool SFE_UBLOX_GNSS::checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedClas uint8_t bytesReturned = _i2cPort->requestFrom((uint8_t)_gpsI2Caddress, static_cast(2)); if (bytesReturned != 2) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("checkUbloxI2C: I2C error: requestFrom 0xFD returned ")); _debugSerial->println(bytesReturned); } +#endif return (false); //Sensor did not return 2 bytes } else //if (_i2cPort->available()) @@ -1209,6 +1229,9 @@ bool SFE_UBLOX_GNSS::checkAutomatic(uint8_t Class, uint8_t ID) case UBX_RXM_RAWX: if (packetUBXRXMRAWX != NULL) result = true; break; + case UBX_RXM_PMP: + if (packetUBXRXMPMP != NULL) result = true; + break; } } break; @@ -1216,6 +1239,9 @@ bool SFE_UBLOX_GNSS::checkAutomatic(uint8_t Class, uint8_t ID) { switch (ID) { + case UBX_CFG_PRT: + if (packetUBXCFGPRT != NULL) result = true; + break; case UBX_CFG_RATE: if (packetUBXCFGRATE != NULL) result = true; break; @@ -1327,6 +1353,9 @@ uint16_t SFE_UBLOX_GNSS::getMaxPayloadSize(uint8_t Class, uint8_t ID) case UBX_NAV_HPPOSLLH: maxSize = UBX_NAV_HPPOSLLH_LEN; break; + case UBX_NAV_PVAT: + maxSize = UBX_NAV_PVAT_LEN; + break; case UBX_NAV_CLOCK: maxSize = UBX_NAV_CLOCK_LEN; break; @@ -1358,6 +1387,9 @@ uint16_t SFE_UBLOX_GNSS::getMaxPayloadSize(uint8_t Class, uint8_t ID) case UBX_RXM_RAWX: maxSize = UBX_RXM_RAWX_MAX_LEN; break; + case UBX_RXM_PMP: + maxSize = UBX_RXM_PMP_MAX_LEN; + break; } } break; @@ -1365,6 +1397,9 @@ uint16_t SFE_UBLOX_GNSS::getMaxPayloadSize(uint8_t Class, uint8_t ID) { switch (ID) { + case UBX_CFG_PRT: + maxSize = UBX_CFG_PRT_LEN; + break; case UBX_CFG_RATE: maxSize = UBX_CFG_RATE_LEN; break; @@ -1520,6 +1555,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r uint16_t maxPayload = getMaxPayloadSize(packetBuf.cls, packetBuf.id); // Calculate how much RAM we need if (maxPayload == 0) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("process: getMaxPayloadSize returned ZERO!! Class: 0x")); @@ -1527,13 +1563,16 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r _debugSerial->print(F(" ID: 0x")); _debugSerial->println(packetBuf.id); } +#endif } if (payloadAuto != NULL) // Check if memory is already allocated - this should be impossible! { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("process: memory is already allocated for payloadAuto! Deleting...")); } +#endif delete[] payloadAuto; // Created with new[] payloadAuto = NULL; // Redundant? packetAuto.payload = payloadAuto; @@ -1542,6 +1581,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r packetAuto.payload = payloadAuto; if (payloadAuto == NULL) // Check if the alloc failed { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("process: memory allocation failed for \"automatic\" message: Class: 0x")); @@ -1550,6 +1590,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r _debugSerial->println(packetBuf.id, HEX); _debugSerial->println(F("process: \"automatic\" message could overwrite data")); } +#endif // The RAM allocation failed so fall back to using incomingUBX (usually packetCfg) even though we risk overwriting data activePacketBuffer = SFE_UBLOX_PACKET_PACKETCFG; incomingUBX->cls = packetBuf.cls; //Copy the class and ID into incomingUBX (usually packetCfg) @@ -1603,6 +1644,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r { if (packetBuf.len == 0) // Check if length is zero (hopefully this is impossible!) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("process: ZERO LENGTH packet received: Class: 0x")); @@ -1610,6 +1652,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r _debugSerial->print(F(" ID: 0x")); _debugSerial->println(packetBuf.id, HEX); } +#endif //If length is zero (!) this will be the first byte of the checksum so record it packetBuf.checksumA = incoming; } @@ -1654,6 +1697,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r } else // Length is not 2 (hopefully this is impossible!) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("process: ACK received with .len != 2: Class: 0x")); @@ -1663,6 +1707,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r _debugSerial->print(F(" len: ")); _debugSerial->println(packetBuf.len); } +#endif } } } @@ -1750,10 +1795,12 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r *lengthPtr = *lengthPtr + 1; // Increment the length if (*lengthPtr == nmeaMaxLength) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("process: NMEA buffer is full!")); } +#endif } } } @@ -1830,6 +1877,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r } else { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("process: NMEA checksum fail (2)! Expected ")); @@ -1840,14 +1888,17 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r _debugSerial->write(*(workingNMEAPtr + charsChecked + 1)); _debugSerial->println(); } +#endif } } else { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("process: NMEA checksum fail (1)!")); } +#endif } } currentSentence = NONE; // All done! @@ -1991,7 +2042,7 @@ bool SFE_UBLOX_GNSS::doesThisNMEAHaveCallback() { if (storageNMEAGPGGA != NULL) if (storageNMEAGPGGA->callbackCopy != NULL) - if (storageNMEAGPGGA->callbackPointer != NULL) + if ((storageNMEAGPGGA->callbackPointer != NULL) || (storageNMEAGPGGA->callbackPointerPtr != NULL)) return true; } @@ -2000,7 +2051,7 @@ bool SFE_UBLOX_GNSS::doesThisNMEAHaveCallback() { if (storageNMEAGNGGA != NULL) if (storageNMEAGNGGA->callbackCopy != NULL) - if (storageNMEAGNGGA->callbackPointer != NULL) + if ((storageNMEAGNGGA->callbackPointer != NULL) || (storageNMEAGNGGA->callbackPointerPtr != NULL)) return true; } @@ -2235,6 +2286,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_ maximum_payload_size = getMaxPayloadSize(incomingUBX->cls, incomingUBX->id); if (maximum_payload_size == 0) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("processUBX: getMaxPayloadSize returned ZERO!! Class: 0x")); @@ -2242,6 +2294,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_ _debugSerial->print(F(" ID: 0x")); _debugSerial->println(incomingUBX->id); } +#endif } //} //else @@ -2395,6 +2448,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_ digitalWrite((uint8_t)debugPin, HIGH); } +#ifndef SFE_UBLOX_REDUCED_PROG_MEM _debugSerial->print(F("Checksum failed:")); _debugSerial->print(F(" checksumA: ")); _debugSerial->print(incomingUBX->checksumA); @@ -2406,6 +2460,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_ _debugSerial->print(F(" rollingChecksumB: ")); _debugSerial->print(rollingChecksumB); _debugSerial->println(); +#endif } } @@ -2448,6 +2503,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_ { //Something has gone very wrong currentSentence = NONE; //Reset the sentence to being looking for a new start char +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { if (overrun) @@ -2459,6 +2515,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_ _debugSerial->print(F(" maximum_payload_size: ")); _debugSerial->println(maximum_payload_size); } +#endif } //Increment the counter @@ -3086,7 +3143,59 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg) } break; case UBX_CLASS_RXM: - if (msg->id == UBX_RXM_SFRBX) + if (msg->id == UBX_RXM_PMP) + // Note: length is variable with version 0x01 + // Note: the field positions depend on the version + { + //Parse various byte fields into storage - but only if we have memory allocated for it + if (packetUBXRXMPMP != NULL) + { + packetUBXRXMPMP->data.version = extractByte(msg, 0); + packetUBXRXMPMP->data.numBytesUserData = extractInt(msg, 2); + packetUBXRXMPMP->data.timeTag = extractLong(msg, 4); + packetUBXRXMPMP->data.uniqueWord[0] = extractLong(msg, 8); + packetUBXRXMPMP->data.uniqueWord[1] = extractLong(msg, 12); + packetUBXRXMPMP->data.serviceIdentifier = extractInt(msg, 16); + packetUBXRXMPMP->data.spare = extractByte(msg, 18); + packetUBXRXMPMP->data.uniqueWordBitErrors = extractByte(msg, 19); + + if (packetUBXRXMPMP->data.version == 0x00) + { + packetUBXRXMPMP->data.fecBits = extractInt(msg, 524); + packetUBXRXMPMP->data.ebno = extractByte(msg, 526); + } + else // if (packetUBXRXMPMP->data.version == 0x01) + { + packetUBXRXMPMP->data.fecBits = extractInt(msg, 20); + packetUBXRXMPMP->data.ebno = extractByte(msg, 22); + } + + uint16_t userDataStart = (packetUBXRXMPMP->data.version == 0x00) ? 20 : 24; + uint16_t userDataLength = (packetUBXRXMPMP->data.version == 0x00) ? 504 : (packetUBXRXMPMP->data.numBytesUserData); + for (uint16_t i = 0; (i < userDataLength) && (i < 504); i++) + { + packetUBXRXMPMP->data.userData[i] = extractByte(msg, i + userDataStart); + } + + //Mark all datums as fresh (not read before) + packetUBXRXMPMP->moduleQueried = true; + + //Check if we need to copy the data for the callbacks + if ((packetUBXRXMPMP->callbackData != NULL) // If RAM has been allocated for the copy of the data + && (packetUBXRXMPMP->automaticFlags.flags.bits.callbackCopyValid == false)) // AND the data is stale + { + memcpy(&packetUBXRXMPMP->callbackData->version, &packetUBXRXMPMP->data.version, sizeof(UBX_RXM_PMP_data_t)); + packetUBXRXMPMP->automaticFlags.flags.bits.callbackCopyValid = true; + } + + //Check if we need to copy the data into the file buffer + if (packetUBXRXMPMP->automaticFlags.flags.bits.addToFileBuffer) + { + storePacket(msg); + } + } + } + else if (msg->id == UBX_RXM_SFRBX) // Note: length is variable // Note: on protocol version 17: numWords is (0..16) // on protocol version 18+: numWords is (0..10) @@ -3184,6 +3293,24 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg) } break; case UBX_CLASS_CFG: + if (msg->id == UBX_CFG_PRT && msg->len == UBX_CFG_PRT_LEN) + { + //Parse various byte fields into storage - but only if we have memory allocated for it + if (packetUBXCFGPRT != NULL) + { + packetUBXCFGPRT->data.portID = extractByte(msg, 0); + packetUBXCFGPRT->data.txReady.all = extractInt(msg, 2); + packetUBXCFGPRT->data.mode = extractLong(msg, 4); + packetUBXCFGPRT->data.baudRate = extractLong(msg, 8); + packetUBXCFGPRT->data.inProtoMask.all = extractInt(msg, 12); + packetUBXCFGPRT->data.outProtoMask.all = extractInt(msg, 14); + packetUBXCFGPRT->data.flags = extractInt(msg, 16); + + //Mark data as valid + packetUBXCFGPRT->dataValid = true; + } + } + break; if (msg->id == UBX_CFG_RATE && msg->len == UBX_CFG_RATE_LEN) { //Parse various byte fields into storage - but only if we have memory allocated for it @@ -3435,10 +3562,12 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg) } else { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("processUBXpacket: packetUBXMGAACK is full. ACK will be lost!")); } +#endif } } } @@ -3483,10 +3612,12 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg) } else { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("processUBXpacket: packetUBXMGADBD is full. DBD data will be lost!")); } +#endif } } } @@ -3885,10 +4016,12 @@ void SFE_UBLOX_GNSS::sendSpiCommand(ubxPacket *outgoingUBX) { if (spiBuffer == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->print(F("sendSpiCommand: no memory allocation for SPI Buffer!")); } +#endif return; } @@ -4348,309 +4481,552 @@ void SFE_UBLOX_GNSS::checkCallbacks(void) if ((packetUBXNAVPOSECEF != NULL) // If RAM has been allocated for message storage && (packetUBXNAVPOSECEF->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVPOSECEF->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVPOSECEF->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV POSECEF")); - packetUBXNAVPOSECEF->callbackPointer(*packetUBXNAVPOSECEF->callbackData); // Call the callback + if (packetUBXNAVPOSECEF->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV POSECEF")); + packetUBXNAVPOSECEF->callbackPointer(*packetUBXNAVPOSECEF->callbackData); // Call the callback + } + else if (packetUBXNAVPOSECEF->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV POSECEF")); + packetUBXNAVPOSECEF->callbackPointerPtr(packetUBXNAVPOSECEF->callbackData); // Call the callback + } packetUBXNAVPOSECEF->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVSTATUS != NULL) // If RAM has been allocated for message storage && (packetUBXNAVSTATUS->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVSTATUS->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVSTATUS->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV STATUS")); - packetUBXNAVSTATUS->callbackPointer(*packetUBXNAVSTATUS->callbackData); // Call the callback + if (packetUBXNAVSTATUS->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV STATUS")); + packetUBXNAVSTATUS->callbackPointer(*packetUBXNAVSTATUS->callbackData); // Call the callback + } + else if (packetUBXNAVSTATUS->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV STATUS")); + packetUBXNAVSTATUS->callbackPointerPtr(packetUBXNAVSTATUS->callbackData); // Call the callback + } packetUBXNAVSTATUS->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVDOP != NULL) // If RAM has been allocated for message storage && (packetUBXNAVDOP->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVDOP->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVDOP->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV DOP")); - packetUBXNAVDOP->callbackPointer(*packetUBXNAVDOP->callbackData); // Call the callback + if (packetUBXNAVDOP->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV DOP")); + packetUBXNAVDOP->callbackPointer(*packetUBXNAVDOP->callbackData); // Call the callback + } + else if (packetUBXNAVDOP->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV DOP")); + packetUBXNAVDOP->callbackPointerPtr(packetUBXNAVDOP->callbackData); // Call the callback + } packetUBXNAVDOP->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVATT != NULL) // If RAM has been allocated for message storage && (packetUBXNAVATT->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVATT->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVATT->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV ATT")); - packetUBXNAVATT->callbackPointer(*packetUBXNAVATT->callbackData); // Call the callback + if (packetUBXNAVATT->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV ATT")); + packetUBXNAVATT->callbackPointer(*packetUBXNAVATT->callbackData); // Call the callback + } + else if (packetUBXNAVATT->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV ATT")); + packetUBXNAVATT->callbackPointerPtr(packetUBXNAVATT->callbackData); // Call the callback + } packetUBXNAVATT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVPVT != NULL) // If RAM has been allocated for message storage && (packetUBXNAVPVT->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVPVT->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVPVT->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - //if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV PVT")); - packetUBXNAVPVT->callbackPointer(*packetUBXNAVPVT->callbackData); // Call the callback + if (packetUBXNAVPVT->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV PVT")); + packetUBXNAVPVT->callbackPointer(*packetUBXNAVPVT->callbackData); // Call the callback + } + else if (packetUBXNAVPVT->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV PVT")); + packetUBXNAVPVT->callbackPointerPtr(packetUBXNAVPVT->callbackData); // Call the callback + } packetUBXNAVPVT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVODO != NULL) // If RAM has been allocated for message storage && (packetUBXNAVODO->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVODO->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVODO->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV ODO")); - packetUBXNAVODO->callbackPointer(*packetUBXNAVODO->callbackData); // Call the callback + if (packetUBXNAVODO->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV ODO")); + packetUBXNAVODO->callbackPointer(*packetUBXNAVODO->callbackData); // Call the callback + } + else if (packetUBXNAVODO->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV ODO")); + packetUBXNAVODO->callbackPointerPtr(packetUBXNAVODO->callbackData); // Call the callback + } packetUBXNAVODO->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVVELECEF != NULL) // If RAM has been allocated for message storage && (packetUBXNAVVELECEF->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVVELECEF->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVVELECEF->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV VELECEF")); - packetUBXNAVVELECEF->callbackPointer(*packetUBXNAVVELECEF->callbackData); // Call the callback + if (packetUBXNAVVELECEF->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV VELECEF")); + packetUBXNAVVELECEF->callbackPointer(*packetUBXNAVVELECEF->callbackData); // Call the callback + } + else if (packetUBXNAVVELECEF->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV VELECEF")); + packetUBXNAVVELECEF->callbackPointerPtr(packetUBXNAVVELECEF->callbackData); // Call the callback + } packetUBXNAVVELECEF->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVVELNED != NULL) // If RAM has been allocated for message storage && (packetUBXNAVVELNED->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVVELNED->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVVELNED->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV VELNED")); - packetUBXNAVVELNED->callbackPointer(*packetUBXNAVVELNED->callbackData); // Call the callback + if (packetUBXNAVVELNED->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV VELNED")); + packetUBXNAVVELNED->callbackPointer(*packetUBXNAVVELNED->callbackData); // Call the callback + } + else if (packetUBXNAVVELNED->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV VELNED")); + packetUBXNAVVELNED->callbackPointerPtr(packetUBXNAVVELNED->callbackData); // Call the callback + } packetUBXNAVVELNED->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVHPPOSECEF != NULL) // If RAM has been allocated for message storage && (packetUBXNAVHPPOSECEF->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVHPPOSECEF->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVHPPOSECEF->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV HPPOSECEF")); - packetUBXNAVHPPOSECEF->callbackPointer(*packetUBXNAVHPPOSECEF->callbackData); // Call the callback + if (packetUBXNAVHPPOSECEF->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV HPPOSECEF")); + packetUBXNAVHPPOSECEF->callbackPointer(*packetUBXNAVHPPOSECEF->callbackData); // Call the callback + } + else if (packetUBXNAVHPPOSECEF->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV HPPOSECEF")); + packetUBXNAVHPPOSECEF->callbackPointerPtr(packetUBXNAVHPPOSECEF->callbackData); // Call the callback + } packetUBXNAVHPPOSECEF->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVHPPOSLLH != NULL) // If RAM has been allocated for message storage && (packetUBXNAVHPPOSLLH->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVHPPOSLLH->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVHPPOSLLH->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV HPPOSLLH")); - packetUBXNAVHPPOSLLH->callbackPointer(*packetUBXNAVHPPOSLLH->callbackData); // Call the callback + if (packetUBXNAVHPPOSLLH->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV HPPOSLLH")); + packetUBXNAVHPPOSLLH->callbackPointer(*packetUBXNAVHPPOSLLH->callbackData); // Call the callback + } + else if (packetUBXNAVHPPOSLLH->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV HPPOSLLH")); + packetUBXNAVHPPOSLLH->callbackPointerPtr(packetUBXNAVHPPOSLLH->callbackData); // Call the callback + } packetUBXNAVHPPOSLLH->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVPVAT != NULL) // If RAM has been allocated for message storage && (packetUBXNAVPVAT->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVPVAT->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVPVAT->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - //if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV PVAT")); - packetUBXNAVPVAT->callbackPointer(*packetUBXNAVPVAT->callbackData); // Call the callback + if (packetUBXNAVPVAT->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV PVAT")); + packetUBXNAVPVAT->callbackPointer(*packetUBXNAVPVAT->callbackData); // Call the callback + } + else if (packetUBXNAVPVAT->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV PVAT")); + packetUBXNAVPVAT->callbackPointerPtr(packetUBXNAVPVAT->callbackData); // Call the callback + } packetUBXNAVPVAT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVCLOCK != NULL) // If RAM has been allocated for message storage && (packetUBXNAVCLOCK->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVCLOCK->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVCLOCK->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV CLOCK")); - packetUBXNAVCLOCK->callbackPointer(*packetUBXNAVCLOCK->callbackData); // Call the callback + if (packetUBXNAVCLOCK->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV CLOCK")); + packetUBXNAVCLOCK->callbackPointer(*packetUBXNAVCLOCK->callbackData); // Call the callback + } + else if (packetUBXNAVCLOCK->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV CLOCK")); + packetUBXNAVCLOCK->callbackPointerPtr(packetUBXNAVCLOCK->callbackData); // Call the callback + } packetUBXNAVCLOCK->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVSAT != NULL) // If RAM has been allocated for message storage && (packetUBXNAVSAT->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVSAT->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVSAT->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV SAT")); - packetUBXNAVSAT->callbackPointer(*packetUBXNAVSAT->callbackData); // Call the callback + if (packetUBXNAVSAT->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV SAT")); + packetUBXNAVSAT->callbackPointer(*packetUBXNAVSAT->callbackData); // Call the callback + } + else if (packetUBXNAVSAT->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV SAT")); + packetUBXNAVSAT->callbackPointerPtr(packetUBXNAVSAT->callbackData); // Call the callback + } packetUBXNAVSAT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVRELPOSNED != NULL) // If RAM has been allocated for message storage && (packetUBXNAVRELPOSNED->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVRELPOSNED->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVRELPOSNED->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV RELPOSNED")); - packetUBXNAVRELPOSNED->callbackPointer(*packetUBXNAVRELPOSNED->callbackData); // Call the callback + if (packetUBXNAVRELPOSNED->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV RELPOSNED")); + packetUBXNAVRELPOSNED->callbackPointer(*packetUBXNAVRELPOSNED->callbackData); // Call the callback + } + else if (packetUBXNAVRELPOSNED->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV RELPOSNED")); + packetUBXNAVRELPOSNED->callbackPointerPtr(packetUBXNAVRELPOSNED->callbackData); // Call the callback + } packetUBXNAVRELPOSNED->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXNAVAOPSTATUS != NULL) // If RAM has been allocated for message storage && (packetUBXNAVAOPSTATUS->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXNAVAOPSTATUS->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXNAVAOPSTATUS->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for NAV AOPSTATUS")); - packetUBXNAVAOPSTATUS->callbackPointer(*packetUBXNAVAOPSTATUS->callbackData); // Call the callback + if (packetUBXNAVAOPSTATUS->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for NAV AOPSTATUS")); + packetUBXNAVAOPSTATUS->callbackPointer(*packetUBXNAVAOPSTATUS->callbackData); // Call the callback + } + else if (packetUBXNAVAOPSTATUS->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for NAV AOPSTATUS")); + packetUBXNAVAOPSTATUS->callbackPointerPtr(packetUBXNAVAOPSTATUS->callbackData); // Call the callback + } packetUBXNAVAOPSTATUS->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } + if ((packetUBXRXMPMP != NULL) // If RAM has been allocated for message storage + && (packetUBXRXMPMP->callbackData != NULL) // If RAM has been allocated for the copy of the data + && (packetUBXRXMPMP->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid + { + if (packetUBXRXMPMP->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for RXM PMP")); + packetUBXRXMPMP->callbackPointer(*packetUBXRXMPMP->callbackData); // Call the callback + } + else if (packetUBXRXMPMP->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for RXM PMP")); + packetUBXRXMPMP->callbackPointerPtr(packetUBXRXMPMP->callbackData); // Call the callback + } + packetUBXRXMPMP->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale + } + if ((packetUBXRXMSFRBX != NULL) // If RAM has been allocated for message storage && (packetUBXRXMSFRBX->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXRXMSFRBX->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXRXMSFRBX->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for RXM SFRBX")); - packetUBXRXMSFRBX->callbackPointer(*packetUBXRXMSFRBX->callbackData); // Call the callback + if (packetUBXRXMSFRBX->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for RXM SFRBX")); + packetUBXRXMSFRBX->callbackPointer(*packetUBXRXMSFRBX->callbackData); // Call the callback + } + else if (packetUBXRXMSFRBX->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for RXM SFRBX")); + packetUBXRXMSFRBX->callbackPointerPtr(packetUBXRXMSFRBX->callbackData); // Call the callback + } packetUBXRXMSFRBX->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXRXMRAWX != NULL) // If RAM has been allocated for message storage && (packetUBXRXMRAWX->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXRXMRAWX->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXRXMRAWX->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for RXM RAWX")); - packetUBXRXMRAWX->callbackPointer(*packetUBXRXMRAWX->callbackData); // Call the callback + if (packetUBXRXMRAWX->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for RXM RAWX")); + packetUBXRXMRAWX->callbackPointer(*packetUBXRXMRAWX->callbackData); // Call the callback + } + else if (packetUBXRXMRAWX->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for RXM RAWX")); + packetUBXRXMRAWX->callbackPointerPtr(packetUBXRXMRAWX->callbackData); // Call the callback + } packetUBXRXMRAWX->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXTIMTM2 != NULL) // If RAM has been allocated for message storage && (packetUBXTIMTM2->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXTIMTM2->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXTIMTM2->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for TIM TM2")); - packetUBXTIMTM2->callbackPointer(*packetUBXTIMTM2->callbackData); // Call the callback + if (packetUBXTIMTM2->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for TIM TM2")); + packetUBXTIMTM2->callbackPointer(*packetUBXTIMTM2->callbackData); // Call the callback + } + else if (packetUBXTIMTM2->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for TIM TM2")); + packetUBXTIMTM2->callbackPointerPtr(packetUBXTIMTM2->callbackData); // Call the callback + } packetUBXTIMTM2->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXESFALG != NULL) // If RAM has been allocated for message storage && (packetUBXESFALG->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXESFALG->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXESFALG->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for ESF ALG")); - packetUBXESFALG->callbackPointer(*packetUBXESFALG->callbackData); // Call the callback + if (packetUBXESFALG->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for ESF ALG")); + packetUBXESFALG->callbackPointer(*packetUBXESFALG->callbackData); // Call the callback + } + else if (packetUBXESFALG->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for ESF ALG")); + packetUBXESFALG->callbackPointerPtr(packetUBXESFALG->callbackData); // Call the callback + } packetUBXESFALG->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXESFINS != NULL) // If RAM has been allocated for message storage && (packetUBXESFINS->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXESFINS->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXESFINS->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for ESF INS")); - packetUBXESFINS->callbackPointer(*packetUBXESFINS->callbackData); // Call the callback + if (packetUBXESFINS->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for ESF INS")); + packetUBXESFINS->callbackPointer(*packetUBXESFINS->callbackData); // Call the callback + } + else if (packetUBXESFINS->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for ESF INS")); + packetUBXESFINS->callbackPointerPtr(packetUBXESFINS->callbackData); // Call the callback + } packetUBXESFINS->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXESFMEAS != NULL) // If RAM has been allocated for message storage && (packetUBXESFMEAS->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXESFMEAS->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXESFMEAS->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for ESF MEAS")); - packetUBXESFMEAS->callbackPointer(*packetUBXESFMEAS->callbackData); // Call the callback + if (packetUBXESFMEAS->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for ESF MEAS")); + packetUBXESFMEAS->callbackPointer(*packetUBXESFMEAS->callbackData); // Call the callback + } + else if (packetUBXESFMEAS->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for ESF MEAS")); + packetUBXESFMEAS->callbackPointerPtr(packetUBXESFMEAS->callbackData); // Call the callback + } packetUBXESFMEAS->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXESFRAW != NULL) // If RAM has been allocated for message storage && (packetUBXESFRAW->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXESFRAW->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXESFRAW->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for ESF RAW")); - packetUBXESFRAW->callbackPointer(*packetUBXESFRAW->callbackData); // Call the callback + if (packetUBXESFRAW->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for ESF RAW")); + packetUBXESFRAW->callbackPointer(*packetUBXESFRAW->callbackData); // Call the callback + } + else if (packetUBXESFRAW->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for ESF RAW")); + packetUBXESFRAW->callbackPointerPtr(packetUBXESFRAW->callbackData); // Call the callback + } packetUBXESFRAW->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXESFSTATUS != NULL) // If RAM has been allocated for message storage && (packetUBXESFSTATUS->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXESFSTATUS->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXESFSTATUS->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for ESF STATUS")); - packetUBXESFSTATUS->callbackPointer(*packetUBXESFSTATUS->callbackData); // Call the callback + if (packetUBXESFSTATUS->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for ESF STATUS")); + packetUBXESFSTATUS->callbackPointer(*packetUBXESFSTATUS->callbackData); // Call the callback + } + else if (packetUBXESFSTATUS->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for ESF STATUS")); + packetUBXESFSTATUS->callbackPointerPtr(packetUBXESFSTATUS->callbackData); // Call the callback + } packetUBXESFSTATUS->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXHNRATT != NULL) // If RAM has been allocated for message storage && (packetUBXHNRATT->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXHNRATT->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXHNRATT->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for HNR ATT")); - packetUBXHNRATT->callbackPointer(*packetUBXHNRATT->callbackData); // Call the callback + if (packetUBXHNRATT->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for HNR ATT")); + packetUBXHNRATT->callbackPointer(*packetUBXHNRATT->callbackData); // Call the callback + } + else if (packetUBXHNRATT->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for HNR ATT")); + packetUBXHNRATT->callbackPointerPtr(packetUBXHNRATT->callbackData); // Call the callback + } packetUBXHNRATT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXHNRINS != NULL) // If RAM has been allocated for message storage && (packetUBXHNRINS->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXHNRINS->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXHNRINS->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for HNR INS")); - packetUBXHNRINS->callbackPointer(*packetUBXHNRINS->callbackData); // Call the callback + if (packetUBXHNRINS->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for HNR INS")); + packetUBXHNRINS->callbackPointer(*packetUBXHNRINS->callbackData); // Call the callback + } + else if (packetUBXHNRINS->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for HNR INS")); + packetUBXHNRINS->callbackPointerPtr(packetUBXHNRINS->callbackData); // Call the callback + } packetUBXHNRINS->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((packetUBXHNRPVT != NULL) // If RAM has been allocated for message storage && (packetUBXHNRPVT->callbackData != NULL) // If RAM has been allocated for the copy of the data - && (packetUBXHNRPVT->callbackPointer != NULL) // If the pointer to the callback has been defined && (packetUBXHNRPVT->automaticFlags.flags.bits.callbackCopyValid == true)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for HNR PVT")); - packetUBXHNRPVT->callbackPointer(*packetUBXHNRPVT->callbackData); // Call the callback + if (packetUBXHNRPVT->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for HNR PVT")); + packetUBXHNRPVT->callbackPointer(*packetUBXHNRPVT->callbackData); // Call the callback + } + else if (packetUBXHNRPVT->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for HNR PVT")); + packetUBXHNRPVT->callbackPointerPtr(packetUBXHNRPVT->callbackData); // Call the callback + } packetUBXHNRPVT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale } if ((storageNMEAGPGGA != NULL) // If RAM has been allocated for message storage && (storageNMEAGPGGA->callbackCopy != NULL) // If RAM has been allocated for the copy of the data - && (storageNMEAGPGGA->callbackPointer != NULL) // If the pointer to the callback has been defined && (storageNMEAGPGGA->automaticFlags.flags.bits.callbackCopyValid == 1)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for GPGGA")); - storageNMEAGPGGA->callbackPointer(*storageNMEAGPGGA->callbackCopy); // Call the callback + if (storageNMEAGPGGA->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for GPGGA")); + storageNMEAGPGGA->callbackPointer(*storageNMEAGPGGA->callbackCopy); // Call the callback + } + else if (storageNMEAGPGGA->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for GPGGA")); + storageNMEAGPGGA->callbackPointerPtr(storageNMEAGPGGA->callbackCopy); // Call the callback + } storageNMEAGPGGA->automaticFlags.flags.bits.callbackCopyValid = 0; // Mark the data as stale } if ((storageNMEAGNGGA != NULL) // If RAM has been allocated for message storage && (storageNMEAGNGGA->callbackCopy != NULL) // If RAM has been allocated for the copy of the data - && (storageNMEAGNGGA->callbackPointer != NULL) // If the pointer to the callback has been defined && (storageNMEAGNGGA->automaticFlags.flags.bits.callbackCopyValid == 1)) // If the copy of the data is valid { - // if (_printDebug == true) - // _debugSerial->println(F("checkCallbacks: calling callback for GNGGA")); - storageNMEAGNGGA->callbackPointer(*storageNMEAGNGGA->callbackCopy); // Call the callback + if (storageNMEAGNGGA->callbackPointer != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callback for GNGGA")); + storageNMEAGNGGA->callbackPointer(*storageNMEAGNGGA->callbackCopy); // Call the callback + } + else if (storageNMEAGNGGA->callbackPointerPtr != NULL) // If the pointer to the callback has been defined + { + // if (_printDebug == true) + // _debugSerial->println(F("checkCallbacks: calling callbackPtr for GNGGA")); + storageNMEAGNGGA->callbackPointerPtr(storageNMEAGNGGA->callbackCopy); // Call the callback + } storageNMEAGNGGA->automaticFlags.flags.bits.callbackCopyValid = 0; // Mark the data as stale } @@ -4934,10 +5310,12 @@ size_t SFE_UBLOX_GNSS::pushAssistNowDataInternal(size_t offset, bool skipTime, c } if (keepGoing) // If keepGoing is still true, we must have timed out { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("pushAssistNowData: packet ack timed out!")); } +#endif } } else @@ -4990,8 +5368,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXMGAACK() packetUBXMGAACK = new UBX_MGA_ACK_DATA0_t; //Allocate RAM for the main struct if (packetUBXMGAACK == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXMGAACK: RAM alloc failed!")); +#endif return (false); } packetUBXMGAACK->head = 0; // Initialize the ring buffer pointers @@ -5503,10 +5883,12 @@ size_t SFE_UBLOX_GNSS::readNavigationDatabase(uint8_t *dataBytes, size_t maxNumD if (keepGoing) // If keepGoing is still true, we must have timed out { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("readNavigationDatabase: DBD RX timed out!")); } +#endif } i2cPollingWait = currentI2cPollingWait; // Restore i2cPollingWait @@ -5521,8 +5903,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXMGADBD() packetUBXMGADBD = new UBX_MGA_DBD_t; //Allocate RAM for the main struct if (packetUBXMGADBD == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXMGADBD: RAM alloc failed!")); +#endif return (false); } packetUBXMGADBD->head = 0; // Initialize the ring buffer pointers @@ -5694,10 +6078,12 @@ bool SFE_UBLOX_GNSS::storePacket(ubxPacket *msg) uint16_t totalLength = msg->len + 8; // Total length. Include sync chars, class, id, length and checksum bytes if (totalLength > fileBufferSpaceAvailable()) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("storePacket: insufficient space available! Data will be lost!")); } +#endif return(false); } @@ -5743,10 +6129,12 @@ bool SFE_UBLOX_GNSS::storeFileBytes(uint8_t *theBytes, uint16_t numBytes) // Now, check if there is enough space in the buffer for all of the data if (numBytes > fileBufferSpaceAvailable()) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging { _debugSerial->println(F("storeFileBytes: insufficient space available! Data will be lost!")); } +#endif return(false); } @@ -6344,8 +6732,10 @@ bool SFE_UBLOX_GNSS::initModuleSWVersion() moduleSWVersion = new moduleSWVersion_t; //Allocate RAM for the main struct if (moduleSWVersion == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initModuleSWVersion: RAM alloc failed!")); +#endif return (false); } moduleSWVersion->versionHigh = 0; @@ -6529,8 +6919,10 @@ bool SFE_UBLOX_GNSS::initGeofenceParams() currentGeofenceParams = new geofenceParams_t; //Allocate RAM for the main struct if (currentGeofenceParams == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initGeofenceParams: RAM alloc failed!")); +#endif return (false); } currentGeofenceParams->numFences = 0; @@ -7609,8 +8001,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVPOSECEFcallback(void (*callbackPointer)(UBX_NAV_P if (packetUBXNAVPOSECEF->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVPOSECEFcallback: RAM alloc failed!")); +#endif return (false); } @@ -7641,8 +8035,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVPOSECEF() packetUBXNAVPOSECEF = new UBX_NAV_POSECEF_t; //Allocate RAM for the main struct if (packetUBXNAVPOSECEF == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVPOSECEF: RAM alloc failed!")); +#endif return (false); } packetUBXNAVPOSECEF->automaticFlags.flags.all = 0; @@ -7766,8 +8162,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVSTATUScallback(void (*callbackPointer)(UBX_NAV_ST if (packetUBXNAVSTATUS->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVSTATUScallback: RAM alloc failed!")); +#endif return (false); } @@ -7798,8 +8196,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVSTATUS() packetUBXNAVSTATUS = new UBX_NAV_STATUS_t; //Allocate RAM for the main struct if (packetUBXNAVSTATUS == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVSTATUS: RAM alloc failed!")); +#endif return (false); } packetUBXNAVSTATUS->automaticFlags.flags.all = 0; @@ -7943,8 +8343,10 @@ bool SFE_UBLOX_GNSS::setAutoDOPcallback(void (*callbackPointer)(UBX_NAV_DOP_data if (packetUBXNAVDOP->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoDOPcallback: RAM alloc failed!")); +#endif return (false); } @@ -7975,8 +8377,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVDOP() packetUBXNAVDOP = new UBX_NAV_DOP_t; //Allocate RAM for the main struct if (packetUBXNAVDOP == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVDOP: RAM alloc failed!")); +#endif return (false); } packetUBXNAVDOP->automaticFlags.flags.all = 0; @@ -8106,8 +8510,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVATTcallback(void (*callbackPointer)(UBX_NAV_ATT_d if (packetUBXNAVATT->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVATTcallback: RAM alloc failed!")); +#endif return (false); } @@ -8138,8 +8544,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVATT() packetUBXNAVATT = new UBX_NAV_ATT_t; //Allocate RAM for the main struct if (packetUBXNAVATT == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVATT: RAM alloc failed!")); +#endif return (false); } packetUBXNAVATT->automaticFlags.flags.all = 0; @@ -8286,8 +8694,10 @@ bool SFE_UBLOX_GNSS::setAutoPVTcallback(void (*callbackPointer)(UBX_NAV_PVT_data if (packetUBXNAVPVT->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoPVTcallback: RAM alloc failed!")); +#endif return (false); } @@ -8319,8 +8729,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVPVT() packetUBXNAVPVT = new UBX_NAV_PVT_t; //Allocate RAM for the main struct if (packetUBXNAVPVT == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVPVT: RAM alloc failed!")); +#endif return (false); } packetUBXNAVPVT->automaticFlags.flags.all = 0; @@ -8445,8 +8857,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVODOcallback(void (*callbackPointer)(UBX_NAV_ODO_d if (packetUBXNAVODO->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVODOcallback: RAM alloc failed!")); +#endif return (false); } @@ -8477,8 +8891,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVODO() packetUBXNAVODO = new UBX_NAV_ODO_t; //Allocate RAM for the main struct if (packetUBXNAVODO == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVODO: RAM alloc failed!")); +#endif return (false); } packetUBXNAVODO->automaticFlags.flags.all = 0; @@ -8601,8 +9017,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVVELECEFcallback(void (*callbackPointer)(UBX_NAV_V if (packetUBXNAVVELECEF->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVVELECEFcallback: RAM alloc failed!")); +#endif return (false); } @@ -8633,8 +9051,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVVELECEF() packetUBXNAVVELECEF = new UBX_NAV_VELECEF_t; //Allocate RAM for the main struct if (packetUBXNAVVELECEF == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVVELECEF: RAM alloc failed!")); +#endif return (false); } packetUBXNAVVELECEF->automaticFlags.flags.all = 0; @@ -8755,8 +9175,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVVELNEDcallback(void (*callbackPointer)(UBX_NAV_VE if (packetUBXNAVVELNED->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVVELNEDcallback: RAM alloc failed!")); +#endif return (false); } @@ -8787,8 +9209,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVVELNED() packetUBXNAVVELNED = new UBX_NAV_VELNED_t; //Allocate RAM for the main struct if (packetUBXNAVVELNED == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVVELNED: RAM alloc failed!")); +#endif return (false); } packetUBXNAVVELNED->automaticFlags.flags.all = 0; @@ -8911,8 +9335,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVHPPOSECEFcallback(void (*callbackPointer)(UBX_NAV if (packetUBXNAVHPPOSECEF->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVHPPOSECEFcallback: RAM alloc failed!")); +#endif return (false); } @@ -8943,8 +9369,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVHPPOSECEF() packetUBXNAVHPPOSECEF = new UBX_NAV_HPPOSECEF_t; //Allocate RAM for the main struct if (packetUBXNAVHPPOSECEF == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVHPPOSECEF: RAM alloc failed!")); +#endif return (false); } packetUBXNAVHPPOSECEF->automaticFlags.flags.all = 0; @@ -9089,8 +9517,10 @@ bool SFE_UBLOX_GNSS::setAutoHPPOSLLHcallback(void (*callbackPointer)(UBX_NAV_HPP if (packetUBXNAVHPPOSLLH->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoHPPOSLLHcallback: RAM alloc failed!")); +#endif return (false); } @@ -9121,8 +9551,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVHPPOSLLH() packetUBXNAVHPPOSLLH = new UBX_NAV_HPPOSLLH_t; //Allocate RAM for the main struct if (packetUBXNAVHPPOSLLH == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVHPPOSLLH: RAM alloc failed!")); +#endif return (false); } packetUBXNAVHPPOSLLH->automaticFlags.flags.all = 0; @@ -9245,8 +9677,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVPVATcallback(void (*callbackPointer)(UBX_NAV_PVAT if (packetUBXNAVPVAT->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVPVATcallback: RAM alloc failed!")); +#endif return (false); } @@ -9278,8 +9712,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVPVAT() packetUBXNAVPVAT = new UBX_NAV_PVAT_t; //Allocate RAM for the main struct if (packetUBXNAVPVAT == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVPVAT: RAM alloc failed!")); +#endif return (false); } packetUBXNAVPVAT->automaticFlags.flags.all = 0; @@ -9404,8 +9840,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVCLOCKcallback(void (*callbackPointer)(UBX_NAV_CLO if (packetUBXNAVCLOCK->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVCLOCKcallback: RAM alloc failed!")); +#endif return (false); } @@ -9436,8 +9874,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVCLOCK() packetUBXNAVCLOCK = new UBX_NAV_CLOCK_t ; //Allocate RAM for the main struct if (packetUBXNAVCLOCK == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVCLOCK: RAM alloc failed!")); +#endif return (false); } packetUBXNAVCLOCK->automaticFlags.flags.all = 0; @@ -9497,8 +9937,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVTIMELS() packetUBXNAVTIMELS = new UBX_NAV_TIMELS_t; //Allocate RAM for the main struct if (packetUBXNAVTIMELS == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVTIMELS: RAM alloc failed!")); +#endif return (false); } packetUBXNAVTIMELS->automaticFlags.flags.all = 0; @@ -9544,8 +9986,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVSVIN() packetUBXNAVSVIN = new UBX_NAV_SVIN_t; //Allocate RAM for the main struct if (packetUBXNAVSVIN == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVSVIN: RAM alloc failed!")); +#endif return (false); } packetUBXNAVSVIN->automaticFlags.flags.all = 0; @@ -9656,8 +10100,10 @@ bool SFE_UBLOX_GNSS::setAutoNAVSATcallback(void (*callbackPointer)(UBX_NAV_SAT_d if (packetUBXNAVSAT->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoNAVSATcallback: RAM alloc failed!")); +#endif return (false); } @@ -9688,8 +10134,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVSAT() packetUBXNAVSAT = new UBX_NAV_SAT_t ; //Allocate RAM for the main struct if (packetUBXNAVSAT == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVSAT: RAM alloc failed!")); +#endif return (false); } packetUBXNAVSAT->automaticFlags.flags.all = 0; @@ -9817,8 +10265,10 @@ bool SFE_UBLOX_GNSS::setAutoRELPOSNEDcallback(void (*callbackPointer)(UBX_NAV_RE if (packetUBXNAVRELPOSNED->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoRELPOSNEDcallback: RAM alloc failed!")); +#endif return (false); } @@ -9849,8 +10299,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVRELPOSNED() packetUBXNAVRELPOSNED = new UBX_NAV_RELPOSNED_t ; //Allocate RAM for the main struct if (packetUBXNAVRELPOSNED == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVRELPOSNED: RAM alloc failed!")); +#endif return (false); } packetUBXNAVRELPOSNED->automaticFlags.flags.all = 0; @@ -9993,8 +10445,10 @@ bool SFE_UBLOX_GNSS::setAutoAOPSTATUScallback(void (*callbackPointer)(UBX_NAV_AO if (packetUBXNAVAOPSTATUS->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoAOPSTATUScallback: RAM alloc failed!")); +#endif return (false); } @@ -10025,8 +10479,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXNAVAOPSTATUS() packetUBXNAVAOPSTATUS = new UBX_NAV_AOPSTATUS_t; //Allocate RAM for the main struct if (packetUBXNAVAOPSTATUS == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXNAVAOPSTATUS: RAM alloc failed!")); +#endif return (false); } packetUBXNAVAOPSTATUS->automaticFlags.flags.all = 0; @@ -10050,6 +10506,78 @@ void SFE_UBLOX_GNSS::logAOPSTATUS(bool enabled) packetUBXNAVAOPSTATUS->automaticFlags.flags.bits.addToFileBuffer = (uint8_t)enabled; } +// ***** RXM PMP automatic support + +// Callback is passed all of the data. Heavy on the stack. May cause problems on some platforms. +bool SFE_UBLOX_GNSS::setAutoRXMPMPcallback(void (*callbackPointer)(UBX_RXM_PMP_data_t)) +{ + if (packetUBXRXMPMP == NULL) initPacketUBXRXMPMP(); //Check that RAM has been allocated for the data + if (packetUBXRXMPMP == NULL) //Only attempt this if RAM allocation was successful + return false; + + if (packetUBXRXMPMP->callbackData == NULL) //Check if RAM has been allocated for the callback copy + { + packetUBXRXMPMP->callbackData = new UBX_RXM_PMP_data_t; //Allocate RAM for the main struct + } + + if (packetUBXRXMPMP->callbackData == NULL) + { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM + if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging + _debugSerial->println(F("setAutoRXMPMPcallback: RAM alloc failed!")); +#endif + return (false); + } + + packetUBXRXMPMP->callbackPointer = callbackPointer; + return (true); +} + +// Callback receives a pointer to the data, instead of _all_ the data. Much kinder on the stack! +bool SFE_UBLOX_GNSS::setAutoRXMPMPcallbackPtr(void (*callbackPointer)(UBX_RXM_PMP_data_t *)) +{ + if (packetUBXRXMPMP == NULL) initPacketUBXRXMPMP(); //Check that RAM has been allocated for the data + if (packetUBXRXMPMP == NULL) //Only attempt this if RAM allocation was successful + return false; + + if (packetUBXRXMPMP->callbackData == NULL) //Check if RAM has been allocated for the callback copy + { + packetUBXRXMPMP->callbackData = new UBX_RXM_PMP_data_t; //Allocate RAM for the main struct + } + + if (packetUBXRXMPMP->callbackData == NULL) + { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM + if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging + _debugSerial->println(F("setAutoRXMPMPcallbackPtr: RAM alloc failed!")); +#endif + return (false); + } + + packetUBXRXMPMP->callbackPointerPtr = callbackPointer; + return (true); +} + +// PRIVATE: Allocate RAM for packetUBXRXMPMP and initialize it +bool SFE_UBLOX_GNSS::initPacketUBXRXMPMP() +{ + packetUBXRXMPMP = new UBX_RXM_PMP_t; //Allocate RAM for the main struct + if (packetUBXRXMPMP == NULL) + { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM + if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging + _debugSerial->println(F("initPacketUBXRXMPMP: RAM alloc failed!")); +#endif + return (false); + } + packetUBXRXMPMP->automaticFlags.flags.all = 0; + packetUBXRXMPMP->callbackPointer = NULL; + packetUBXRXMPMP->callbackPointerPtr = NULL; + packetUBXRXMPMP->callbackData = NULL; + packetUBXRXMPMP->moduleQueried = false; + return (true); +} + // ***** RXM SFRBX automatic support bool SFE_UBLOX_GNSS::getRXMSFRBX(uint16_t maxWait) @@ -10149,8 +10677,10 @@ bool SFE_UBLOX_GNSS::setAutoRXMSFRBXcallback(void (*callbackPointer)(UBX_RXM_SFR if (packetUBXRXMSFRBX->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoRXMSFRBXcallback: RAM alloc failed!")); +#endif return (false); } @@ -10181,8 +10711,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXRXMSFRBX() packetUBXRXMSFRBX = new UBX_RXM_SFRBX_t; //Allocate RAM for the main struct if (packetUBXRXMSFRBX == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXRXMSFRBX: RAM alloc failed!")); +#endif return (false); } packetUBXRXMSFRBX->automaticFlags.flags.all = 0; @@ -10305,8 +10837,10 @@ bool SFE_UBLOX_GNSS::setAutoRXMRAWXcallback(void (*callbackPointer)(UBX_RXM_RAWX if (packetUBXRXMRAWX->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoRXMRAWXcallback: RAM alloc failed!")); +#endif return (false); } @@ -10337,8 +10871,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXRXMRAWX() packetUBXRXMRAWX = new UBX_RXM_RAWX_t; //Allocate RAM for the main struct if (packetUBXRXMRAWX == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXRXMRAWX: RAM alloc failed!")); +#endif return (false); } packetUBXRXMRAWX->automaticFlags.flags.all = 0; @@ -10364,7 +10900,62 @@ void SFE_UBLOX_GNSS::logRXMRAWX(bool enabled) // ***** CFG automatic support -//Get the latest CFG RATE - as used by isConnected +//Get the latest CFG PRT - as used by isConnected +// Here's the dilemma: +// The NEO-D9S doesn't support NAV-RATE so, if we want to include the D9 without creating a special class for it, +// we need to use something else as the 'isConnected' test. The D9 does support CFG-PRT so we'll use that. +// BUT many users could already be using getPortSettings and expecting the settings to be returned in packetCfg. +// So, for isConnected ONLY, we need to enable auto support for CFG-PRT and then disable it afterwards so the settings +// go back to being returned in packetCfg... What a tangled web we weave...! +bool SFE_UBLOX_GNSS::getPortSettingsInternal(uint8_t portID, uint16_t maxWait) +{ + if (packetUBXCFGPRT == NULL) initPacketUBXCFGPRT(); //Check that RAM has been allocated for the data + if (packetUBXCFGPRT == NULL) //Bail if the RAM allocation failed + return (false); + + // The CFG PRT message will never be produced automatically - that would be pointless. + // There is no setAutoCFGPRT function. We always need to poll explicitly. + packetCfg.cls = UBX_CLASS_CFG; + packetCfg.id = UBX_CFG_PRT; + packetCfg.len = 1; + packetCfg.startingSpot = 0; + + payloadCfg[0] = portID; + + //The data is parsed as part of processing the response + sfe_ublox_status_e result = sendCommand(&packetCfg, maxWait); + bool retVal = false; + + if (result == SFE_UBLOX_STATUS_DATA_RECEIVED) + retVal = true; + + if (result == SFE_UBLOX_STATUS_DATA_OVERWRITTEN) + retVal = true; + + //Now disable automatic support for CFG-RATE (see above) + delete packetUBXCFGPRT; + packetUBXCFGPRT = NULL; + + return (retVal); +} + +// PRIVATE: Allocate RAM for packetUBXCFGPRT and initialize it +bool SFE_UBLOX_GNSS::initPacketUBXCFGPRT() +{ + packetUBXCFGPRT = new UBX_CFG_PRT_t; //Allocate RAM for the main struct + if (packetUBXCFGPRT == NULL) + { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM + if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging + _debugSerial->println(F("initPacketUBXCFGPRT: RAM alloc failed!")); +#endif + return (false); + } + packetUBXCFGPRT->dataValid = false; + return (true); +} + +//Get the latest CFG RATE bool SFE_UBLOX_GNSS::getNavigationFrequencyInternal(uint16_t maxWait) { if (packetUBXCFGRATE == NULL) initPacketUBXCFGRATE(); //Check that RAM has been allocated for the data @@ -10396,8 +10987,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXCFGRATE() packetUBXCFGRATE = new UBX_CFG_RATE_t; //Allocate RAM for the main struct if (packetUBXCFGRATE == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXCFGRATE: RAM alloc failed!")); +#endif return (false); } packetUBXCFGRATE->automaticFlags.flags.all = 0; // Redundant @@ -10506,8 +11099,10 @@ bool SFE_UBLOX_GNSS::setAutoTIMTM2callback(void (*callbackPointer)(UBX_TIM_TM2_d if (packetUBXTIMTM2->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoTIMTM2callback: RAM alloc failed!")); +#endif return (false); } @@ -10538,8 +11133,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXTIMTM2() packetUBXTIMTM2 = new UBX_TIM_TM2_t; //Allocate RAM for the main struct if (packetUBXTIMTM2 == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXTIMTM2: RAM alloc failed!")); +#endif return (false); } packetUBXTIMTM2->automaticFlags.flags.all = 0; @@ -10691,8 +11288,10 @@ bool SFE_UBLOX_GNSS::setAutoESFALGcallback(void (*callbackPointer)(UBX_ESF_ALG_d if (packetUBXESFALG->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoESFALGcallback: RAM alloc failed!")); +#endif return (false); } @@ -10723,8 +11322,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXESFALG() packetUBXESFALG = new UBX_ESF_ALG_t; //Allocate RAM for the main struct if (packetUBXESFALG == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXESFALG: RAM alloc failed!")); +#endif return (false); } packetUBXESFALG->automaticFlags.flags.all = 0; @@ -10876,8 +11477,10 @@ bool SFE_UBLOX_GNSS::setAutoESFSTATUScallback(void (*callbackPointer)(UBX_ESF_ST if (packetUBXESFSTATUS->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoESFSTATUScallback: RAM alloc failed!")); +#endif return (false); } @@ -10909,8 +11512,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXESFSTATUS() if (packetUBXESFSTATUS == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXESFSTATUS: RAM alloc failed!")); +#endif return (false); } packetUBXESFSTATUS->automaticFlags.flags.all = 0; @@ -11062,8 +11667,10 @@ bool SFE_UBLOX_GNSS::setAutoESFINScallback(void (*callbackPointer)(UBX_ESF_INS_d if (packetUBXESFINS->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoESFINScallback: RAM alloc failed!")); +#endif return (false); } @@ -11094,8 +11701,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXESFINS() packetUBXESFINS = new UBX_ESF_INS_t; //Allocate RAM for the main struct if (packetUBXESFINS == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXESFINS: RAM alloc failed!")); +#endif return (false); } packetUBXESFINS->automaticFlags.flags.all = 0; @@ -11247,8 +11856,10 @@ bool SFE_UBLOX_GNSS::setAutoESFMEAScallback(void (*callbackPointer)(UBX_ESF_MEAS if (packetUBXESFMEAS->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoESFMEAScallback: RAM alloc failed!")); +#endif return (false); } @@ -11279,8 +11890,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXESFMEAS() packetUBXESFMEAS = new UBX_ESF_MEAS_t; //Allocate RAM for the main struct if (packetUBXESFMEAS == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXESFMEAS: RAM alloc failed!")); +#endif return (false); } packetUBXESFMEAS->automaticFlags.flags.all = 0; @@ -11432,8 +12045,10 @@ bool SFE_UBLOX_GNSS::setAutoESFRAWcallback(void (*callbackPointer)(UBX_ESF_RAW_d if (packetUBXESFRAW->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoESFRAWcallback: RAM alloc failed!")); +#endif return (false); } @@ -11464,8 +12079,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXESFRAW() packetUBXESFRAW = new UBX_ESF_RAW_t; //Allocate RAM for the main struct if (packetUBXESFRAW == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXESFRAW: RAM alloc failed!")); +#endif return (false); } packetUBXESFRAW->automaticFlags.flags.all = 0; @@ -11622,8 +12239,10 @@ bool SFE_UBLOX_GNSS::setAutoHNRATTcallback(void (*callbackPointer)(UBX_HNR_ATT_d if (packetUBXHNRATT->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoHNRAttcallback: RAM alloc failed!")); +#endif return (false); } @@ -11654,8 +12273,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXHNRATT() packetUBXHNRATT = new UBX_HNR_ATT_t; //Allocate RAM for the main struct if (packetUBXHNRATT == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXHNRATT: RAM alloc failed!")); +#endif return (false); } packetUBXHNRATT->automaticFlags.flags.all = 0; @@ -11813,8 +12434,10 @@ bool SFE_UBLOX_GNSS::setAutoHNRINScallback(void (*callbackPointer)(UBX_HNR_INS_d if (packetUBXHNRINS->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoHNRDyncallback: RAM alloc failed!")); +#endif return (false); } @@ -11845,8 +12468,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXHNRINS() packetUBXHNRINS = new UBX_HNR_INS_t; //Allocate RAM for the main struct if (packetUBXHNRINS == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXHNRINS: RAM alloc failed!")); +#endif return (false); } packetUBXHNRINS->automaticFlags.flags.all = 0; @@ -11998,8 +12623,10 @@ bool SFE_UBLOX_GNSS::setAutoHNRPVTcallback(void (*callbackPointer)(UBX_HNR_PVT_d if (packetUBXHNRPVT->callbackData == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setAutoHNRPVTcallback: RAM alloc failed!")); +#endif return (false); } @@ -12030,8 +12657,10 @@ bool SFE_UBLOX_GNSS::initPacketUBXHNRPVT() packetUBXHNRPVT = new UBX_HNR_PVT_t; //Allocate RAM for the main struct if (packetUBXHNRPVT == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initPacketUBXHNRPVT: RAM alloc failed!")); +#endif return (false); } packetUBXHNRPVT->automaticFlags.flags.all = 0; @@ -12170,8 +12799,10 @@ bool SFE_UBLOX_GNSS::setNMEAGPGGAcallback(void (*callbackPointer)(NMEA_GGA_data_ if (storageNMEAGPGGA->callbackCopy == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setNMEAGPGGAcallback: RAM alloc failed!")); +#endif return (false); } @@ -12185,8 +12816,10 @@ bool SFE_UBLOX_GNSS::initStorageNMEAGPGGA() storageNMEAGPGGA = new NMEA_GPGGA_t; //Allocate RAM for the main struct if (storageNMEAGPGGA == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initStorageNMEAGPGGA: RAM alloc failed!")); +#endif return (false); } @@ -12240,8 +12873,10 @@ bool SFE_UBLOX_GNSS::setNMEAGNGGAcallback(void (*callbackPointer)(NMEA_GGA_data_ if (storageNMEAGNGGA->callbackCopy == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("setNMEAGNGGAcallback: RAM alloc failed!")); +#endif return (false); } @@ -12255,8 +12890,10 @@ bool SFE_UBLOX_GNSS::initStorageNMEAGNGGA() storageNMEAGNGGA = new NMEA_GNGGA_t; //Allocate RAM for the main struct if (storageNMEAGNGGA == NULL) { +#ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging _debugSerial->println(F("initStorageNMEAGNGGA: RAM alloc failed!")); +#endif return (false); } @@ -13801,7 +14438,7 @@ float SFE_UBLOX_GNSS::getHNRheading(uint16_t maxWait) // Returned as degrees // From v2.0: These are public. The user can call these to extract data from custom packets //Given a spot in the payload array, extract four bytes and build a long -uint32_t SFE_UBLOX_GNSS::extractLong(ubxPacket *msg, uint8_t spotToStart) +uint32_t SFE_UBLOX_GNSS::extractLong(ubxPacket *msg, uint16_t spotToStart) { uint32_t val = 0; val |= (uint32_t)msg->payload[spotToStart + 0] << 8 * 0; @@ -13812,7 +14449,7 @@ uint32_t SFE_UBLOX_GNSS::extractLong(ubxPacket *msg, uint8_t spotToStart) } //Just so there is no ambiguity about whether a uint32_t will cast to a int32_t correctly... -int32_t SFE_UBLOX_GNSS::extractSignedLong(ubxPacket *msg, uint8_t spotToStart) +int32_t SFE_UBLOX_GNSS::extractSignedLong(ubxPacket *msg, uint16_t spotToStart) { union // Use a union to convert from uint32_t to int32_t { @@ -13825,7 +14462,7 @@ int32_t SFE_UBLOX_GNSS::extractSignedLong(ubxPacket *msg, uint8_t spotToStart) } //Given a spot in the payload array, extract two bytes and build an int -uint16_t SFE_UBLOX_GNSS::extractInt(ubxPacket *msg, uint8_t spotToStart) +uint16_t SFE_UBLOX_GNSS::extractInt(ubxPacket *msg, uint16_t spotToStart) { uint16_t val = 0; val |= (uint16_t)msg->payload[spotToStart + 0] << 8 * 0; @@ -13834,7 +14471,7 @@ uint16_t SFE_UBLOX_GNSS::extractInt(ubxPacket *msg, uint8_t spotToStart) } //Just so there is no ambiguity about whether a uint16_t will cast to a int16_t correctly... -int16_t SFE_UBLOX_GNSS::extractSignedInt(ubxPacket *msg, int8_t spotToStart) +int16_t SFE_UBLOX_GNSS::extractSignedInt(ubxPacket *msg, uint16_t spotToStart) { union // Use a union to convert from uint16_t to int16_t { @@ -13847,13 +14484,13 @@ int16_t SFE_UBLOX_GNSS::extractSignedInt(ubxPacket *msg, int8_t spotToStart) } //Given a spot, extract a byte from the payload -uint8_t SFE_UBLOX_GNSS::extractByte(ubxPacket *msg, uint8_t spotToStart) +uint8_t SFE_UBLOX_GNSS::extractByte(ubxPacket *msg, uint16_t spotToStart) { return (msg->payload[spotToStart]); } //Given a spot, extract a signed 8-bit value from the payload -int8_t SFE_UBLOX_GNSS::extractSignedChar(ubxPacket *msg, uint8_t spotToStart) +int8_t SFE_UBLOX_GNSS::extractSignedChar(ubxPacket *msg, uint16_t spotToStart) { union // Use a union to convert from uint8_t to int8_t { diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.h b/src/SparkFun_u-blox_GNSS_Arduino_Library.h index aa14ee5..6ba5b06 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.h +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.h @@ -375,8 +375,8 @@ const uint8_t UBX_NAV_AOPSTATUS = 0x60; //AssistNow Autonomous status //Class: RXM //The following are used to configure the RXM UBX messages (receiver manager messages). Descriptions from UBX messages overview (ZED_F9P Interface Description Document page 36) const uint8_t UBX_RXM_MEASX = 0x14; //Satellite Measurements for RRLP +const uint8_t UBX_RXM_PMP = 0x72; //PMP raw data (NEO-D9S) (two different versions) (packet size for version 0x01 is variable) const uint8_t UBX_RXM_PMREQ = 0x41; //Requests a Power Management task (two different packet sizes) -const uint8_t UBX_RXM_PMP = 0x72; //PMP raw data (two different versions) (packet size for version 0x01 is variable) const uint8_t UBX_RXM_RAWX = 0x15; //Multi-GNSS Raw Measurement Data const uint8_t UBX_RXM_RLM = 0x59; //Galileo SAR Short-RLM report (two different packet sizes) const uint8_t UBX_RXM_RTCM = 0x32; //RTCM input status @@ -932,6 +932,7 @@ public: bool setAutoNAVPOSECEF(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic POSECEF reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVPOSECEFrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic POSECEF reports bool setAutoNAVPOSECEFcallback(void (*callbackPointer)(UBX_NAV_POSECEF_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic POSECEF reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVPOSECEFcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_POSECEF_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic POSECEF reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVPOSECEF(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and POSECEF is send cyclically already void flushNAVPOSECEF(); //Mark all the data as read/stale void logNAVPOSECEF(bool enabled = true); // Log data to file buffer @@ -941,6 +942,7 @@ public: bool setAutoNAVSTATUS(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic STATUS reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVSTATUSrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic STATUS reports bool setAutoNAVSTATUScallback(void (*callbackPointer)(UBX_NAV_STATUS_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic STATUS reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVSTATUScallbackPtr(void (*callbackPointerPtr)(UBX_NAV_STATUS_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic STATUS reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVSTATUS(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and STATUS is send cyclically already void flushNAVSTATUS(); //Mark all the data as read/stale void logNAVSTATUS(bool enabled = true); // Log data to file buffer @@ -950,6 +952,7 @@ public: bool setAutoDOP(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic DOP reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoDOPrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic DOP reports bool setAutoDOPcallback(void (*callbackPointer)(UBX_NAV_DOP_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic DOP reports at the navigation frequency. Data is accessed from the callback. + bool setAutoDOPcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_DOP_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic DOP reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoDOP(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and DOP is send cyclically already void flushDOP(); //Mark all the DOP data as read/stale void logNAVDOP(bool enabled = true); // Log data to file buffer @@ -960,6 +963,7 @@ public: bool setAutoNAVATT(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic vehicle attitude reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVATTrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic ATT reports bool setAutoNAVATTcallback(void (*callbackPointer)(UBX_NAV_ATT_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic ATT reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVATTcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_ATT_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic ATT reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVATT(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and vehicle attitude is send cyclically already void flushNAVATT(); //Mark all the data as read/stale void logNAVATT(bool enabled = true); // Log data to file buffer @@ -969,6 +973,7 @@ public: bool setAutoPVT(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic PVT reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoPVTrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic PVT reports bool setAutoPVTcallback(void (*callbackPointer)(UBX_NAV_PVT_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic PVT reports at the navigation frequency. Data is accessed from the callback. + bool setAutoPVTcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_PVT_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic PVT reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoPVT(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and PVT is send cyclically already void flushPVT(); //Mark all the PVT data as read/stale void logNAVPVT(bool enabled = true); // Log data to file buffer @@ -978,6 +983,7 @@ public: bool setAutoNAVODO(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic ODO reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVODOrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic ODO reports bool setAutoNAVODOcallback(void (*callbackPointer)(UBX_NAV_ODO_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic ODO reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVODOcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_ODO_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic ODO reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVODO(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and ODO is send cyclically already void flushNAVODO(); //Mark all the data as read/stale void logNAVODO(bool enabled = true); // Log data to file buffer @@ -987,6 +993,7 @@ public: bool setAutoNAVVELECEF(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic VELECEF reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVVELECEFrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic VELECEF reports bool setAutoNAVVELECEFcallback(void (*callbackPointer)(UBX_NAV_VELECEF_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic VELECEF reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVVELECEFcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_VELECEF_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic VELECEF reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVVELECEF(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and VELECEF is send cyclically already void flushNAVVELECEF(); //Mark all the data as read/stale void logNAVVELECEF(bool enabled = true); // Log data to file buffer @@ -996,6 +1003,7 @@ public: bool setAutoNAVVELNED(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic VELNED reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVVELNEDrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic VELNED reports bool setAutoNAVVELNEDcallback(void (*callbackPointer)(UBX_NAV_VELNED_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic VELNED reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVVELNEDcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_VELNED_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic VELNED reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVVELNED(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and VELNED is send cyclically already void flushNAVVELNED(); //Mark all the data as read/stale void logNAVVELNED(bool enabled = true); // Log data to file buffer @@ -1005,6 +1013,7 @@ public: bool setAutoNAVHPPOSECEF(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic HPPOSECEF reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVHPPOSECEFrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic HPPOSECEF reports bool setAutoNAVHPPOSECEFcallback(void (*callbackPointer)(UBX_NAV_HPPOSECEF_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic HPPOSECEF reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVHPPOSECEFcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_HPPOSECEF_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic HPPOSECEF reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVHPPOSECEF(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and HPPOSECEF is send cyclically already void flushNAVHPPOSECEF(); //Mark all the data as read/stale void logNAVHPPOSECEF(bool enabled = true); // Log data to file buffer @@ -1014,6 +1023,7 @@ public: bool setAutoHPPOSLLH(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic HPPOSLLH reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoHPPOSLLHrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic HPPOSLLH reports bool setAutoHPPOSLLHcallback(void (*callbackPointer)(UBX_NAV_HPPOSLLH_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic HPPOSLLH reports at the navigation frequency. Data is accessed from the callback. + bool setAutoHPPOSLLHcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_HPPOSLLH_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic HPPOSLLH reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoHPPOSLLH(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and HPPOSLLH is send cyclically already void flushHPPOSLLH(); //Mark all the HPPPOSLLH data as read/stale. This is handy to get data alignment after CRC failure void logNAVHPPOSLLH(bool enabled = true); // Log data to file buffer @@ -1023,6 +1033,7 @@ public: bool setAutoNAVPVAT(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic PVAT reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVPVATrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic PVAT reports bool setAutoNAVPVATcallback(void (*callbackPointer)(UBX_NAV_PVAT_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic PVAT reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVPVATcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_PVAT_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic PVAT reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVPVAT(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and PVAT is send cyclically already void flushNAVPVAT(); //Mark all the PVAT data as read/stale void logNAVPVAT(bool enabled = true); // Log data to file buffer @@ -1032,6 +1043,7 @@ public: bool setAutoNAVCLOCK(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic clock reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVCLOCKrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic CLOCK reports bool setAutoNAVCLOCKcallback(void (*callbackPointer)(UBX_NAV_CLOCK_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic CLOCK reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVCLOCKcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_CLOCK_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic CLOCK reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVCLOCK(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and clock is send cyclically already void flushNAVCLOCK(); //Mark all the data as read/stale void logNAVCLOCK(bool enabled = true); // Log data to file buffer @@ -1047,6 +1059,7 @@ public: bool setAutoNAVSAT(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic NAVSAT reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoNAVSATrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic NAVSAT reports bool setAutoNAVSATcallback(void (*callbackPointer)(UBX_NAV_SAT_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic NAVSAT reports at the navigation frequency. Data is accessed from the callback. + bool setAutoNAVSATcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_SAT_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic NAVSAT reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoNAVSAT(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and NAVSAT is send cyclically already void flushNAVSAT(); //Mark all the NAVSAT data as read/stale void logNAVSAT(bool enabled = true); // Log data to file buffer @@ -1056,6 +1069,7 @@ public: bool setAutoRELPOSNED(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic RELPOSNED, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoRELPOSNEDrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic RELPOSNEDreports bool setAutoRELPOSNEDcallback(void (*callbackPointer)(UBX_NAV_RELPOSNED_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic RELPOSNED reports at the navigation frequency. Data is accessed from the callback. + bool setAutoRELPOSNEDcallbackPtr(void (*callbackPointerPtr)(UBX_NAV_RELPOSNED_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic RELPOSNED reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoRELPOSNED(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and RELPOSNED is send cyclically already void flushNAVRELPOSNED(); //Mark all the data as read/stale void logNAVRELPOSNED(bool enabled = true); // Log data to file buffer @@ -1065,6 +1079,7 @@ public: bool setAutoAOPSTATUS(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic AOPSTATUS reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoAOPSTATUSrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic AOPSTATUS reports bool setAutoAOPSTATUScallback(void (*callbackPointer)(UBX_NAV_AOPSTATUS_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic AOPSTATUS reports at the navigation frequency. Data is accessed from the callback. + bool setAutoAOPSTATUScallbackPtr(void (*callbackPointerPtr)(UBX_NAV_AOPSTATUS_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic AOPSTATUS reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoAOPSTATUS(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and AOPSTATUS is send cyclically already void flushAOPSTATUS(); //Mark all the AOPSTATUS data as read/stale void logAOPSTATUS(bool enabled = true); // Log data to file buffer @@ -1075,14 +1090,15 @@ public: // Note: on the NEO-D9S, the UBX-RXM-PMP messages are enabled by default on all ports. // You can disable them by calling (e.g.) setVal8(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_I2C, 0) // The NEO-D9S does not support UBX-CFG-MSG - bool setAutoRXMPMPcallback(void (*callbackPointer)(UBX_RXM_PMP_data_t), uint16_t maxWait = defaultMaxWait); // Callback is passed all of the data. Heavy on the stack. May cause problems on some platforms. - bool setAutoRXMPMPcallbackPtr(void (*callbackPointerPtr)(UBX_RXM_PMP_data_t *), uint16_t maxWait = defaultMaxWait); // Callback receives a pointer to the data, instead of _all_ the data. Much kinder on the stack! + bool setAutoRXMPMPcallback(void (*callbackPointer)(UBX_RXM_PMP_data_t)); // Callback is passed all of the data. Heavy on the stack. May cause problems on some platforms. + bool setAutoRXMPMPcallbackPtr(void (*callbackPointerPtr)(UBX_RXM_PMP_data_t *)); // Callback receives a pointer to the data, instead of _all_ the data. Much kinder on the stack! bool getRXMSFRBX(uint16_t maxWait = defaultMaxWait); // RXM SFRBX bool setAutoRXMSFRBX(bool enabled, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic RXM SFRBX reports at the navigation frequency bool setAutoRXMSFRBX(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic RXM SFRBX reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoRXMSFRBXrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic SFRBX reports bool setAutoRXMSFRBXcallback(void (*callbackPointer)(UBX_RXM_SFRBX_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic SFRBX reports at the navigation frequency. Data is accessed from the callback. + bool setAutoRXMSFRBXcallbackPtr(void (*callbackPointerPtr)(UBX_RXM_SFRBX_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic SFRBX reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoRXMSFRBX(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and RXM SFRBX is send cyclically already void flushRXMSFRBX(); //Mark all the data as read/stale void logRXMSFRBX(bool enabled = true); // Log data to file buffer @@ -1092,13 +1108,15 @@ public: bool setAutoRXMRAWX(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic RXM RAWX reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoRXMRAWXrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic RAWX reports bool setAutoRXMRAWXcallback(void (*callbackPointer)(UBX_RXM_RAWX_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic RAWX reports at the navigation frequency. Data is accessed from the callback. + bool setAutoRXMRAWXcallbackPtr(void (*callbackPointerPtr)(UBX_RXM_RAWX_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic RAWX reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoRXMRAWX(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and RXM RAWX is send cyclically already void flushRXMRAWX(); //Mark all the data as read/stale void logRXMRAWX(bool enabled = true); // Log data to file buffer // Configuration (CFG) - // Add "auto" support for CFG RATE - because we use it for isConnected (to stop it being mugged by other messages) + // Add "auto" support for CFG PRT - because we use it for isConnected (to stop it being mugged by other messages) + bool getPortSettingsInternal(uint8_t portID, uint16_t maxWait = defaultMaxWait); //Read the port configuration for a given port using UBX-CFG-PRT bool getNavigationFrequencyInternal(uint16_t maxWait = defaultMaxWait); //Get the number of nav solutions sent per second currently being output by module // Timing messages (TIM) @@ -1108,6 +1126,7 @@ public: bool setAutoTIMTM2(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic TIM TM2 reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoTIMTM2rate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic TIM TM2 reports bool setAutoTIMTM2callback(void (*callbackPointer)(UBX_TIM_TM2_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic TM2 reports at the navigation frequency. Data is accessed from the callback. + bool setAutoTIMTM2callbackPtr(void (*callbackPointerPtr)(UBX_TIM_TM2_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic TM2 reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoTIMTM2(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and TIM TM2 is send cyclically already void flushTIMTM2(); //Mark all the data as read/stale void logTIMTM2(bool enabled = true); // Log data to file buffer @@ -1120,6 +1139,7 @@ public: bool setAutoESFALG(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic ESF ALG reports, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoESFALGrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic ALG reports bool setAutoESFALGcallback(void (*callbackPointer)(UBX_ESF_ALG_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic ALG reports at the navigation frequency. Data is accessed from the callback. + bool setAutoESFALGcallbackPtr(void (*callbackPointerPtr)(UBX_ESF_ALG_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic ALG reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoESFALG(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and ESF ALG is send cyclically already void flushESFALG(); //Mark all the data as read/stale void logESFALG(bool enabled = true); // Log data to file buffer @@ -1130,6 +1150,7 @@ public: bool setAutoESFSTATUS(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic ESF STATUS reports, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoESFSTATUSrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic STATUS reports bool setAutoESFSTATUScallback(void (*callbackPointer)(UBX_ESF_STATUS_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic STATUS reports at the navigation frequency. Data is accessed from the callback. + bool setAutoESFSTATUScallbackPtr(void (*callbackPointerPtr)(UBX_ESF_STATUS_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic STATUS reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoESFSTATUS(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and ESF STATUS is send cyclically already void flushESFSTATUS(); //Mark all the data as read/stale void logESFSTATUS(bool enabled = true); // Log data to file buffer @@ -1140,6 +1161,7 @@ public: bool setAutoESFINS(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic ESF INS reports, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoESFINSrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic INS reports bool setAutoESFINScallback(void (*callbackPointer)(UBX_ESF_INS_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic INS reports at the navigation frequency. Data is accessed from the callback. + bool setAutoESFINScallbackPtr(void (*callbackPointerPtr)(UBX_ESF_INS_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic INS reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoESFINS(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and ESF INS is send cyclically already void flushESFINS(); //Mark all the data as read/stale void logESFINS(bool enabled = true); // Log data to file buffer @@ -1150,6 +1172,7 @@ public: bool setAutoESFMEAS(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic ESF MEAS reports, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoESFMEASrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic MEAS reports bool setAutoESFMEAScallback(void (*callbackPointer)(UBX_ESF_MEAS_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic MEAS reports at the navigation frequency. Data is accessed from the callback. + bool setAutoESFMEAScallbackPtr(void (*callbackPointerPtr)(UBX_ESF_MEAS_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic MEAS reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoESFMEAS(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and ESF MEAS is send cyclically already void flushESFMEAS(); //Mark all the data as read/stale void logESFMEAS(bool enabled = true); // Log data to file buffer @@ -1160,6 +1183,7 @@ public: bool setAutoESFRAW(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic ESF RAW reports, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoESFRAWrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic RAW reports bool setAutoESFRAWcallback(void (*callbackPointer)(UBX_ESF_RAW_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic RAW reports at the navigation frequency. Data is accessed from the callback. + bool setAutoESFRAWcallbackPtr(void (*callbackPointerPtr)(UBX_ESF_RAW_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic RAW reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoESFRAW(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and ESF RAW is send cyclically already void flushESFRAW(); //Mark all the data as read/stale void logESFRAW(bool enabled = true); // Log data to file buffer @@ -1172,6 +1196,7 @@ public: bool setAutoHNRATT(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic HNR Attitude reports at the HNR rate, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoHNRATTrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic ATT reports bool setAutoHNRATTcallback(void (*callbackPointer)(UBX_HNR_ATT_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic ATT reports at the navigation frequency. Data is accessed from the callback. + bool setAutoHNRATTcallbackPtr(void (*callbackPointerPtr)(UBX_HNR_ATT_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic ATT reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoHNRATT(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and HNR Attitude is send cyclically already void flushHNRATT(); //Mark all the data as read/stale void logHNRATT(bool enabled = true); // Log data to file buffer @@ -1182,6 +1207,7 @@ public: bool setAutoHNRINS(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic HNR dynamics reports at the HNR rate, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoHNRINSrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic INS reports bool setAutoHNRINScallback(void (*callbackPointer)(UBX_HNR_INS_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic INS reports at the navigation frequency. Data is accessed from the callback. + bool setAutoHNRINScallbackPtr(void (*callbackPointerPtr)(UBX_HNR_INS_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic INS reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoHNRINS(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and HNR dynamics is send cyclically already void flushHNRINS(); //Mark all the data as read/stale void logHNRINS(bool enabled = true); // Log data to file buffer @@ -1191,6 +1217,7 @@ public: bool setAutoHNRPVT(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic HNR PVT reports at the HNR rate, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update bool setAutoHNRPVTrate(uint8_t rate, bool implicitUpdate = true, uint16_t maxWait = defaultMaxWait); //Set the rate for automatic PVT reports bool setAutoHNRPVTcallback(void (*callbackPointer)(UBX_HNR_PVT_data_t), uint16_t maxWait = defaultMaxWait); //Enable automatic PVT reports at the navigation frequency. Data is accessed from the callback. + bool setAutoHNRPVTcallbackPtr(void (*callbackPointerPtr)(UBX_HNR_PVT_data_t *), uint16_t maxWait = defaultMaxWait); //Enable automatic PVT reports at the navigation frequency. Data is accessed from the callback. bool assumeAutoHNRPVT(bool enabled, bool implicitUpdate = true); //In case no config access to the GPS is possible and HNR PVT is send cyclically already void flushHNRPVT(); //Mark all the data as read/stale void logHNRPVT(bool enabled = true); // Log data to file buffer @@ -1365,12 +1392,12 @@ public: // Functions to extract signed and unsigned 8/16/32-bit data from a ubxPacket // From v2.0: These are public. The user can call these to extract data from custom packets - uint32_t extractLong(ubxPacket *msg, uint8_t spotToStart); //Combine four bytes from payload into long - int32_t extractSignedLong(ubxPacket *msg, uint8_t spotToStart); //Combine four bytes from payload into signed long (avoiding any ambiguity caused by casting) - uint16_t extractInt(ubxPacket *msg, uint8_t spotToStart); //Combine two bytes from payload into int - int16_t extractSignedInt(ubxPacket *msg, int8_t spotToStart); - uint8_t extractByte(ubxPacket *msg, uint8_t spotToStart); //Get byte from payload - int8_t extractSignedChar(ubxPacket *msg, uint8_t spotToStart); //Get signed 8-bit value from payload + uint32_t extractLong(ubxPacket *msg, uint16_t spotToStart); //Combine four bytes from payload into long + int32_t extractSignedLong(ubxPacket *msg, uint16_t spotToStart); //Combine four bytes from payload into signed long (avoiding any ambiguity caused by casting) + uint16_t extractInt(ubxPacket *msg, uint16_t spotToStart); //Combine two bytes from payload into int + int16_t extractSignedInt(ubxPacket *msg, uint16_t spotToStart); + uint8_t extractByte(ubxPacket *msg, uint16_t spotToStart); //Get byte from payload + int8_t extractSignedChar(ubxPacket *msg, uint16_t spotToStart); //Get signed 8-bit value from payload // Pointers to storage for the "automatic" messages // RAM is allocated for these if/when required. @@ -1397,6 +1424,7 @@ public: 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_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_TIM_TM2_t *packetUBXTIMTM2 = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary @@ -1481,9 +1509,10 @@ private: bool initPacketUBXNAVSAT(); // Allocate RAM for packetUBXNAVSAT and initialize it bool initPacketUBXNAVRELPOSNED(); // Allocate RAM for packetUBXNAVRELPOSNED and initialize it bool initPacketUBXNAVAOPSTATUS(); // Allocate RAM for packetUBXNAVAOPSTATUS and initialize it - bool initPacketUBXRXMPMP(bool usePtr = false); // Allocate RAM for packetUBXRXMPMP and initialize it + bool initPacketUBXRXMPMP(); // Allocate RAM for packetUBXRXMPMP and initialize it bool initPacketUBXRXMSFRBX(); // Allocate RAM for packetUBXRXMSFRBX and initialize it bool initPacketUBXRXMRAWX(); // Allocate RAM for packetUBXRXMRAWX and initialize it + bool initPacketUBXCFGPRT(); // Allocate RAM for packetUBXCFGPRT and initialize it bool initPacketUBXCFGRATE(); // Allocate RAM for packetUBXCFGRATE and initialize it bool initPacketUBXTIMTM2(); // Allocate RAM for packetUBXTIMTM2 and initialize it bool initPacketUBXESFALG(); // Allocate RAM for packetUBXESFALG and initialize it diff --git a/src/u-blox_structs.h b/src/u-blox_structs.h index 20e15a6..d5a7b10 100644 --- a/src/u-blox_structs.h +++ b/src/u-blox_structs.h @@ -103,6 +103,7 @@ typedef struct UBX_NAV_POSECEF_data_t data; UBX_NAV_POSECEF_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_POSECEF_data_t); + void (*callbackPointerPtr)(UBX_NAV_POSECEF_data_t *); UBX_NAV_POSECEF_data_t *callbackData; } UBX_NAV_POSECEF_t; @@ -146,6 +147,7 @@ typedef struct UBX_NAV_POSLLH_data_t data; UBX_NAV_POSLLH_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_POSLLH_data_t); + void (*callbackPointerPtr)(UBX_NAV_POSLLH_data_t *); UBX_NAV_POSLLH_data_t *callbackData; } UBX_NAV_POSLLH_t; @@ -246,6 +248,7 @@ typedef struct UBX_NAV_STATUS_data_t data; UBX_NAV_STATUS_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_STATUS_data_t); + void (*callbackPointerPtr)(UBX_NAV_STATUS_data_t *); UBX_NAV_STATUS_data_t *callbackData; } UBX_NAV_STATUS_t; @@ -291,6 +294,7 @@ typedef struct UBX_NAV_DOP_data_t data; UBX_NAV_DOP_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_DOP_data_t); + void (*callbackPointerPtr)(UBX_NAV_DOP_data_t *); UBX_NAV_DOP_data_t *callbackData; } UBX_NAV_DOP_t; @@ -337,6 +341,7 @@ typedef struct UBX_NAV_ATT_data_t data; UBX_NAV_ATT_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_ATT_data_t); + void (*callbackPointerPtr)(UBX_NAV_ATT_data_t *); UBX_NAV_ATT_data_t *callbackData; } UBX_NAV_ATT_t; @@ -500,6 +505,7 @@ typedef struct UBX_NAV_PVT_data_t data; UBX_NAV_PVT_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_PVT_data_t); + void (*callbackPointerPtr)(UBX_NAV_PVT_data_t *); UBX_NAV_PVT_data_t *callbackData; } UBX_NAV_PVT_t; @@ -540,6 +546,7 @@ typedef struct UBX_NAV_ODO_data_t data; UBX_NAV_ODO_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_ODO_data_t); + void (*callbackPointerPtr)(UBX_NAV_ODO_data_t *); UBX_NAV_ODO_data_t *callbackData; } UBX_NAV_ODO_t; @@ -579,6 +586,7 @@ typedef struct UBX_NAV_VELECEF_data_t data; UBX_NAV_VELECEF_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_VELECEF_data_t); + void (*callbackPointerPtr)(UBX_NAV_VELECEF_data_t *); UBX_NAV_VELECEF_data_t *callbackData; } UBX_NAV_VELECEF_t; @@ -626,6 +634,7 @@ typedef struct UBX_NAV_VELNED_data_t data; UBX_NAV_VELNED_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_VELNED_data_t); + void (*callbackPointerPtr)(UBX_NAV_VELNED_data_t *); UBX_NAV_VELNED_data_t *callbackData; } UBX_NAV_VELNED_t; @@ -685,6 +694,7 @@ typedef struct UBX_NAV_HPPOSECEF_data_t data; UBX_NAV_HPPOSECEF_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_HPPOSECEF_data_t); + void (*callbackPointerPtr)(UBX_NAV_HPPOSECEF_data_t *); UBX_NAV_HPPOSECEF_data_t *callbackData; } UBX_NAV_HPPOSECEF_t; @@ -750,6 +760,7 @@ typedef struct UBX_NAV_HPPOSLLH_data_t data; UBX_NAV_HPPOSLLH_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_HPPOSLLH_data_t); + void (*callbackPointerPtr)(UBX_NAV_HPPOSLLH_data_t *); UBX_NAV_HPPOSLLH_data_t *callbackData; } UBX_NAV_HPPOSLLH_t; @@ -924,6 +935,7 @@ typedef struct UBX_NAV_PVAT_data_t data; UBX_NAV_PVAT_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_PVAT_data_t); + void (*callbackPointerPtr)(UBX_NAV_PVAT_data_t *); UBX_NAV_PVAT_data_t *callbackData; } UBX_NAV_PVAT_t; @@ -988,6 +1000,7 @@ typedef struct UBX_NAV_TIMEUTC_data_t data; UBX_NAV_TIMEUTC_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_TIMEUTC_data_t); + void (*callbackPointerPtr)(UBX_NAV_TIMEUTC_data_t *); UBX_NAV_TIMEUTC_data_t *callbackData; } UBX_NAV_TIMEUTC_t; @@ -1027,6 +1040,7 @@ typedef struct UBX_NAV_CLOCK_data_t data; UBX_NAV_CLOCK_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_CLOCK_data_t); + void (*callbackPointerPtr)(UBX_NAV_CLOCK_data_t *); UBX_NAV_CLOCK_data_t *callbackData; } UBX_NAV_CLOCK_t; @@ -1087,6 +1101,7 @@ typedef struct UBX_NAV_TIMELS_data_t data; UBX_NAV_TIMELS_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_TIMELS_data_t); + void (*callbackPointerPtr)(UBX_NAV_TIMELS_data_t *); UBX_NAV_TIMELS_data_t *callbackData; } UBX_NAV_TIMELS_t; @@ -1160,6 +1175,7 @@ typedef struct UBX_NAV_SAT_data_t data; bool moduleQueried; void (*callbackPointer)(UBX_NAV_SAT_data_t); + void (*callbackPointerPtr)(UBX_NAV_SAT_data_t *); UBX_NAV_SAT_data_t *callbackData; } UBX_NAV_SAT_t; @@ -1218,6 +1234,7 @@ typedef struct UBX_NAV_SVIN_data_t data; UBX_NAV_SVIN_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_SVIN_data_t); + void (*callbackPointerPtr)(UBX_NAV_SVIN_data_t *); UBX_NAV_SVIN_data_t *callbackData; } UBX_NAV_SVIN_t; @@ -1317,6 +1334,7 @@ typedef struct UBX_NAV_RELPOSNED_data_t data; UBX_NAV_RELPOSNED_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_RELPOSNED_data_t); + void (*callbackPointerPtr)(UBX_NAV_RELPOSNED_data_t *); UBX_NAV_RELPOSNED_data_t *callbackData; } UBX_NAV_RELPOSNED_t; @@ -1362,6 +1380,7 @@ typedef struct UBX_NAV_AOPSTATUS_data_t data; UBX_NAV_AOPSTATUS_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_NAV_AOPSTATUS_data_t); + void (*callbackPointerPtr)(UBX_NAV_AOPSTATUS_data_t *); UBX_NAV_AOPSTATUS_data_t *callbackData; } UBX_NAV_AOPSTATUS_t; @@ -1393,6 +1412,7 @@ typedef struct UBX_RXM_SFRBX_data_t data; bool moduleQueried; void (*callbackPointer)(UBX_RXM_SFRBX_data_t); + void (*callbackPointerPtr)(UBX_RXM_SFRBX_data_t *); UBX_RXM_SFRBX_data_t *callbackData; } UBX_RXM_SFRBX_t; @@ -1460,6 +1480,7 @@ typedef struct UBX_RXM_RAWX_data_t data; bool moduleQueried; void (*callbackPointer)(UBX_RXM_RAWX_data_t); + void (*callbackPointerPtr)(UBX_RXM_RAWX_data_t *); UBX_RXM_RAWX_data_t *callbackData; } UBX_RXM_RAWX_t; @@ -1499,6 +1520,63 @@ typedef struct // CFG-specific structs +// UBX-CFG-PRT (0x06 0x00): Port configuration +// The content changes depending on which port type is being configured +// This struct defines the common structure +const uint16_t UBX_CFG_PRT_LEN = 20; + +typedef struct +{ + uint8_t portID; // Port identifier number + uint8_t reserved0; // Reserved + union + { + uint16_t all; + struct + { + uint16_t en : 1; // Enable TX ready feature for this port + uint16_t pol : 1; // Polarity: 0 High-active; 1 Low-active + uint16_t pin : 5; // PIO to be used (must not be in use by another function) + uint16_t thres : 9; // Threshold + } bits; + } txReady; + uint32_t mode; // Content changes depending on the port type + uint32_t baudRate ; // Content changes depending on the port type + union + { + uint16_t all; + struct + { + uint16_t inUbx : 1; // UBX protocol + uint16_t inNmea : 1; // NMEA protocol + uint16_t inRtcm : 1; // RTCM2 protocol + uint16_t reserved : 2; + uint16_t inRtcm3 : 1; // RTCM3 protocol (not supported for protocol versions less than 20.00) + uint16_t inSPARTN : 1; + } bits; + } inProtoMask; + union + { + uint16_t all; + struct + { + uint16_t outUbx : 1; // UBX protocol + uint16_t outNmea : 1; // NMEA protocol + uint16_t reserved : 3; + uint16_t outRtcm3 : 1; // RTCM3 protocol (not supported for protocol versions less than 20.00) + uint16_t outSPARTN : 1; + } bits; + } outProtoMask; + uint16_t flags; // Content changes depending on the port type + uint16_t reserved1; +} UBX_CFG_PRT_data_t; + +typedef struct +{ + UBX_CFG_PRT_data_t data; + bool dataValid; +} UBX_CFG_PRT_t; + // UBX-CFG-RATE (0x06 0x08): Navigation/measurement rate settings const uint16_t UBX_CFG_RATE_LEN = 6; @@ -1531,6 +1609,7 @@ typedef struct UBX_CFG_RATE_data_t data; UBX_CFG_RATE_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_CFG_RATE_data_t); + void (*callbackPointerPtr)(UBX_CFG_RATE_data_t *); UBX_CFG_RATE_data_t *callbackData; } UBX_CFG_RATE_t; @@ -1637,6 +1716,7 @@ typedef struct UBX_TIM_TM2_data_t data; UBX_TIM_TM2_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_TIM_TM2_data_t); + void (*callbackPointerPtr)(UBX_TIM_TM2_data_t *); UBX_TIM_TM2_data_t *callbackData; } UBX_TIM_TM2_t; @@ -1711,6 +1791,7 @@ typedef struct UBX_ESF_ALG_data_t data; UBX_ESF_ALG_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_ESF_ALG_data_t); + void (*callbackPointerPtr)(UBX_ESF_ALG_data_t *); UBX_ESF_ALG_data_t *callbackData; } UBX_ESF_ALG_t; @@ -1777,6 +1858,7 @@ typedef struct UBX_ESF_INS_data_t data; UBX_ESF_INS_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_ESF_INS_data_t); + void (*callbackPointerPtr)(UBX_ESF_INS_data_t *); UBX_ESF_INS_data_t *callbackData; } UBX_ESF_INS_t; @@ -1847,6 +1929,7 @@ typedef struct UBX_ESF_MEAS_data_t data; UBX_ESF_MEAS_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_ESF_MEAS_data_t); + void (*callbackPointerPtr)(UBX_ESF_MEAS_data_t *); UBX_ESF_MEAS_data_t *callbackData; } UBX_ESF_MEAS_t; @@ -1894,6 +1977,7 @@ typedef struct UBX_ESF_RAW_data_t data; UBX_ESF_RAW_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_ESF_RAW_data_t); + void (*callbackPointerPtr)(UBX_ESF_RAW_data_t *); UBX_ESF_RAW_data_t *callbackData; } UBX_ESF_RAW_t; @@ -1981,6 +2065,7 @@ typedef struct UBX_ESF_STATUS_data_t data; UBX_ESF_STATUS_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_ESF_STATUS_data_t); + void (*callbackPointerPtr)(UBX_ESF_STATUS_data_t *); UBX_ESF_STATUS_data_t *callbackData; } UBX_ESF_STATUS_t; @@ -2151,6 +2236,7 @@ typedef struct UBX_HNR_PVT_data_t data; UBX_HNR_PVT_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_HNR_PVT_data_t); + void (*callbackPointerPtr)(UBX_HNR_PVT_data_t *); UBX_HNR_PVT_data_t *callbackData; } UBX_HNR_PVT_t; @@ -2197,6 +2283,7 @@ typedef struct UBX_HNR_ATT_data_t data; UBX_HNR_ATT_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_HNR_ATT_data_t); + void (*callbackPointerPtr)(UBX_HNR_ATT_data_t *); UBX_HNR_ATT_data_t *callbackData; } UBX_HNR_ATT_t; @@ -2263,6 +2350,7 @@ typedef struct UBX_HNR_INS_data_t data; UBX_HNR_INS_moduleQueried_t moduleQueried; void (*callbackPointer)(UBX_HNR_INS_data_t); + void (*callbackPointerPtr)(UBX_HNR_INS_data_t *); UBX_HNR_INS_data_t *callbackData; } UBX_HNR_INS_t; @@ -2302,6 +2390,7 @@ typedef struct NMEA_GGA_data_t workingCopy; // Incoming data is added to the working copy NMEA_GGA_data_t completeCopy; // The working copy is copied into the complete copy when all data has been received and the checksum is valid void (*callbackPointer)(NMEA_GGA_data_t); + void (*callbackPointerPtr)(NMEA_GGA_data_t *); NMEA_GGA_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy } NMEA_GPGGA_t; @@ -2311,6 +2400,7 @@ typedef struct NMEA_GGA_data_t workingCopy; // Incoming data is added to the working copy NMEA_GGA_data_t completeCopy; // The working copy is copied into the complete copy when all data has been received and the checksum is valid void (*callbackPointer)(NMEA_GGA_data_t); + void (*callbackPointerPtr)(NMEA_GGA_data_t *); NMEA_GGA_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy } NMEA_GNGGA_t;