Revert "parse checksum to *"

This reverts commit 0f867b508a.
This commit is contained in:
Rick Sellens 2019-04-16 12:49:05 -04:00
parent 37fed7f05d
commit 968e95344c
1 changed files with 5 additions and 6 deletions

View File

@ -55,14 +55,13 @@ boolean Adafruit_GPS::parse(char *nmea) {
// do checksum check // do checksum check
// first look if we even have one // first look if we even have one
char *ast = strchr(nmea,'*'); if (nmea[strlen(nmea)-4] == '*') {
if (ast != NULL) { uint16_t sum = parseHex(nmea[strlen(nmea)-3]) * 16;
uint16_t sum = parseHex(*(ast+1)) * 16; sum += parseHex(nmea[strlen(nmea)-2]);
sum += parseHex(*(ast+2));
// check checksum // check checksum
for (char *p = nmea+2; p < ast; p++) { for (uint8_t i=2; i < (strlen(nmea)-4); i++) {
sum ^= *p; sum ^= nmea[i];
} }
if (sum != 0) { if (sum != 0) {
// bad checksum :( // bad checksum :(