@@ -4246,15 +4246,13 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
42464246 // Parse various byte fields into storage - but only if we have memory allocated for it
42474247 if (packetUBXESFRAW != NULL)
42484248 {
4249- for (uint16_t i = 0; (i < DEF_NUM_SENS) && ((i * 8) < (msg->len - 4)); i++)
4249+ packetUBXESFRAW->data.numEsfRawBlocks = (msg->len - 4) / 8; // Record how many blocks were received. Could be 7 or 70 (ZED-F9R vs. NEO-M8U)
4250+ for (uint16_t i = 0; (i < (DEF_NUM_SENS * DEF_MAX_NUM_ESF_RAW_REPEATS)) && ((i * 8) < (msg->len - 4)); i++)
42504251 {
42514252 packetUBXESFRAW->data.data[i].data.all = extractLong(msg, 4 + (i * 8));
42524253 packetUBXESFRAW->data.data[i].sTag = extractLong(msg, 8 + (i * 8));
42534254 }
42544255
4255- // Mark all datums as fresh (not read before)
4256- packetUBXESFRAW->moduleQueried.moduleQueried.all = 0xFFFFFFFF;
4257-
42584256 // Check if we need to copy the data for the callback
42594257 if ((packetUBXESFRAW->callbackData != NULL) // If RAM has been allocated for the copy of the data
42604258 && (packetUBXESFRAW->automaticFlags.flags.bits.callbackCopyValid == false)) // AND the data is stale
@@ -10233,7 +10231,7 @@ bool SFE_UBLOX_GNSS::getVehAtt(uint16_t maxWait)
1023310231bool SFE_UBLOX_GNSS::getNAVATT(uint16_t maxWait)
1023410232{
1023510233 if (packetUBXNAVATT == NULL)
10236- initPacketUBXNAVATT(); // Check that RAM has been allocated for the ESF RAW data
10234+ initPacketUBXNAVATT(); // Check that RAM has been allocated for the NAV ATT data
1023710235 if (packetUBXNAVATT == NULL) // Only attempt this if RAM allocation was successful
1023810236 return false;
1023910237
@@ -10373,7 +10371,7 @@ bool SFE_UBLOX_GNSS::setAutoNAVATTcallbackPtr(void (*callbackPointerPtr)(UBX_NAV
1037310371bool SFE_UBLOX_GNSS::assumeAutoNAVATT(bool enabled, bool implicitUpdate)
1037410372{
1037510373 if (packetUBXNAVATT == NULL)
10376- initPacketUBXNAVATT(); // Check that RAM has been allocated for the ESF RAW data
10374+ initPacketUBXNAVATT(); // Check that RAM has been allocated for the NAV ATT data
1037710375 if (packetUBXNAVATT == NULL) // Only attempt this if RAM allocation was successful
1037810376 return false;
1037910377
@@ -14738,92 +14736,23 @@ void SFE_UBLOX_GNSS::logESFMEAS(bool enabled)
1473814736
1473914737// ***** ESF RAW automatic support
1474014738
14741- bool SFE_UBLOX_GNSS::getEsfRawDataInfo(uint16_t maxWait)
14742- {
14743- return (getESFRAW(maxWait));
14744- }
14745-
14746- bool SFE_UBLOX_GNSS::getESFRAW(uint16_t maxWait)
14747- {
14748- if (packetUBXESFRAW == NULL)
14749- initPacketUBXESFRAW(); // Check that RAM has been allocated for the ESF RAW data
14750- if (packetUBXESFRAW == NULL) // Only attempt this if RAM allocation was successful
14751- return false;
14752-
14753- if (packetUBXESFRAW->automaticFlags.flags.bits.automatic && packetUBXESFRAW->automaticFlags.flags.bits.implicitUpdate)
14754- {
14755- // The GPS is automatically reporting, we just check whether we got unread data
14756- // if (_printDebug == true)
14757- // {
14758- // _debugSerial->println(F("getEsfRawDataInfo: Autoreporting"));
14759- // }
14760- checkUbloxInternal(&packetCfg, UBX_CLASS_ESF, UBX_ESF_RAW);
14761- return packetUBXESFRAW->moduleQueried.moduleQueried.bits.all;
14762- }
14763- else if (packetUBXESFRAW->automaticFlags.flags.bits.automatic && !packetUBXESFRAW->automaticFlags.flags.bits.implicitUpdate)
14764- {
14765- // Someone else has to call checkUblox for us...
14766- // if (_printDebug == true)
14767- // {
14768- // _debugSerial->println(F("getEsfRawDataInfo: Exit immediately"));
14769- // }
14770- return (false);
14771- }
14772- else
14773- {
14774- // if (_printDebug == true)
14775- // {
14776- // _debugSerial->println(F("getEsfRawDataInfo: Polling"));
14777- // }
14778-
14779- // The GPS is not automatically reporting HNR PVT so we have to poll explicitly
14780- packetCfg.cls = UBX_CLASS_ESF;
14781- packetCfg.id = UBX_ESF_RAW;
14782- packetCfg.len = 0;
14783- packetCfg.startingSpot = 0;
14784-
14785- // The data is parsed as part of processing the response
14786- sfe_ublox_status_e retVal = sendCommand(&packetCfg, maxWait);
14787-
14788- if (retVal == SFE_UBLOX_STATUS_DATA_RECEIVED)
14789- return (true);
14790-
14791- if (retVal == SFE_UBLOX_STATUS_DATA_OVERWRITTEN)
14792- {
14793- // if (_printDebug == true)
14794- // {
14795- // _debugSerial->println(F("getEsfRawDataInfo: data in packetCfg was OVERWRITTEN by another message (but that's OK)"));
14796- // }
14797- return (true);
14798- }
14799-
14800- // if (_printDebug == true)
14801- // {
14802- // _debugSerial->print(F("getEsfRawDataInfo retVal: "));
14803- // _debugSerial->println(statusString(retVal));
14804- // }
14805- return (false);
14806- }
14807-
14808- return (false); // Trap. We should never get here...
14809- }
14739+ // ESF RAW messages are output only. They cannot be polled.
1481014740
14811- // Enable or disable automatic ESF RAW message generation by the GNSS. This changes the way getESFRawDataInfo
14812- // works.
14741+ // Enable or disable automatic ESF RAW message generation by the GNSS.
1481314742bool SFE_UBLOX_GNSS::setAutoESFRAW(bool enable, uint16_t maxWait)
1481414743{
1481514744 return setAutoESFRAWrate(enable ? 1 : 0, true, maxWait);
1481614745}
1481714746
14818- // Enable or disable automatic ESF RAW message generation by the GNSS. This changes the way getESFRawDataInfo
14819- // works.
14747+ // Enable or disable automatic ESF RAW message generation by the GNSS.
1482014748bool SFE_UBLOX_GNSS::setAutoESFRAW(bool enable, bool implicitUpdate, uint16_t maxWait)
1482114749{
1482214750 return setAutoESFRAWrate(enable ? 1 : 0, implicitUpdate, maxWait);
1482314751}
1482414752
14825- // Enable or disable automatic ESF RAW message generation by the GNSS. This changes the way getESFRawDataInfo
14826- // works.
14753+ // Enable or disable automatic ESF RAW message generation by the GNSS.
14754+ // Note: this function can only be used to enable or disable the messages. A rate of zero disables the messages.
14755+ // A rate of 1 or more causes the messages to be generated at the full 100Hz.
1482714756bool SFE_UBLOX_GNSS::setAutoESFRAWrate(uint8_t rate, bool implicitUpdate, uint16_t maxWait)
1482814757{
1482914758 if (packetUBXESFRAW == NULL)
@@ -14848,11 +14777,10 @@ bool SFE_UBLOX_GNSS::setAutoESFRAWrate(uint8_t rate, bool implicitUpdate, uint16
1484814777 packetUBXESFRAW->automaticFlags.flags.bits.automatic = (rate > 0);
1484914778 packetUBXESFRAW->automaticFlags.flags.bits.implicitUpdate = implicitUpdate;
1485014779 }
14851- packetUBXESFRAW->moduleQueried.moduleQueried.bits.all = false; // Mark data as stale
1485214780 return ok;
1485314781}
1485414782
14855- // Enable automatic navigation message generation by the GNSS.
14783+ // Enable automatic message generation by the GNSS.
1485614784bool SFE_UBLOX_GNSS::setAutoESFRAWcallback(void (*callbackPointer)(UBX_ESF_RAW_data_t), uint16_t maxWait)
1485714785{
1485814786 // Enable auto messages. Set implicitUpdate to false as we expect the user to call checkUblox manually.
@@ -14937,7 +14865,6 @@ bool SFE_UBLOX_GNSS::initPacketUBXESFRAW()
1493714865 packetUBXESFRAW->callbackPointer = NULL;
1493814866 packetUBXESFRAW->callbackPointerPtr = NULL;
1493914867 packetUBXESFRAW->callbackData = NULL;
14940- packetUBXESFRAW->moduleQueried.moduleQueried.all = 0;
1494114868 return (true);
1494214869}
1494314870
@@ -14946,7 +14873,6 @@ void SFE_UBLOX_GNSS::flushESFRAW()
1494614873{
1494714874 if (packetUBXESFRAW == NULL)
1494814875 return; // Bail if RAM has not been allocated (otherwise we could be writing anywhere!)
14949- packetUBXESFRAW->moduleQueried.moduleQueried.all = 0; // Mark all datums as stale (read before)
1495014876}
1495114877
1495214878// Log this data in file buffer
@@ -18141,22 +18067,6 @@ bool SFE_UBLOX_GNSS::getSensorFusionMeasurement(UBX_ESF_MEAS_sensorData_t *senso
1814118067 return (true);
1814218068}
1814318069
18144- bool SFE_UBLOX_GNSS::getRawSensorMeasurement(UBX_ESF_RAW_sensorData_t *sensorData, uint8_t sensor, uint16_t maxWait)
18145- {
18146- if (packetUBXESFRAW == NULL)
18147- initPacketUBXESFRAW(); // Check that RAM has been allocated for the ESF RAW data
18148- if (packetUBXESFRAW == NULL) // Bail if the RAM allocation failed
18149- return (false);
18150-
18151- if ((packetUBXESFRAW->moduleQueried.moduleQueried.bits.data & (1 << sensor)) == 0)
18152- getESFRAW(maxWait);
18153- packetUBXESFRAW->moduleQueried.moduleQueried.bits.data &= ~(1 << sensor); // Since we are about to give this to user, mark this data as stale
18154- packetUBXESFRAW->moduleQueried.moduleQueried.bits.all = false;
18155- sensorData->data.all = packetUBXESFRAW->data.data[sensor].data.all;
18156- sensorData->sTag = packetUBXESFRAW->data.data[sensor].sTag;
18157- return (true);
18158- }
18159-
1816018070bool SFE_UBLOX_GNSS::getRawSensorMeasurement(UBX_ESF_RAW_sensorData_t *sensorData, UBX_ESF_RAW_data_t ubxDataStruct, uint8_t sensor)
1816118071{
1816218072 sensorData->data.all = ubxDataStruct.data[sensor].data.all;
0 commit comments