ttlappalainen / NMEA0183

Library for handling NMEA0183 messages
76 stars 48 forks source link

LatLonToDouble(const char *data, const char sign) return 0 instead NA when given "" #27

Open lsoltero opened 3 years ago

lsoltero commented 3 years ago

this family of routines should return NMEA183xxxxNA when given arguments of "". They mostly all return 0.

NMEA0183GPSDateTimetotime_t(NMEA0183Msg.Field(8),0) is particularly bad since it returns bogus time instead of NMEA0183time_tNA (which does not exist).

$GPGGA,,,,,,0,00,99.99,,,,,,*48

for example returns 0 for Time, Lat, Lon, Alt the fields are really NA.

same is true for $GPGLL,,,,,,V,N64 $GPRMC,,V,,,,,,,,,,N53

although these have status flags that tag the data as invalid.

RMC returns bogus data time data since it calls lDT=NMEA0183GPSDateTimetotime_t(NMEA0183Msg.Field(8),0)+floor(GPSTime);

and NMEA0183GPSDateTimetotime_t returns bogus data when passed "" for arguments.

ttlappalainen commented 3 years ago

Sorry for delay. I am working with this. I had these fixed on my other code by using NMEA0183GetDouble instead of atof.