From a6292f2fd14a940f9b002338fe221543c7169bde Mon Sep 17 00:00:00 2001 From: Sivert Havso Date: Thu, 3 Feb 2022 14:09:00 +0000 Subject: [PATCH 1/3] Update VTG.HPP for NMEA0183 ver 2.3 and later --- VTG.HPP | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/VTG.HPP b/VTG.HPP index 6b20a7a..88f34e6 100644 --- a/VTG.HPP +++ b/VTG.HPP @@ -44,10 +44,11 @@ class VTG : public RESPONSE ** Data */ - double TrackDegreesTrue{ 0.0 }; - double TrackDegreesMagnetic{ 0.0 }; - double SpeedKnots{ 0.0 }; - double SpeedKilometersPerHour{ 0.0 }; + double TrackDegreesTrue{ 0.0 }; + double TrackDegreesMagnetic{ 0.0 }; + double SpeedKnots{ 0.0 }; + double SpeedKilometersPerHour{ 0.0 }; + FAA_MODE FAAMode{ FAA_MODE::ModeUnknown }; /* ** Methods From 8ea77041ec125645fc0ce604e4f083742ec4b34f Mon Sep 17 00:00:00 2001 From: Sivert Havso Date: Thu, 3 Feb 2022 14:11:28 +0000 Subject: [PATCH 2/3] Update VTG.CPP for NMEA0183 ver 2.3 and later --- VTG.CPP | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/VTG.CPP b/VTG.CPP index 44a04ed..983cb50 100644 --- a/VTG.CPP +++ b/VTG.CPP @@ -65,12 +65,31 @@ bool VTG::Parse( SENTENCE const& sentence ) noexcept /* ** First we check the checksum... */ + + int checksum_field = 9; + + // Version 2.3 of the standard has things different + + FAAMode = sentence.FAAMode(9); + + if (FAAMode != FAA_MODE::ModeUnknown) + { + checksum_field = 10; + } + + auto const check = sentence.IsChecksumBad(checksum_field); - if ( sentence.IsChecksumBad( 9 ) == NMEA0183_BOOLEAN::True ) + if ( check == NMEA0183_BOOLEAN::True ) { SetErrorMessage(STRING_VIEW("Invalid Checksum")); return( false ); - } + } + + if (check == NMEA0183_BOOLEAN::NMEA_Unknown) + { + SetErrorMessage(STRING_VIEW("Missing Checksum")); + return(false); + } TrackDegreesTrue = sentence.Double( 1 ); TrackDegreesMagnetic = sentence.Double( 3 ); @@ -108,6 +127,7 @@ VTG const& VTG::operator = ( VTG const& source ) noexcept TrackDegreesMagnetic = source.TrackDegreesMagnetic; SpeedKnots = source.SpeedKnots; SpeedKilometersPerHour = source.SpeedKilometersPerHour; + FAAMode = source.FAAMode; return( *this ); } From 2e7edb57a97981a9fe0415417829843b939f35bc Mon Sep 17 00:00:00 2001 From: Sivert Havso Date: Thu, 3 Feb 2022 14:13:47 +0000 Subject: [PATCH 3/3] Add missing assignment for FAA mode --- RMC.CPP | 1 + 1 file changed, 1 insertion(+) diff --git a/RMC.CPP b/RMC.CPP index fd7f785..40a7949 100644 --- a/RMC.CPP +++ b/RMC.CPP @@ -163,6 +163,7 @@ RMC const& RMC::operator = ( RMC const& source ) noexcept Date = source.Date; MagneticVariation = source.MagneticVariation; MagneticVariationDirection = source.MagneticVariationDirection; + FAAMode = source.FAAMode; return( *this ); }