Skip to content

Commit

Permalink
Fix parsing of RMC NMEA 4.1 (#57204)
Browse files Browse the repository at this point in the history
  • Loading branch information
bettellam committed May 1, 2024
1 parent b6f929e commit 1c2250a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions external/nmea/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,14 @@ int nmea_parse_GPRMC( const char *buff, int buff_sz, nmeaGPRMC *pack )
nmea_trace_buff( buff, buff_sz );

nsen = nmea_scanf( buff, buff_sz,
"$G%CRMC,%s,%C,%f,%C,%f,%C,%f,%f,%2d%2d%2d,%f,%C,%C*",
"$G%CRMC,%s,%C,%f,%C,%f,%C,%f,%f,%2d%2d%2d,%f,%C,%C,%C*",
&( type ), &( time_buff[0] ),
&( pack->status ), &( pack->lat ), &( pack->ns ), &( pack->lon ), &( pack->ew ),
&( pack->speed ), &( pack->direction ),
&( pack->utc.day ), &( pack->utc.mon ), &( pack->utc.year ),
&( pack->declination ), &( pack->declin_ew ), &( pack->mode ) );
&( pack->declination ), &( pack->declin_ew ), &( pack->mode ), &( pack->navstatus ) );

if ( nsen != 14 && nsen != 15 )
if ( nsen < 14 || nsen > 16 )
{
nmea_error( "G?RMC parse error!" );
return 0;
Expand Down
2 changes: 1 addition & 1 deletion external/nmea/sentence.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ typedef struct _nmeaGPRMC
double declination; //!< Magnetic variation degrees (Easterly var. subtracts from true course)
char declin_ew; //!< [E]ast or [W]est
char mode; //!< Mode indicator of fix type (A = autonomous, D = differential, E = estimated, N = not valid, S = simulator)

char navstatus; //!< NMEA v4.1 - Navigation Status type (S = Safe, C = Caution, U = Unsafe, V = Navigational status not valid)
} nmeaGPRMC;

/**
Expand Down

0 comments on commit 1c2250a

Please sign in to comment.