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

Added printLimitedDebug #110

Merged
merged 2 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/SparkFun_Ublox_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,22 @@ boolean SFE_UBLOX_GPS::begin(Stream &serialPort)

//Enable or disable the printing of sent/response HEX values.
//Use this in conjunction with 'Transport Logging' from the Universal Reader Assistant to see what they're doing that we're not
void SFE_UBLOX_GPS::enableDebugging(Stream &debugPort)
void SFE_UBLOX_GPS::enableDebugging(Stream &debugPort, boolean printLimitedDebug)
{
_debugSerial = &debugPort; //Grab which port the user wants us to use for debugging

_printDebug = true; //Should we print the commands we send? Good for debugging
if (printLimitedDebug == false)
{
_printDebug = true; //Should we print the commands we send? Good for debugging
}
else
{
_printLimitedDebug = true; //Should we print limited debug messages? Good for debugging high navigation rates
}
}
void SFE_UBLOX_GPS::disableDebugging(void)
{
_printDebug = false; //Turn off extra print statements
_printLimitedDebug = false;
}

//Safely print messages
Expand Down Expand Up @@ -302,9 +309,9 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedCl
if (lsb == 0xFF)
{
//I believe this is a Ublox bug. Device should never present an 0xFF.
if (_printDebug == true)
if ((_printDebug == true) || (_printLimitedDebug == true)) // Print this if doing limited debugging
{
_debugSerial->println(F("checkUbloxI2C: Ublox bug, no bytes available"));
_debugSerial->println(F("checkUbloxI2C: Ublox bug, length lsb is 0xFF"));
}
if (checksumFailurePin >= 0)
{
Expand Down Expand Up @@ -336,7 +343,7 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedCl
//Clear the MSbit
bytesAvailable &= ~((uint16_t)1 << 15);

if (_printDebug == true)
if ((_printDebug == true) || (_printLimitedDebug == true)) // Print this if doing limited debugging
{
_debugSerial->print(F("checkUbloxI2C: Bytes available error:"));
_debugSerial->println(bytesAvailable);
Expand Down Expand Up @@ -395,7 +402,7 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedCl
{
if (incoming == 0x7F)
{
if (_printDebug == true)
if ((_printDebug == true) || (_printLimitedDebug == true)) // Print this if doing limited debugging
{
_debugSerial->println(F("checkUbloxU2C: Ublox error, module not ready with data"));
}
Expand Down Expand Up @@ -809,7 +816,7 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t
incomingUBX->classAndIDmatch = SFE_UBLOX_PACKET_VALIDITY_NOT_VALID; // If we have a match, set the classAndIDmatch flag to not valid
}

if (_printDebug == true)
if ((_printDebug == true) || (_printLimitedDebug == true)) // Print this if doing limited debugging
{
//Drive an external pin to allow for easier logic analyzation
if (checksumFailurePin >= 0)
Expand Down
3 changes: 2 additions & 1 deletion src/SparkFun_Ublox_Arduino_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ class SFE_UBLOX_GPS

boolean getRELPOSNED(uint16_t maxWait = 1100); //Get Relative Positioning Information of the NED frame

void enableDebugging(Stream &debugPort = Serial); //Given a port to print to, enable debug messages
void enableDebugging(Stream &debugPort = Serial, boolean printLimitedDebug = false); //Given a port to print to, enable debug messages. Default to all, not limited.
void disableDebugging(void); //Turn off debug statements
void debugPrint(char *message); //Safely print debug statements
void debugPrintln(char *message); //Safely print debug statements
Expand Down Expand Up @@ -823,6 +823,7 @@ class SFE_UBLOX_GPS
//This can be changed using the ublox configuration software

boolean _printDebug = false; //Flag to print the serial commands we are sending to the Serial port for debug
boolean _printLimitedDebug = false; //Flag to print limited debug messages. Useful for I2C debugging or high navigation rates

//The packet buffers
//These are pointed at from within the ubxPacket
Expand Down