Fix parsing of RMC NMEA 4.1 (#57204)

This commit is contained in:
Mauro Bettella 2024-05-01 14:40:05 +02:00 committed by GitHub
parent b6f929e5d5
commit 1c2250ad64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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;
/**