@@ -585,7 +585,9 @@ void SFE_UBLOX_GPS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t re
585585 _debugSerial->print (F (" process: ACK received with .len != 2: Class: 0x" ));
586586 _debugSerial->print (packetBuf.payload [0 ], HEX);
587587 _debugSerial->print (F (" ID: 0x" ));
588- _debugSerial->println (packetBuf.payload [1 ], HEX);
588+ _debugSerial->print (packetBuf.payload [1 ], HEX);
589+ _debugSerial->print (F (" len: " ));
590+ _debugSerial->println (packetBuf.len );
589591 }
590592 }
591593 }
@@ -780,7 +782,11 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t
780782 }
781783 }
782784
783- processUBXpacket (incomingUBX); // We've got a valid packet, now do something with it
785+ // We've got a valid packet, now do something with it but only if ignoreThisPayload is false
786+ if (ignoreThisPayload == false )
787+ {
788+ processUBXpacket (incomingUBX);
789+ }
784790 }
785791 else // Checksum failure
786792 {
@@ -1217,12 +1223,21 @@ void SFE_UBLOX_GPS::printPacket(ubxPacket *packet)
12171223 _debugSerial->print (F (" Len: 0x" ));
12181224 _debugSerial->print (packet->len , HEX);
12191225
1220- _debugSerial->print (F (" Payload:" ));
1226+ // Only print the payload is ignoreThisPayload is false otherwise
1227+ // we could be printing gibberish from beyond the end of packetBuf
1228+ if (ignoreThisPayload == false )
1229+ {
1230+ _debugSerial->print (F (" Payload:" ));
12211231
1222- for (int x = 0 ; x < packet->len ; x++)
1232+ for (int x = 0 ; x < packet->len ; x++)
1233+ {
1234+ _debugSerial->print (F (" " ));
1235+ _debugSerial->print (packet->payload [x], HEX);
1236+ }
1237+ }
1238+ else
12231239 {
1224- _debugSerial->print (F (" " ));
1225- _debugSerial->print (packet->payload [x], HEX);
1240+ _debugSerial->print (F (" Payload: IGNORED" ));
12261241 }
12271242 _debugSerial->println ();
12281243 }
0 commit comments