Actually return NMEA string with CRLF
This commit is contained in:
parent
b9abc83581
commit
792e13d2b2
|
|
@ -566,11 +566,12 @@ char *Adafruit_GPS::build(char *nmea, const char *thisSource,
|
|||
addChecksum(nmea); // Successful completion
|
||||
if (!noCRLF) { // Add Carriage Return and Line Feed to comply with NMEA-183
|
||||
size_t len = strlen(nmea);
|
||||
char *newStr =
|
||||
char *nmeaWithCRLF =
|
||||
(char *)malloc(len + 3); // +2 for \r\n, +1 for null terminator
|
||||
if (newStr) {
|
||||
strcpy(newStr, nmea); // Copy original string
|
||||
strcat(newStr, "\r\n"); // Append \r\n
|
||||
if (nmeaWithCRLF) {
|
||||
strcpy(nmeaWithCRLF, nmea); // Copy original string
|
||||
strcat(nmeaWithCRLF, "\r\n"); // Append \r\n
|
||||
return nmeaWithCRLF; // return pointer to finished product
|
||||
}
|
||||
}
|
||||
return nmea; // return pointer to finished product
|
||||
|
|
|
|||
Loading…
Reference in New Issue