Merge branch 'master' of https://github.com/makermelissa/Adafruit_GPS
This commit is contained in:
commit
cd7138fb2e
|
|
@ -352,7 +352,7 @@ char Adafruit_GPS::read(void) {
|
||||||
// Serial.print(c);
|
// Serial.print(c);
|
||||||
|
|
||||||
currentline[lineidx] = c;
|
currentline[lineidx] = c;
|
||||||
lineidx++;
|
lineidx = lineidx + 1;
|
||||||
if (lineidx >= MAXLINELENGTH)
|
if (lineidx >= MAXLINELENGTH)
|
||||||
lineidx = MAXLINELENGTH -
|
lineidx = MAXLINELENGTH -
|
||||||
1; // ensure there is someplace to put the next received character
|
1; // ensure there is someplace to put the next received character
|
||||||
|
|
|
||||||
|
|
@ -565,7 +565,13 @@ 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);
|
int neededSize = strlen(nmea) + 2;
|
||||||
|
char *tempBuffer = (char *)malloc(neededSize);
|
||||||
|
if (tempBuffer != NULL) {
|
||||||
|
sprintf(tempBuffer, neededSize, "%s\r\n", nmea);
|
||||||
|
strcpy(nmea, tempBuffer);
|
||||||
|
free(tempBuffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nmea; // return pointer to finished product
|
return nmea; // return pointer to finished product
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue