Skip to content

Commit

Permalink
correctly handle invalid/empty fields in RMB message
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas committed Nov 24, 2024
1 parent ca60d3f commit d81a56a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/nmea0183ton2k/NMEA0183DataToN2K.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand Down

0 comments on commit d81a56a

Please sign in to comment.