This commit is contained in:
Rick Sellens 2020-02-07 20:20:30 -05:00
parent 59c1a4acbd
commit fdda5b6e1e
3 changed files with 10 additions and 9 deletions

View File

@ -349,11 +349,11 @@ 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 Call very frequently and multiple times per opportunity or the buffer
may overflow if there are frequent NMEA sentences. An 82 character NMEA may overflow if there are frequent NMEA sentences. An 82 character NMEA
sentence 10 times per second will require 820 calls per second, and sentence 10 times per second will require 820 calls per second, and
once a loop() may not be enough. Check for newNMEAreceived() after at once a loop() may not be enough. Check for newNMEAreceived() after at
least every 10 calls, or you may miss some short sentences. least every 10 calls, or you may miss some short sentences.
@return The character that we received, or 0 if nothing was available @return The character that we received, or 0 if nothing was available
@ -385,8 +385,8 @@ char Adafruit_GPS::read(void) {
_buff_idx++; _buff_idx++;
} else { } else {
// refill the buffer! // refill the buffer!
if (gpsI2C->requestFrom((uint8_t)0x10, (uint8_t)GPS_MAX_I2C_TRANSFER, (uint8_t) true) == if (gpsI2C->requestFrom((uint8_t)0x10, (uint8_t)GPS_MAX_I2C_TRANSFER,
GPS_MAX_I2C_TRANSFER) { (uint8_t) true) == GPS_MAX_I2C_TRANSFER) {
// got data! // got data!
_buff_max = 0; _buff_max = 0;
char curr_char = 0; char curr_char = 0;

View File

@ -570,9 +570,9 @@ char *Adafruit_GPS::build(char *nmea, const char *thisSource,
addChecksum(nmea); // Successful completion addChecksum(nmea); // Successful completion
if (!noCRLF) { // 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); sprintf(nmea, "%s\r\n", nmea);
} }
return nmea; // return pointer to finished product return nmea; // return pointer to finished product
} }
#endif // NMEA_EXTENSIONS #endif // NMEA_EXTENSIONS

View File

@ -782,9 +782,10 @@ bool Adafruit_GPS::parseTime(char *p) {
seconds = (time % 100); seconds = (time % 100);
char *dec = strchr(p, '.'); char *dec = strchr(p, '.');
char *comstar = min(strchr(p, ','), strchr(p, '*')); char *comstar = min(strchr(p, ','), strchr(p, '*'));
if(dec != NULL && comstar != NULL && dec < comstar) if (dec != NULL && comstar != NULL && dec < comstar)
milliseconds = atof(p) * 1000; milliseconds = atof(p) * 1000;
else milliseconds = 0; else
milliseconds = 0;
lastTime = sentTime; lastTime = sentTime;
return true; return true;
} }