@@ -633,6 +633,13 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t
633633 && (incomingUBX->payload [0 ] == requestedClass) && (incomingUBX->payload [1 ] == requestedID))
634634 {
635635 incomingUBX->classAndIDmatch = SFE_UBLOX_PACKET_VALIDITY_NOT_VALID; // If we have a match, set the classAndIDmatch flag to NOT_VALID
636+ if (_printDebug == true )
637+ {
638+ _debugSerial->print (F (" processUBX: NACK received: Requested Class: " ));
639+ _debugSerial->print (incomingUBX->payload [0 ]);
640+ _debugSerial->print (F (" Requested ID: " ));
641+ _debugSerial->println (incomingUBX->payload [1 ]);
642+ }
636643 }
637644
638645 if (_printDebug == true )
@@ -642,7 +649,7 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t
642649 _debugSerial->print (F (" Received: " ));
643650 printPacket (incomingUBX);
644651
645- if (packetCfg. valid == SFE_UBLOX_PACKET_VALIDITY_VALID)
652+ if (incomingUBX-> valid == SFE_UBLOX_PACKET_VALIDITY_VALID)
646653 {
647654 if (_printDebug == true )
648655 {
@@ -656,7 +663,7 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t
656663 _debugSerial->println (F (" packetAck now valid" ));
657664 }
658665 }
659- if (packetCfg. classAndIDmatch == SFE_UBLOX_PACKET_VALIDITY_VALID)
666+ if (incomingUBX-> classAndIDmatch == SFE_UBLOX_PACKET_VALIDITY_VALID)
660667 {
661668 if (_printDebug == true )
662669 {
@@ -682,6 +689,7 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t
682689 // This is potentially risky as we are saying that we saw the requested Class and ID
683690 // but that the packet checksum failed. Potentially it could be the class or ID bytes
684691 // that caused the checksum error!
692+
685693 if ((incomingUBX->cls == requestedClass) && (incomingUBX->id == requestedID))
686694 {
687695 incomingUBX->classAndIDmatch = SFE_UBLOX_PACKET_VALIDITY_NOT_VALID; // If we have a match, set the classAndIDmatch flag to not valid
@@ -1284,13 +1292,26 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForNoACKResponse(ubxPacket *outgoingUBX, u
12841292 // If the outgoingUBX->classAndIDmatch is NOT_VALID then we return CRC failure
12851293 else if (outgoingUBX->classAndIDmatch == SFE_UBLOX_PACKET_VALIDITY_NOT_VALID)
12861294 {
1287- if (_printDebug == true )
1295+ if (outgoingUBX-> valid == SFE_UBLOX_PACKET_VALIDITY_VALID )
12881296 {
1289- _debugSerial->print (F (" waitForNoACKResponse: CLS/ID match but failed CRC after " ));
1290- _debugSerial->print (millis () - startTime);
1291- _debugSerial->println (F (" msec" ));
1297+ if (_printDebug == true )
1298+ {
1299+ _debugSerial->print (F (" waitForNoACKResponse: CLS/ID match but NACK received after " ));
1300+ _debugSerial->print (millis () - startTime);
1301+ _debugSerial->println (F (" msec" ));
1302+ }
1303+ return (SFE_UBLOX_STATUS_CRC_FAIL); // We received invalid data
1304+ }
1305+ else if (outgoingUBX->valid == SFE_UBLOX_PACKET_VALIDITY_NOT_VALID)
1306+ {
1307+ if (_printDebug == true )
1308+ {
1309+ _debugSerial->print (F (" waitForNoACKResponse: CLS/ID match but failed CRC after " ));
1310+ _debugSerial->print (millis () - startTime);
1311+ _debugSerial->println (F (" msec" ));
1312+ }
1313+ return (SFE_UBLOX_STATUS_CRC_FAIL); // We received invalid data
12921314 }
1293- return (SFE_UBLOX_STATUS_CRC_FAIL); // We received invalid data
12941315 }
12951316
12961317 else if ((outgoingUBX->cls < 255 ) && (outgoingUBX->id < 255 ) && (outgoingUBX->valid != SFE_UBLOX_PACKET_VALIDITY_NOT_DEFINED))
0 commit comments