mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 15:46:14 +01:00
defines to reverse accessories and turnouts renamed
This commit is contained in:
parent
f05b3d1730
commit
fd43a9b88b
|
@ -368,7 +368,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
|||
|| ((p[activep] & 0x01) != p[activep]) // invalid activate 0|1
|
||||
) break;
|
||||
// Honour the configuration option (config.h) which allows the <a> command to be reversed
|
||||
#ifdef DCC_ACCESSORY_RCN_213
|
||||
#ifdef DCC_ACCESSORY_COMMAND_REVERSE
|
||||
DCC::setAccessory(address, subaddress,p[activep]==0);
|
||||
#else
|
||||
DCC::setAccessory(address, subaddress,p[activep]==1);
|
||||
|
|
|
@ -47,11 +47,15 @@ void DCCAccessoryDecoder::_begin() {
|
|||
// Device-specific write function. State 1=closed, 0=thrown. Adjust for RCN-213 compliance
|
||||
void DCCAccessoryDecoder::_write(VPIN id, int state) {
|
||||
int packedAddress = _packedAddress + id - _firstVpin;
|
||||
#ifdef DIAG_IO
|
||||
DIAG(F("DCC Write Linear Address:%d State:%d"), packedAddress, state);
|
||||
#endif
|
||||
#if !defined(DCC_ACCESSORY_RCN_213)
|
||||
#if defined(HAL_ACCESSORY_COMMAND_REVERSE)
|
||||
state = !state;
|
||||
#ifdef DIAG_IO
|
||||
DIAG(F("DCC Write Linear Address:%d State:%d (inverted)"), packedAddress, state);
|
||||
#endif
|
||||
#else
|
||||
#ifdef DIAG_IO
|
||||
DIAG(F("DCC Write Linear Address:%d State:%d"), packedAddress, state);
|
||||
#endif
|
||||
#endif
|
||||
DCC::setAccessory(ADDRESS(packedAddress), SUBADDRESS(packedAddress), state);
|
||||
}
|
||||
|
|
|
@ -141,10 +141,20 @@ The configuration file for DCC-EX Command Station
|
|||
// don't add it to your config.h.
|
||||
//#define DCC_TURNOUTS_RCN_213
|
||||
|
||||
// The following #define likewise inverts the behaviour of the <a> command
|
||||
// for triggering DCC Accessory Decoders, so that <a addr subaddr 0> generates a
|
||||
// By default, the driver which defines a DCC accessory decoder
|
||||
// does send out the same state change on the DCC packet as it
|
||||
// receives. This means a VPIN state=1 sends D=1 (close turnout
|
||||
// or signal green) in the DCC packet. This can be reversed if
|
||||
// necessary.
|
||||
//#define HAL_ACCESSORY_COMMAND_REVERSE
|
||||
|
||||
// If you have issues with that the direction of the accessory commands is
|
||||
// reversed (for example when converting from another CS to DCC-EX) then
|
||||
// you can use this to revese the sense of all accessory commmands sent
|
||||
// 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
|
||||
// DCC packet with D=1 (close turnout) and <a addr subaddr 1> generates D=0
|
||||
// (throw turnout).
|
||||
//#define DCC_ACCESSORY_RCN_213
|
||||
//#define DCC_ACCESSORY_COMMAND_REVERSE
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue
Block a user