@@ -1154,6 +1154,8 @@ uint16_t SFE_UBLOX_GNSS::getMaxPayloadSize(uint8_t Class, uint8_t ID)
1154
1154
// Take a given byte and file it into the proper array
1155
1155
// Note - AJB - we will ALWAYS use packetBuf to receive incoming, and then process them into the
1156
1156
// appropriate packet structures
1157
+ // Note - PC - we need to make sure that users can still use custom packets (passed via incomingUBX).
1158
+ // We can't hardwire this code to packetCfg...
1157
1159
void SFE_UBLOX_GNSS::process (uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID)
1158
1160
{
1159
1161
if ((currentSentence == NONE) || (currentSentence == NMEA))
@@ -1227,9 +1229,9 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
1227
1229
{
1228
1230
if (_printDebug) _debugSerial->println (" process: activeBuffer PACKETCFG" );
1229
1231
activePacketBuffer = SFE_UBLOX_PACKET_PACKETCFG;
1230
- packetCfg. cls = packetBuf.cls ;
1231
- packetCfg. id = packetBuf.id ;
1232
- packetCfg. counter = packetBuf.counter ;
1232
+ incomingUBX-> cls = packetBuf.cls ;
1233
+ incomingUBX-> id = packetBuf.id ;
1234
+ incomingUBX-> counter = packetBuf.counter ;
1233
1235
}
1234
1236
else
1235
1237
{
@@ -1376,7 +1378,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
1376
1378
if (activePacketBuffer == SFE_UBLOX_PACKET_PACKETACK)
1377
1379
processUBX (incoming, &packetAck);
1378
1380
else if (activePacketBuffer == SFE_UBLOX_PACKET_PACKETCFG)
1379
- processUBX (incoming, &packetCfg );
1381
+ processUBX (incoming, incomingUBX );
1380
1382
else if (activePacketBuffer == SFE_UBLOX_PACKET_PACKETBUF)
1381
1383
processUBX (incoming, &packetBuf);
1382
1384
else // if (activePacketBuffer == SFE_UBLOX_PACKET_PACKETAUTO)
@@ -3059,7 +3061,7 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::waitForACKResponse(ubxPacket *outgoingUBX, ui
3059
3061
3060
3062
// If both the packetCfg->isClassAndIdMatch and packetAck.isClassAndIdMatch
3061
3063
// then we can be confident that the data in packetCfg is valid
3062
- if (packetAck.isAckForClassAndId (requestedClass, requestedID) && packetCfg. valid == SFE_UBLOX_PACKET_VALIDITY_VALID && packetAck.valid == SFE_UBLOX_PACKET_VALIDITY_VALID && packetCfg. isClassAndIdMatch (requestedClass, requestedID))
3064
+ if (packetAck.isAckForClassAndId (requestedClass, requestedID) && outgoingUBX-> valid == SFE_UBLOX_PACKET_VALIDITY_VALID && packetAck.valid == SFE_UBLOX_PACKET_VALIDITY_VALID && outgoingUBX-> isClassAndIdMatch (requestedClass, requestedID))
3063
3065
{
3064
3066
if (_printDebug == true )
3065
3067
{
@@ -3069,7 +3071,7 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::waitForACKResponse(ubxPacket *outgoingUBX, ui
3069
3071
}
3070
3072
return (SFE_UBLOX_STATUS_DATA_RECEIVED); // We received valid data and a correct ACK!
3071
3073
}
3072
- else if (!packetCfg. isClassAndIdMatch (requestedClass, requestedID) && packetAck.isClassAndIdMatch (requestedClass, requestedID))
3074
+ else if (!outgoingUBX-> isClassAndIdMatch (requestedClass, requestedID) && packetAck.isClassAndIdMatch (requestedClass, requestedID))
3073
3075
{
3074
3076
if (_printDebug == true )
3075
3077
{
@@ -3082,7 +3084,7 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::waitForACKResponse(ubxPacket *outgoingUBX, ui
3082
3084
3083
3085
// If packetAck is for requested class/ID but both outgoingUBX->valid and packetCfg isClassAndIDmatch
3084
3086
// are NOT_VALID then we can be confident we have had a checksum failure on the data packet
3085
- else if ((packetAck.isAckForClassAndId (requestedClass, requestedID) && (packetCfg. valid == SFE_UBLOX_PACKET_VALIDITY_NOT_VALID)))
3087
+ else if ((packetAck.isAckForClassAndId (requestedClass, requestedID) && (outgoingUBX-> valid == SFE_UBLOX_PACKET_VALIDITY_NOT_VALID)))
3086
3088
{
3087
3089
if (_printDebug == true )
3088
3090
{
@@ -3106,7 +3108,7 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::waitForACKResponse(ubxPacket *outgoingUBX, ui
3106
3108
// If the packetCfg.isClassAndIdMatch but the packetAck is not for this class/ID
3107
3109
// then the ack probably had a checksum error. We will take a gamble and return DATA_RECEIVED.
3108
3110
// If we were playing safe, we should return FAIL instead
3109
- else if ((packetCfg. isClassAndIdMatch (requestedClass, requestedID) && (packetAck.isClassAndIdMatch (requestedClass, requestedID) == false ) && (packetCfg. valid == SFE_UBLOX_PACKET_VALIDITY_VALID)))
3111
+ else if ((outgoingUBX-> isClassAndIdMatch (requestedClass, requestedID) && (packetAck.isClassAndIdMatch (requestedClass, requestedID) == false ) && (outgoingUBX-> valid == SFE_UBLOX_PACKET_VALIDITY_VALID)))
3110
3112
{
3111
3113
if (_printDebug == true )
3112
3114
{
@@ -3119,7 +3121,7 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::waitForACKResponse(ubxPacket *outgoingUBX, ui
3119
3121
3120
3122
// If classes of ack and data do not match
3121
3123
// then we return a FAIL. This must be a double checksum failure?
3122
- else if ((packetCfg. isClassAndIdMatch (requestedClass, requestedID) == false ) && (packetAck.isClassAndIdMatch (requestedClass, requestedID) == false ))
3124
+ else if ((outgoingUBX-> isClassAndIdMatch (requestedClass, requestedID) == false ) && (packetAck.isClassAndIdMatch (requestedClass, requestedID) == false ))
3123
3125
{
3124
3126
if (_printDebug == true )
3125
3127
{
@@ -3137,7 +3139,7 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::waitForACKResponse(ubxPacket *outgoingUBX, ui
3137
3139
// We have timed out...
3138
3140
// If the packetCfg matches the requested class/ID then we can take a gamble and return DATA_RECEIVED
3139
3141
// even though we did not get an ACK
3140
- if ((packetCfg. isClassAndIdMatch (requestedClass, requestedID) && !packetAck.isClassAndIdMatch (requestedClass, requestedID)) && (packetCfg. valid == SFE_UBLOX_PACKET_VALIDITY_VALID))
3142
+ if ((outgoingUBX-> isClassAndIdMatch (requestedClass, requestedID) && !packetAck.isClassAndIdMatch (requestedClass, requestedID)) && (outgoingUBX-> valid == SFE_UBLOX_PACKET_VALIDITY_VALID))
3141
3143
{
3142
3144
if (_printDebug == true )
3143
3145
{
@@ -3174,13 +3176,13 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::waitForNoACKResponse(ubxPacket *outgoingUBX,
3174
3176
unsigned long startTime = millis ();
3175
3177
while (millis () - startTime < maxTime)
3176
3178
{
3177
- if (checkUbloxInternal (&packetBuf , requestedClass, requestedID) == true ) // See if new data is available. Process bytes as they come in.
3179
+ if (checkUbloxInternal (outgoingUBX , requestedClass, requestedID) == true ) // See if new data is available. Process bytes as they come in.
3178
3180
{
3179
3181
3180
3182
// If packetBuf matches
3181
3183
// and outgoingUBX->valid is _still_ VALID and the class and ID _still_ match
3182
3184
// then we can be confident that the data in packetBuf is valid
3183
- if (packetBuf. isClassAndIdMatch (requestedClass, requestedID) && packetBuf.valid == SFE_UBLOX_PACKET_VALIDITY_VALID)
3185
+ if (outgoingUBX-> isClassAndIdMatch (requestedClass, requestedID) && packetBuf.valid == SFE_UBLOX_PACKET_VALIDITY_VALID)
3184
3186
{
3185
3187
if (_printDebug == true )
3186
3188
{
0 commit comments