Skip to content

Commit

Permalink
ParseN2kPGN129029: Initialize reference station to default values whe…
Browse files Browse the repository at this point in the history
…n there are no reference stations.
Andrei Errapart committed May 19, 2023
1 parent 6a72460 commit 8c4f644
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/N2kMessages.cpp
Original file line number Diff line number Diff line change
@@ -1186,6 +1186,10 @@ bool ParseN2kPGN129029(const tN2kMsg &N2kMsg, unsigned char &SID, uint16_t &Days
// Note that we return real number of stations, but we only have variabes for one.
vi=N2kMsg.Get2ByteUInt(Index); ReferenceStationType=(tN2kGNSStype)(vi & 0x0f); ReferenceSationID=(vi>>4);
AgeOfCorrection=N2kMsg.Get2ByteUDouble(0.01,Index);
} else {
ReferenceStationType = N2kGNSSt_GPS;
ReferenceSationID = N2kInt16NA;
AgeOfCorrection = N2kDoubleNA;
}

return true;
7 changes: 3 additions & 4 deletions src/N2kMessages.h
Original file line number Diff line number Diff line change
@@ -3157,10 +3157,9 @@ inline void SetN2kGNSS(tN2kMsg &N2kMsg, unsigned char SID, uint16_t DaysSince197
* This parameter group conveys a comprehensive set of Global Navigation
* Satellite System (GNSS) parameters, including position information.
*
* The parameters passed to ReferenceStationType, ReferenceStationID and AgeOfCorrection
* are unchanged when there are no reference stations present in the message.
* One way to handle it is to initialize the variables passed to N2kGNSSt_GPS,
* N2kInt16NA and N2kDoubleNA respectively, before calling this function.
* The parameters passed to ReferenceStationType, ReferenceStationID and
* AgeOfCorrection are set to N2kGNSSt_GPS, N2kInt16NA and N2kDoubleNA
* respectively, when there are no reference stations present in the message.
*
* \param N2kMsg Reference to a N2kMsg Object,
* \param SID Sequence ID. If your device is e.g. boat speed and

0 comments on commit 8c4f644

Please sign in to comment.