mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-03-14 18:13:09 +01:00
do not broadcast a turnout state that has not changed
This commit is contained in:
parent
51a480dff3
commit
1ec378281b
@ -1 +1 @@
|
|||||||
#define GITHUB_SHA "devel-202303202024Z"
|
#define GITHUB_SHA "devel-202303251113Z"
|
||||||
|
35
Turnouts.cpp
35
Turnouts.cpp
@ -110,15 +110,16 @@
|
|||||||
/* static */ bool Turnout::setClosedStateOnly(uint16_t id, bool closeFlag) {
|
/* static */ bool Turnout::setClosedStateOnly(uint16_t id, bool closeFlag) {
|
||||||
Turnout *tt = get(id);
|
Turnout *tt = get(id);
|
||||||
if (!tt) return false;
|
if (!tt) return false;
|
||||||
tt->_turnoutData.closed = closeFlag;
|
|
||||||
|
|
||||||
// I know it says setClosedStateOnly, but we need to tell others
|
// I know it says setClosedStateOnly, but we need to tell others
|
||||||
// that the state has changed too.
|
// that the state has changed too. But we only broadcast if there
|
||||||
#if defined(EXRAIL_ACTIVE)
|
// really has been a change.
|
||||||
RMFT2::turnoutEvent(id, closeFlag);
|
if (tt->_turnoutData.closed != closeFlag) {
|
||||||
#endif
|
tt->_turnoutData.closed = closeFlag;
|
||||||
|
CommandDistributor::broadcastTurnout(id, closeFlag);
|
||||||
CommandDistributor::broadcastTurnout(id, closeFlag);
|
}
|
||||||
|
#if defined(EXRAIL_ACTIVE)
|
||||||
|
RMFT2::turnoutEvent(id, closeFlag);
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,31 +129,21 @@
|
|||||||
// type should be placed in the virtual function setClosedInternal(bool) which is
|
// type should be placed in the virtual function setClosedInternal(bool) which is
|
||||||
// called from here.
|
// called from here.
|
||||||
/* static */ bool Turnout::setClosed(uint16_t id, bool closeFlag) {
|
/* static */ bool Turnout::setClosed(uint16_t id, bool closeFlag) {
|
||||||
#if defined(DIAG_IO)
|
#if defined(DIAG_IO)
|
||||||
if (closeFlag)
|
DIAG(F("Turnout(%d,%c)"), id, closeFlag ? 'c':'t');
|
||||||
DIAG(F("Turnout::close(%d)"), id);
|
#endif
|
||||||
else
|
|
||||||
DIAG(F("Turnout::throw(%d)"), id);
|
|
||||||
#endif
|
|
||||||
Turnout *tt = Turnout::get(id);
|
Turnout *tt = Turnout::get(id);
|
||||||
if (!tt) return false;
|
if (!tt) return false;
|
||||||
bool ok = tt->setClosedInternal(closeFlag);
|
bool ok = tt->setClosedInternal(closeFlag);
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
tt->setClosedStateOnly(id, closeFlag);
|
||||||
#ifndef DISABLE_EEPROM
|
#ifndef DISABLE_EEPROM
|
||||||
// Write byte containing new closed/thrown state to EEPROM if required. Note that eepromAddress
|
// Write byte containing new closed/thrown state to EEPROM if required. Note that eepromAddress
|
||||||
// is always zero for LCN turnouts.
|
// is always zero for LCN turnouts.
|
||||||
if (EEStore::eeStore->data.nTurnouts > 0 && tt->_eepromAddress > 0)
|
if (EEStore::eeStore->data.nTurnouts > 0 && tt->_eepromAddress > 0)
|
||||||
EEPROM.put(tt->_eepromAddress, tt->_turnoutData.flags);
|
EEPROM.put(tt->_eepromAddress, tt->_turnoutData.flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(EXRAIL_ACTIVE)
|
|
||||||
RMFT2::turnoutEvent(id, closeFlag);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Send message to JMRI etc.
|
|
||||||
CommandDistributor::broadcastTurnout(id, closeFlag);
|
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "4.2.35"
|
#define VERSION "4.2.36rc1"
|
||||||
|
// 4.2.36 - do not broadcast a turnout state that has not changed
|
||||||
// 4.2.35 - add <z> direct pin manipulation command
|
// 4.2.35 - add <z> direct pin manipulation command
|
||||||
// 4.2.34 - Completely fix EX-IOExpander analogue inputs
|
// 4.2.34 - Completely fix EX-IOExpander analogue inputs
|
||||||
// 4.2.33 - Fix EX-IOExpander non-working analogue inputs
|
// 4.2.33 - Fix EX-IOExpander non-working analogue inputs
|
||||||
|
Loading…
Reference in New Issue
Block a user