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

Commit 61c85b6

Browse files
authored
Merge pull request #110 from sparkfun/PaulZC__Testing_I2C_PullUps
Added printLimitedDebug
2 parents 57da27c + 7bf5576 commit 61c85b6

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/SparkFun_Ublox_Arduino_Library.cpp

+15-8
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,22 @@ boolean SFE_UBLOX_GPS::begin(Stream &serialPort)
8383

8484
//Enable or disable the printing of sent/response HEX values.
8585
//Use this in conjunction with 'Transport Logging' from the Universal Reader Assistant to see what they're doing that we're not
86-
void SFE_UBLOX_GPS::enableDebugging(Stream &debugPort)
86+
void SFE_UBLOX_GPS::enableDebugging(Stream &debugPort, boolean printLimitedDebug)
8787
{
8888
_debugSerial = &debugPort; //Grab which port the user wants us to use for debugging
89-
90-
_printDebug = true; //Should we print the commands we send? Good for debugging
89+
if (printLimitedDebug == false)
90+
{
91+
_printDebug = true; //Should we print the commands we send? Good for debugging
92+
}
93+
else
94+
{
95+
_printLimitedDebug = true; //Should we print limited debug messages? Good for debugging high navigation rates
96+
}
9197
}
9298
void SFE_UBLOX_GPS::disableDebugging(void)
9399
{
94100
_printDebug = false; //Turn off extra print statements
101+
_printLimitedDebug = false;
95102
}
96103

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

339-
if (_printDebug == true)
346+
if ((_printDebug == true) || (_printLimitedDebug == true)) // Print this if doing limited debugging
340347
{
341348
_debugSerial->print(F("checkUbloxI2C: Bytes available error:"));
342349
_debugSerial->println(bytesAvailable);
@@ -395,7 +402,7 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedCl
395402
{
396403
if (incoming == 0x7F)
397404
{
398-
if (_printDebug == true)
405+
if ((_printDebug == true) || (_printLimitedDebug == true)) // Print this if doing limited debugging
399406
{
400407
_debugSerial->println(F("checkUbloxU2C: Ublox error, module not ready with data"));
401408
}
@@ -809,7 +816,7 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t
809816
incomingUBX->classAndIDmatch = SFE_UBLOX_PACKET_VALIDITY_NOT_VALID; // If we have a match, set the classAndIDmatch flag to not valid
810817
}
811818

812-
if (_printDebug == true)
819+
if ((_printDebug == true) || (_printLimitedDebug == true)) // Print this if doing limited debugging
813820
{
814821
//Drive an external pin to allow for easier logic analyzation
815822
if (checksumFailurePin >= 0)

src/SparkFun_Ublox_Arduino_Library.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ class SFE_UBLOX_GPS
624624

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

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

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

836837
//The packet buffers
837838
//These are pointed at from within the ubxPacket

0 commit comments

Comments
 (0)