Skip to content

Commit de50a6d

Browse files
committed
Small fixes
- Fixed compiler error in case #define N2K_NO_HEARTBEAT_SUPPORT 1 has been used. - Fixed priority setting test on tN2kGroupFunctionHandler::HandleCommand and tN2kGroupFunctionHandlerForPGN126998::HandleCommand - Fixed Mode setting on SetN2kPGN129540
1 parent 24913be commit de50a6d

7 files changed

Lines changed: 13 additions & 5 deletions

File tree

Documents/src/changes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changes to the Library {#changes}
22
\tableofcontents
33

4+
## 22.01.2024
5+
6+
- Fixed compiler error in case #define N2K_NO_HEARTBEAT_SUPPORT 1 has been used.
7+
- Fixed priority setting test on tN2kGroupFunctionHandler::HandleCommand and tN2kGroupFunctionHandlerForPGN126998::HandleCommand
8+
- Fixed Mode setting on SetN2kPGN129540
9+
410
## 21.01.2024
511

612
- Document update. Updates on document sources and code sources.

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"url": "http://www.kave.fi",
1414
"maintainer": true
1515
},
16-
"version": "4.20.1",
16+
"version": "4.20.2",
1717
"license": "MIT",
1818
"frameworks": "*",
1919
"platforms": "*"

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=NMEA2000
2-
version=4.20.1
2+
version=4.20.2
33
author=Timo Lappalainen
44
maintainer=Kave Oy <www.kave.fi>
55
sentence=NMEA 2000 library for building compatible devices for NMEA 2000 bus.

src/N2kGroupFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool tN2kGroupFunctionHandler::HandleCommand(const tN2kMsg &N2kMsg, uint8_t Prio
175175
tN2kGroupFunctionTransmissionOrPriorityErrorCode TORec=N2kgfTPec_Acknowledge;
176176
tN2kGroupFunctionParameterErrorCode PARec=N2kgfpec_Acknowledge;
177177

178-
if (PrioritySetting != 0x08 || PrioritySetting != 0x0f || PrioritySetting != 0x09) TORec = N2kgfTPec_TransmitIntervalOrPriorityNotSupported;
178+
if ( !(PrioritySetting == 0x08 || PrioritySetting == 0x0f || PrioritySetting == 0x09) ) TORec = N2kgfTPec_TransmitIntervalOrPriorityNotSupported;
179179

180180
SendAcknowledge(pNMEA2000,N2kMsg.Source,iDev,GetPGNForGroupFunction(N2kMsg),
181181
PGNec,

src/N2kGroupFunctionDefaultHandlers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ bool tN2kGroupFunctionHandlerForPGN126998::HandleCommand(const tN2kMsg &N2kMsg,
463463
tN2kGroupFunctionTransmissionOrPriorityErrorCode pec=N2kgfTPec_Acknowledge;
464464
tN2kMsg N2kRMsg;
465465

466-
if (PrioritySetting != 0x08 || PrioritySetting != 0x0f || PrioritySetting != 0x09) pec = N2kgfTPec_TransmitIntervalOrPriorityNotSupported;
466+
if ( !(PrioritySetting == 0x08 || PrioritySetting == 0x0f || PrioritySetting == 0x09) ) pec = N2kgfTPec_TransmitIntervalOrPriorityNotSupported;
467467

468468
SetStartAcknowledge(N2kRMsg,N2kMsg.Source,PGN,
469469
N2kgfPGNec_Acknowledge, // What we actually should response as PGN error, if we have invalid field?

src/N2kMessages.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ void SetN2kPGN129540(tN2kMsg& N2kMsg, unsigned char SID, tN2kRangeResidualMode M
12581258
N2kMsg.SetPGN(129540L);
12591259
N2kMsg.Priority=6;
12601260
N2kMsg.AddByte(SID);
1261-
N2kMsg.AddByte(0xfc || Mode);
1261+
N2kMsg.AddByte(0xfc | (Mode & 0x03) );
12621262
N2kMsg.AddByte(0); // Init satellite count to 0
12631263
}
12641264

src/NMEA2000.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,9 @@ bool tNMEA2000::Open() {
12311231
StartAddressClaim();
12321232
tN2kSyncScheduler::SetSyncOffset();
12331233
if ( OnOpen!=0 ) OnOpen();
1234+
#if !defined(N2K_NO_HEARTBEAT_SUPPORT)
12341235
SetHeartbeatIntervalAndOffset(DefaultHeartbeatInterval,10000); // Init default hearbeat interval and offset.
1236+
#endif
12351237
} else {
12361238
unsigned long canId;
12371239
unsigned char len = 0;

0 commit comments

Comments
 (0)