Skip to content

Commit

Permalink
[gps] Don't treat n/a values as '0'
Browse files Browse the repository at this point in the history
Avoids reporting things like an unavailable heading as a real "0" heading
  • Loading branch information
nyalldawson committed Dec 5, 2019
1 parent 6b5f983 commit 382098e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions external/nmea/tok.c
Expand Up @@ -43,6 +43,7 @@
#include <string.h>
#include <limits.h>
#include <locale.h>
#include <math.h>

#define NMEA_TOKS_COMPARE (1)
#define NMEA_TOKS_PERCENT (2)
Expand Down Expand Up @@ -241,6 +242,10 @@ int nmea_scanf( const char *buff, int buff_sz, const char *format, ... )
parg_target = ( void * )va_arg( arg_ptr, double * );
if ( width && 0 != ( parg_target ) )
*( ( double * )parg_target ) = nmea_atof( beg_tok, width );
else if ( width == 0 && 0 != ( parg_target ) )
{
*( ( double * )parg_target ) = NAN;
}
break;
};

Expand Down

0 comments on commit 382098e

Please sign in to comment.