diff --git a/minmea.c b/minmea.c index bd6fb06..fb3260b 100644 --- a/minmea.c +++ b/minmea.c @@ -19,9 +19,9 @@ static int hex2int(char c) if (c >= '0' && c <= '9') return c - '0'; if (c >= 'A' && c <= 'F') - return c - 'A'; + return c - 'A' + 10; if (c >= 'a' && c <= 'f') - return c - 'a'; + return c - 'a' + 10; return -1; } diff --git a/tests.c b/tests.c index 1744a3c..f29d1dc 100644 --- a/tests.c +++ b/tests.c @@ -20,6 +20,8 @@ static const char *valid_sequences[] = { "$GPGGA,,,,,,0,00,99.99,,,,,,*48", "$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30", "$GPGLL,,,,,,V,N*64", + "$GPXTE,A,A,0.67,L,N*6F", + "$GPXTE,A,A,0.67,L,N*6f", NULL, }; @@ -32,6 +34,8 @@ static const char *invalid_sequences[] = { "$$GPGGA,,,,,,0,00,99.99,,,,,,*48", "GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30", "gps: $GPGLL,,,,,,V,N", + "$GPXTE,A,A,0.67,L,N*6e", + "$GPXTE,A,A,0.67,L,N*6g", NULL, };