Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ttlappalainen committed Jan 22, 2024
1 parent 24913be commit de50a6d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Documents/src/changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changes to the Library {#changes}
\tableofcontents

## 22.01.2024

- 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

## 21.01.2024

- Document update. Updates on document sources and code sources.
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "http://www.kave.fi",
"maintainer": true
},
"version": "4.20.1",
"version": "4.20.2",
"license": "MIT",
"frameworks": "*",
"platforms": "*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=NMEA2000
version=4.20.1
version=4.20.2
author=Timo Lappalainen
maintainer=Kave Oy <www.kave.fi>
sentence=NMEA 2000 library for building compatible devices for NMEA 2000 bus.
Expand Down
2 changes: 1 addition & 1 deletion src/N2kGroupFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ bool tN2kGroupFunctionHandler::HandleCommand(const tN2kMsg &N2kMsg, uint8_t Prio
tN2kGroupFunctionTransmissionOrPriorityErrorCode TORec=N2kgfTPec_Acknowledge;
tN2kGroupFunctionParameterErrorCode PARec=N2kgfpec_Acknowledge;

if (PrioritySetting != 0x08 || PrioritySetting != 0x0f || PrioritySetting != 0x09) TORec = N2kgfTPec_TransmitIntervalOrPriorityNotSupported;
if ( !(PrioritySetting == 0x08 || PrioritySetting == 0x0f || PrioritySetting == 0x09) ) TORec = N2kgfTPec_TransmitIntervalOrPriorityNotSupported;

SendAcknowledge(pNMEA2000,N2kMsg.Source,iDev,GetPGNForGroupFunction(N2kMsg),
PGNec,
Expand Down
2 changes: 1 addition & 1 deletion src/N2kGroupFunctionDefaultHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ bool tN2kGroupFunctionHandlerForPGN126998::HandleCommand(const tN2kMsg &N2kMsg,
tN2kGroupFunctionTransmissionOrPriorityErrorCode pec=N2kgfTPec_Acknowledge;
tN2kMsg N2kRMsg;

if (PrioritySetting != 0x08 || PrioritySetting != 0x0f || PrioritySetting != 0x09) pec = N2kgfTPec_TransmitIntervalOrPriorityNotSupported;
if ( !(PrioritySetting == 0x08 || PrioritySetting == 0x0f || PrioritySetting == 0x09) ) pec = N2kgfTPec_TransmitIntervalOrPriorityNotSupported;

SetStartAcknowledge(N2kRMsg,N2kMsg.Source,PGN,
N2kgfPGNec_Acknowledge, // What we actually should response as PGN error, if we have invalid field?
Expand Down
2 changes: 1 addition & 1 deletion src/N2kMessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ void SetN2kPGN129540(tN2kMsg& N2kMsg, unsigned char SID, tN2kRangeResidualMode M
N2kMsg.SetPGN(129540L);
N2kMsg.Priority=6;
N2kMsg.AddByte(SID);
N2kMsg.AddByte(0xfc || Mode);
N2kMsg.AddByte(0xfc | (Mode & 0x03) );
N2kMsg.AddByte(0); // Init satellite count to 0
}

Expand Down
2 changes: 2 additions & 0 deletions src/NMEA2000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,9 @@ bool tNMEA2000::Open() {
StartAddressClaim();
tN2kSyncScheduler::SetSyncOffset();
if ( OnOpen!=0 ) OnOpen();
#if !defined(N2K_NO_HEARTBEAT_SUPPORT)
SetHeartbeatIntervalAndOffset(DefaultHeartbeatInterval,10000); // Init default hearbeat interval and offset.
#endif
} else {
unsigned long canId;
unsigned char len = 0;
Expand Down

0 comments on commit de50a6d

Please sign in to comment.