Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 34a907c

Browse files
author
Nathan Seidle
committed
Add printing of packet types for debug. Debug when max payload hit.
1 parent e3fb4fa commit 34a907c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/SparkFun_Ublox_Arduino_Library.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,15 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C()
319319
_debugSerial->println(F(" bytes received"));
320320
}
321321
}
322+
else
323+
{
324+
if (_printDebug == true)
325+
{
326+
_debugSerial->print(F("checkUbloxI2C: Reading "));
327+
_debugSerial->print(bytesAvailable);
328+
_debugSerial->println(F(" bytes"));
329+
}
330+
}
322331

323332
while (bytesAvailable)
324333
{
@@ -630,6 +639,16 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX)
630639
}
631640

632641
incomingUBX->counter++;
642+
if (incomingUBX->counter == MAX_PAYLOAD_SIZE)
643+
{
644+
//Something has gone very wrong
645+
currentSentence = NONE; //Reset the sentence to being looking for a new start char
646+
if (_printDebug == true)
647+
{
648+
_debugSerial->println(F("processUBX: counter hit MAX_PAYLOAD_SIZE"));
649+
}
650+
Serial.println(F("processUBX: counter hit MAX_PAYLOAD_SIZE"));
651+
}
633652
}
634653

635654
//Once a packet has been received and validated, identify this packet's class/id and update internal flags
@@ -956,6 +975,10 @@ void SFE_UBLOX_GPS::printPacket(ubxPacket *packet)
956975
_debugSerial->print(F(" ID:"));
957976
if (packet->cls == UBX_CLASS_NAV && packet->id == UBX_NAV_PVT)
958977
_debugSerial->print("PVT");
978+
else if (packet->cls == UBX_CLASS_CFG && packet->id == UBX_CFG_RATE)
979+
_debugSerial->print("RATE");
980+
else if (packet->cls == UBX_CLASS_CFG && packet->id == UBX_CFG_CFG)
981+
_debugSerial->print("SAVE");
959982
else
960983
_debugSerial->print(packet->id, HEX);
961984

0 commit comments

Comments
 (0)