mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-07-28 09:53:45 +02:00
Accessory command validations
This commit is contained in:
5
DCC.cpp
5
DCC.cpp
@@ -81,6 +81,11 @@ static void DCC::setFn( int cab, byte functionNumber, bool on) {
|
||||
}
|
||||
|
||||
void DCC::setAccessory(int address, byte number, bool activate) {
|
||||
// use masks to detect wrong values and do nothing
|
||||
if(address != address & 511)
|
||||
return;
|
||||
if(number != number & 3)
|
||||
return;
|
||||
byte b[2];
|
||||
|
||||
b[0] = address % 64 + 128; // first byte is of the form 10AAAAAA, where AAAAAA represent 6 least signifcant bits of accessory address
|
||||
|
Reference in New Issue
Block a user