1
0
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:
Asbelos
2020-06-23 20:00:34 +01:00
parent e7e4d4fbd9
commit 030cb654b4
2 changed files with 7 additions and 1 deletions

View File

@@ -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