mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 13:21:23 +01:00
Merge branch 'RCN213-fixes' into master
This commit is contained in:
commit
b5af39dfc9
@ -372,7 +372,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
|||||||
|| ((p[activep] & 0x01) != p[activep]) // invalid activate 0|1
|
|| ((p[activep] & 0x01) != p[activep]) // 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_RCN_213
|
#ifdef DCC_ACCESSORY_COMMAND_REVERSE
|
||||||
DCC::setAccessory(address, subaddress,p[activep]==0);
|
DCC::setAccessory(address, subaddress,p[activep]==0);
|
||||||
#else
|
#else
|
||||||
DCC::setAccessory(address, subaddress,p[activep]==1);
|
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
|
// Device-specific write function. State 1=closed, 0=thrown. Adjust for RCN-213 compliance
|
||||||
void DCCAccessoryDecoder::_write(VPIN id, int state) {
|
void DCCAccessoryDecoder::_write(VPIN id, int state) {
|
||||||
int packedAddress = _packedAddress + id - _firstVpin;
|
int packedAddress = _packedAddress + id - _firstVpin;
|
||||||
#ifdef DIAG_IO
|
#if defined(HAL_ACCESSORY_COMMAND_REVERSE)
|
||||||
DIAG(F("DCC Write Linear Address:%d State:%d"), packedAddress, state);
|
|
||||||
#endif
|
|
||||||
#if !defined(DCC_ACCESSORY_RCN_213)
|
|
||||||
state = !state;
|
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
|
#endif
|
||||||
DCC::setAccessory(ADDRESS(packedAddress), SUBADDRESS(packedAddress), state);
|
DCC::setAccessory(ADDRESS(packedAddress), SUBADDRESS(packedAddress), state);
|
||||||
}
|
}
|
||||||
|
@ -162,10 +162,20 @@ The configuration file for DCC-EX Command Station
|
|||||||
// don't add it to your config.h.
|
// don't add it to your config.h.
|
||||||
//#define DCC_TURNOUTS_RCN_213
|
//#define DCC_TURNOUTS_RCN_213
|
||||||
|
|
||||||
// The following #define likewise inverts the behaviour of the <a> command
|
// By default, the driver which defines a DCC accessory decoder
|
||||||
// for triggering DCC Accessory Decoders, so that <a addr subaddr 0> generates a
|
// 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
|
// DCC packet with D=1 (close turnout) and <a addr subaddr 1> generates D=0
|
||||||
// (throw turnout).
|
// (throw turnout).
|
||||||
//#define DCC_ACCESSORY_RCN_213
|
//#define DCC_ACCESSORY_COMMAND_REVERSE
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user