sparkfun / SparkFun_I2C_GPS_Arduino_Library

Library for reading and controlling MT3333 and MT3339 based GPS modules over I2C.
Other
18 stars 13 forks source link

Debug mode using Redboard Turbo (SAMD21) #8

Closed lacomj closed 4 years ago

lacomj commented 4 years ago

Hey, great stuff! Thanks for your contributions to the Arduino community!

I wanted to report that when trying to run Example 5 (Configure GPS) on the Sparkfun Redboard Turbo (SAMD21 processor), the way that the serial monitor is handled is different than most other Arduinos. In short, all the Serial.print commands need to be changed to SerialUSB.print (etc.). However, even when this is done, the code still won't compile due to the section of code for Enable/Disable Debugging. Examination of SparkFun_I2C_GPS_Arduino_Library.h reveals that myI2CGPS.enableDebugging() is hard-coded to use the conventional serial monitor usage commands, and thus won't let the code for Example 5 compile. If you comment out that section of the Example 5 code (and thus lose the GPS debugging option), then it works fine.

I am not sure this is worth a fix, but the way that the serial monitor is handled with the SAMD21 boards makes using the provided examples a bit of a hassle to re-write. And with Example 5, the fix is a bit more involved. Maybe there is a more graceful way to update the code to handle the serial monitor for "traditional" boards at the same time the increasingly-popular SAMD21 boards?

Anyway, just thought I'd point that out. Great job with this GPS library!

nseidle commented 4 years ago

Thanks!

The debug serial prints can be assigned to any stream you'd like

enableDebugging(SerialUSB);

Should get you what you want.

Also, if search and replace Serial -> SerialUSB is too much I often just do a

#define Serial SerialUSB

Please let us know if you continue to have issues.

lacomj commented 4 years ago

Thanks! Those are useful approaches I wasn't aware of!