mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-01-12 05:41:02 +01:00
Less confusion and simpler code around the RCN213 defines
This commit is contained in:
parent
13488e1e93
commit
3c725afab4
@ -402,7 +402,8 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
|||||||
|| (p[activep] > 1) || (p[activep] < 0) // invalid activate 0|1
|
|| (p[activep] > 1) || (p[activep] < 0) // invalid activate 0|1
|
||||||
) break;
|
) break;
|
||||||
// Honour the configuration option (config.h) which allows the <a> command to be reversed
|
// Honour the configuration option (config.h) which allows the <a> command to be reversed
|
||||||
#ifdef DCC_ACCESSORY_COMMAND_REVERSE
|
// Because of earlier confusion we need to do the same thing under both defines
|
||||||
|
#if defined(DCC_ACCESSORY_COMMAND_REVERSE) || defined(DCC_ACCESSORY_RCN_213)
|
||||||
DCC::setAccessory(address, subaddress,p[activep]==0,onoff);
|
DCC::setAccessory(address, subaddress,p[activep]==0,onoff);
|
||||||
#else
|
#else
|
||||||
DCC::setAccessory(address, subaddress,p[activep]==1,onoff);
|
DCC::setAccessory(address, subaddress,p[activep]==1,onoff);
|
||||||
|
11
Turnouts.cpp
11
Turnouts.cpp
@ -312,12 +312,6 @@
|
|||||||
*
|
*
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
|
|
||||||
#if defined(DCC_TURNOUTS_RCN_213)
|
|
||||||
const bool DCCTurnout::rcn213Compliant = true;
|
|
||||||
#else
|
|
||||||
const bool DCCTurnout::rcn213Compliant = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// DCCTurnoutData contains data specific to this subclass that is
|
// DCCTurnoutData contains data specific to this subclass that is
|
||||||
// written to EEPROM when the turnout is saved.
|
// written to EEPROM when the turnout is saved.
|
||||||
struct DCCTurnoutData {
|
struct DCCTurnoutData {
|
||||||
@ -385,7 +379,10 @@
|
|||||||
// DCC++ Classic behaviour is that Throw writes a 1 in the packet,
|
// DCC++ Classic behaviour is that Throw writes a 1 in the packet,
|
||||||
// and Close writes a 0.
|
// and Close writes a 0.
|
||||||
// RCN-213 specifies that Throw is 0 and Close is 1.
|
// RCN-213 specifies that Throw is 0 and Close is 1.
|
||||||
DCC::setAccessory(_dccTurnoutData.address, _dccTurnoutData.subAddress, close ^ !rcn213Compliant);
|
#if defined(DCC_TURNOUTS_RCN_213)
|
||||||
|
close = !close;
|
||||||
|
#endif
|
||||||
|
DCC::setAccessory(_dccTurnoutData.address, _dccTurnoutData.subAddress, close);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,8 +245,6 @@ public:
|
|||||||
// Load a VPIN turnout definition from EEPROM. The common Turnout data has already been read at this point.
|
// Load a VPIN turnout definition from EEPROM. The common Turnout data has already been read at this point.
|
||||||
static Turnout *load(struct TurnoutData *turnoutData);
|
static Turnout *load(struct TurnoutData *turnoutData);
|
||||||
void print(Print *stream) override;
|
void print(Print *stream) override;
|
||||||
// Flag whether DCC Accessory packets are to contain 1=close/0=throw(RCN-213) or 1=throw/0-close (DCC++ Classic)
|
|
||||||
static const bool rcn213Compliant;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool setClosedInternal(bool close) override;
|
bool setClosedInternal(bool close) override;
|
||||||
|
@ -269,9 +269,10 @@ The configuration file for DCC-EX Command Station
|
|||||||
// over DCC++. This #define likewise inverts the behaviour of the <a> command
|
// over DCC++. This #define likewise inverts the behaviour of the <a> command
|
||||||
// for triggering DCC Accessory Decoders, so that <a addr subaddr 0> generates a
|
// for triggering DCC Accessory Decoders, so that <a addr subaddr 0> generates a
|
||||||
// DCC packet with D=1 (close turnout) and <a addr subaddr 1> generates D=0
|
// DCC packet with D=1 (close turnout) and <a addr subaddr 1> generates D=0
|
||||||
// (throw turnout).
|
// (throw turnout). This is the same as DCC_ACCESSORY_COMMAND_REVERSE
|
||||||
//#define DCC_ACCESSORY_RCN_213
|
//#define DCC_ACCESSORY_RCN_213
|
||||||
//
|
|
||||||
|
|
||||||
// HANDLING MULTIPLE SERIAL THROTTLES
|
// HANDLING MULTIPLE SERIAL THROTTLES
|
||||||
// The command station always operates with the default Serial port.
|
// The command station always operates with the default Serial port.
|
||||||
// Diagnostics are only emitted on the default serial port and not broadcast.
|
// Diagnostics are only emitted on the default serial port and not broadcast.
|
||||||
|
Loading…
Reference in New Issue
Block a user