From 8a425fe0ef2b2851e57b7a4c01c2de753823cc0c Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 25 Mar 2023 19:28:37 +0100 Subject: [PATCH] do not broadcast a turnout state that has not changed 2 --- GITHUB_SHA.h | 2 +- Turnouts.cpp | 10 +++++----- version.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index 9a36e4a..8809d55 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202303251113Z" +#define GITHUB_SHA "devel-202303251828Z" diff --git a/Turnouts.cpp b/Turnouts.cpp index c02e97c..e8f55af 100644 --- a/Turnouts.cpp +++ b/Turnouts.cpp @@ -123,7 +123,7 @@ return true; } - +#define DIAG_IO // Static setClosed function is invoked from close(), throw() etc. to perform the // common parts of the turnout operation. Code which is specific to a turnout // type should be placed in the virtual function setClosedInternal(bool) which is @@ -289,7 +289,6 @@ #ifndef IO_NO_HAL IODevice::writeAnalogue(_servoTurnoutData.vpin, close ? _servoTurnoutData.closedPosition : _servoTurnoutData.thrownPosition, _servoTurnoutData.profile); - _turnoutData.closed = close; #else (void)close; // avoid compiler warnings #endif @@ -387,7 +386,6 @@ // and Close writes a 0. // RCN-213 specifies that Throw is 0 and Close is 1. DCC::setAccessory(_dccTurnoutData.address, _dccTurnoutData.subAddress, close ^ !rcn213Compliant); - _turnoutData.closed = close; return true; } @@ -463,7 +461,6 @@ bool VpinTurnout::setClosedInternal(bool close) { IODevice::write(_vpinTurnoutData.vpin, close); - _turnoutData.closed = close; return true; } @@ -514,7 +511,10 @@ bool LCNTurnout::setClosedInternal(bool close) { // Assume that the LCN command still uses 1 for throw and 0 for close... LCN::send('T', _turnoutData.id, !close); - // The _turnoutData.closed flag should be updated by a message from the LCN master, later. + // The _turnoutData.closed flag should be updated by a message from the LCN master. + // but in this implementation it is updated in setClosedStateOnly() instead. + // If the LCN master updates this, setClosedStateOnly() and all setClosedInternal() + // have to be updated accordingly so that the closed flag is only set once. return true; } diff --git a/version.h b/version.h index 6a597fe..d8c03cf 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,7 @@ #include "StringFormatter.h" -#define VERSION "4.2.36rc1" +#define VERSION "4.2.36rc2" // 4.2.36 - do not broadcast a turnout state that has not changed // 4.2.35 - add direct pin manipulation command // 4.2.34 - Completely fix EX-IOExpander analogue inputs