mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 01:56:14 +01:00
DCC getFn
This commit is contained in:
parent
576288ba9e
commit
3fe04c1a0e
9
DCC.cpp
9
DCC.cpp
|
@ -155,6 +155,15 @@ int DCC::changeFn( int cab, byte functionNumber, bool pressed) {
|
||||||
return funcstate;
|
return funcstate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DCC::getFn( int cab, byte functionNumber) {
|
||||||
|
if (cab<=0 || functionNumber>28) return -1; // unknown
|
||||||
|
int reg = lookupSpeedTable(cab);
|
||||||
|
if (reg<0) return -1;
|
||||||
|
|
||||||
|
unsigned long funcmask = (1UL<<functionNumber);
|
||||||
|
return (speedTable[reg].functions & funcmask)? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the group flag to say we have touched the particular group.
|
// Set the group flag to say we have touched the particular group.
|
||||||
// A group will be reminded only if it has been touched.
|
// A group will be reminded only if it has been touched.
|
||||||
void DCC::updateGroupflags(byte & flags, int functionNumber) {
|
void DCC::updateGroupflags(byte & flags, int functionNumber) {
|
||||||
|
|
1
DCC.h
1
DCC.h
|
@ -72,6 +72,7 @@ public:
|
||||||
static void setFunction(int cab, byte fByte, byte eByte);
|
static void setFunction(int cab, byte fByte, byte eByte);
|
||||||
static void setFn(int cab, byte functionNumber, bool on);
|
static void setFn(int cab, byte functionNumber, bool on);
|
||||||
static int changeFn(int cab, byte functionNumber, bool pressed);
|
static int changeFn(int cab, byte functionNumber, bool pressed);
|
||||||
|
static int getFn(int cab, byte functionNumber);
|
||||||
static void updateGroupflags(byte &flags, int functionNumber);
|
static void updateGroupflags(byte &flags, int functionNumber);
|
||||||
static void setAccessory(int aAdd, byte aNum, bool activate);
|
static void setAccessory(int aAdd, byte aNum, bool activate);
|
||||||
static bool writeTextPacket(byte *b, int nBytes);
|
static bool writeTextPacket(byte *b, int nBytes);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user