diff --git a/src/Adafruit_GPS.cpp b/src/Adafruit_GPS.cpp index 65e5c10..c8e46c6 100644 --- a/src/Adafruit_GPS.cpp +++ b/src/Adafruit_GPS.cpp @@ -349,7 +349,13 @@ size_t Adafruit_GPS::write(uint8_t c) { /**************************************************************************/ /*! - @brief Read one character from the GPS device + @brief Read one character from the GPS device. + + Call very frequently and multiple times per opportunity or the buffer + may overflow if there are frequent NMEA sentences. An 82 character NMEA + sentence 10 times per second will require 820 calls per second, and + once a loop() may not be enough. Check for newNMEAreceived() after at + least every 10 calls, or you may miss some short sentences. @return The character that we received, or 0 if nothing was available */ /**************************************************************************/ diff --git a/src/Adafruit_GPS.h b/src/Adafruit_GPS.h index fe9baee..acfc316 100644 --- a/src/Adafruit_GPS.h +++ b/src/Adafruit_GPS.h @@ -121,7 +121,7 @@ public: // NMEA_build.cpp #ifdef NMEA_EXTENSIONS char *build(char *nmea, const char *thisSource, const char *thisSentence, - char ref = 'R'); + char ref = 'R', bool noCRLF = false); #endif void addChecksum(char *buff); diff --git a/src/NMEA_build.cpp b/src/NMEA_build.cpp index 8b78139..201f30c 100644 --- a/src/NMEA_build.cpp +++ b/src/NMEA_build.cpp @@ -71,7 +71,7 @@ */ /**************************************************************************/ char *Adafruit_GPS::build(char *nmea, const char *thisSource, - const char *thisSentence, char ref) { + const char *thisSentence, char ref, bool noCRLF) { sprintf(nmea, "%6.2f", (double)123.45); // fail if sprintf() doesn't handle floats if (strcmp(nmea, "123.45")) @@ -569,8 +569,9 @@ char *Adafruit_GPS::build(char *nmea, const char *thisSource, } addChecksum(nmea); // Successful completion - sprintf(nmea, "%s\r\n", - nmea); // Add Carriage Return and Line Feed to comply with NMEA-183 + if (!noCRLF) { // Add Carriage Return and Line Feed to comply with NMEA-183 + sprintf(nmea, "%s\r\n", nmea); + } return nmea; // return pointer to finished product }