From d81a56aec7ed61006710b4704b3edad458be8b88 Mon Sep 17 00:00:00 2001 From: andreas Date: Sun, 24 Nov 2024 19:10:21 +0100 Subject: [PATCH] correctly handle invalid/empty fields in RMB message --- lib/nmea0183ton2k/NMEA0183DataToN2K.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/nmea0183ton2k/NMEA0183DataToN2K.cpp b/lib/nmea0183ton2k/NMEA0183DataToN2K.cpp index 668a8ef..cf335df 100644 --- a/lib/nmea0183ton2k/NMEA0183DataToN2K.cpp +++ b/lib/nmea0183ton2k/NMEA0183DataToN2K.cpp @@ -320,7 +320,7 @@ class NMEA0183DataToN2KFunctions : public NMEA0183DataToN2K return; } tN2kMsg n2kMsg; - if (boatData->XTE->update(rmb.xte,msg.sourceId)){ + if (updateDouble(boatData->XTE,rmb.xte,msg.sourceId)){ tN2kXTEMode mode=N2kxtem_Autonomous; if (msg.FieldCount() > 13){ const char *modeChar=msg.Field(13); @@ -331,10 +331,10 @@ class NMEA0183DataToN2KFunctions : public NMEA0183DataToN2K } uint8_t destinationId=getWaypointId(rmb.destID); uint8_t sourceId=getWaypointId(rmb.originID); - if (boatData->DTW->update(rmb.dtw,msg.sourceId) - && boatData->BTW->update(rmb.btw,msg.sourceId) - && boatData->WPLat->update(rmb.latitude,msg.sourceId) - && boatData->WPLon->update(rmb.longitude,msg.sourceId) + if (updateDouble(boatData->DTW,rmb.dtw,msg.sourceId) + && updateDouble(boatData->BTW,rmb.btw,msg.sourceId) + && updateDouble(boatData->WPLat,rmb.latitude,msg.sourceId) + && updateDouble(boatData->WPLon,rmb.longitude,msg.sourceId) ){ SetN2kNavigationInfo(n2kMsg,1,rmb.dtw,N2khr_true, false,