@@ -4246,15 +4246,13 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
4246
4246
// Parse various byte fields into storage - but only if we have memory allocated for it
4247
4247
if (packetUBXESFRAW != NULL)
4248
4248
{
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++)
4250
4251
{
4251
4252
packetUBXESFRAW->data.data[i].data.all = extractLong(msg, 4 + (i * 8));
4252
4253
packetUBXESFRAW->data.data[i].sTag = extractLong(msg, 8 + (i * 8));
4253
4254
}
4254
4255
4255
- // Mark all datums as fresh (not read before)
4256
- packetUBXESFRAW->moduleQueried.moduleQueried.all = 0xFFFFFFFF;
4257
-
4258
4256
// Check if we need to copy the data for the callback
4259
4257
if ((packetUBXESFRAW->callbackData != NULL) // If RAM has been allocated for the copy of the data
4260
4258
&& (packetUBXESFRAW->automaticFlags.flags.bits.callbackCopyValid == false)) // AND the data is stale
@@ -10233,7 +10231,7 @@ bool SFE_UBLOX_GNSS::getVehAtt(uint16_t maxWait)
10233
10231
bool SFE_UBLOX_GNSS::getNAVATT(uint16_t maxWait)
10234
10232
{
10235
10233
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
10237
10235
if (packetUBXNAVATT == NULL) // Only attempt this if RAM allocation was successful
10238
10236
return false;
10239
10237
@@ -10373,7 +10371,7 @@ bool SFE_UBLOX_GNSS::setAutoNAVATTcallbackPtr(void (*callbackPointerPtr)(UBX_NAV
10373
10371
bool SFE_UBLOX_GNSS::assumeAutoNAVATT(bool enabled, bool implicitUpdate)
10374
10372
{
10375
10373
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
10377
10375
if (packetUBXNAVATT == NULL) // Only attempt this if RAM allocation was successful
10378
10376
return false;
10379
10377
@@ -14738,92 +14736,23 @@ void SFE_UBLOX_GNSS::logESFMEAS(bool enabled)
14738
14736
14739
14737
// ***** ESF RAW automatic support
14740
14738
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.
14810
14740
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.
14813
14742
bool SFE_UBLOX_GNSS::setAutoESFRAW(bool enable, uint16_t maxWait)
14814
14743
{
14815
14744
return setAutoESFRAWrate(enable ? 1 : 0, true, maxWait);
14816
14745
}
14817
14746
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.
14820
14748
bool SFE_UBLOX_GNSS::setAutoESFRAW(bool enable, bool implicitUpdate, uint16_t maxWait)
14821
14749
{
14822
14750
return setAutoESFRAWrate(enable ? 1 : 0, implicitUpdate, maxWait);
14823
14751
}
14824
14752
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.
14827
14756
bool SFE_UBLOX_GNSS::setAutoESFRAWrate(uint8_t rate, bool implicitUpdate, uint16_t maxWait)
14828
14757
{
14829
14758
if (packetUBXESFRAW == NULL)
@@ -14848,11 +14777,10 @@ bool SFE_UBLOX_GNSS::setAutoESFRAWrate(uint8_t rate, bool implicitUpdate, uint16
14848
14777
packetUBXESFRAW->automaticFlags.flags.bits.automatic = (rate > 0);
14849
14778
packetUBXESFRAW->automaticFlags.flags.bits.implicitUpdate = implicitUpdate;
14850
14779
}
14851
- packetUBXESFRAW->moduleQueried.moduleQueried.bits.all = false; // Mark data as stale
14852
14780
return ok;
14853
14781
}
14854
14782
14855
- // Enable automatic navigation message generation by the GNSS.
14783
+ // Enable automatic message generation by the GNSS.
14856
14784
bool SFE_UBLOX_GNSS::setAutoESFRAWcallback(void (*callbackPointer)(UBX_ESF_RAW_data_t), uint16_t maxWait)
14857
14785
{
14858
14786
// 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()
14937
14865
packetUBXESFRAW->callbackPointer = NULL;
14938
14866
packetUBXESFRAW->callbackPointerPtr = NULL;
14939
14867
packetUBXESFRAW->callbackData = NULL;
14940
- packetUBXESFRAW->moduleQueried.moduleQueried.all = 0;
14941
14868
return (true);
14942
14869
}
14943
14870
@@ -14946,7 +14873,6 @@ void SFE_UBLOX_GNSS::flushESFRAW()
14946
14873
{
14947
14874
if (packetUBXESFRAW == NULL)
14948
14875
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)
14950
14876
}
14951
14877
14952
14878
// Log this data in file buffer
@@ -18141,22 +18067,6 @@ bool SFE_UBLOX_GNSS::getSensorFusionMeasurement(UBX_ESF_MEAS_sensorData_t *senso
18141
18067
return (true);
18142
18068
}
18143
18069
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
-
18160
18070
bool SFE_UBLOX_GNSS::getRawSensorMeasurement(UBX_ESF_RAW_sensorData_t *sensorData, UBX_ESF_RAW_data_t ubxDataStruct, uint8_t sensor)
18161
18071
{
18162
18072
sensorData->data.all = ubxDataStruct.data[sensor].data.all;
0 commit comments