1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

Make return type of DCC::getFn int8_t

This commit is contained in:
Harald Barth 2024-01-01 22:08:59 +01:00
parent 3ce9d2ec88
commit d899da5898
3 changed files with 3 additions and 3 deletions

View File

@ -238,7 +238,7 @@ void DCC::changeFn( int cab, int16_t functionNumber) {
// Report function state (used from withrottle protocol) // Report function state (used from withrottle protocol)
// returns 0 false, 1 true or -1 for do not know // returns 0 false, 1 true or -1 for do not know
int DCC::getFn( int cab, int16_t functionNumber) { int8_t DCC::getFn( int cab, int16_t functionNumber) {
if (cab<=0 || functionNumber>28) if (cab<=0 || functionNumber>28)
return -1; // unknown return -1; // unknown
int reg = lookupSpeedTable(cab); int reg = lookupSpeedTable(cab);

2
DCC.h
View File

@ -68,7 +68,7 @@ public:
static void setFunction(int cab, byte fByte, byte eByte); static void setFunction(int cab, byte fByte, byte eByte);
static bool setFn(int cab, int16_t functionNumber, bool on); static bool setFn(int cab, int16_t functionNumber, bool on);
static void changeFn(int cab, int16_t functionNumber); static void changeFn(int cab, int16_t functionNumber);
static int getFn(int cab, int16_t functionNumber); static int8_t getFn(int cab, int16_t functionNumber);
static uint32_t getFunctionMap(int cab); static uint32_t getFunctionMap(int cab);
static void updateGroupflags(byte &flags, int16_t functionNumber); static void updateGroupflags(byte &flags, int16_t functionNumber);
static void setAccessory(int address, byte port, bool gate, byte onoff = 2); static void setAccessory(int address, byte port, bool gate, byte onoff = 2);

View File

@ -618,7 +618,7 @@ void WiThrottle::sendFunctions(Print* stream, byte loco) {
#endif #endif
for(int fKey=0; fKey<fkeys; fKey++) { for(int fKey=0; fKey<fkeys; fKey++) {
int fstate=DCC::getFn(locoid,fKey); int8_t fstate=DCC::getFn(locoid,fKey);
if (fstate>=0) StringFormatter::send(stream,F("M%cA%c%d<;>F%d%d\n"),myLocos[loco].throttle,LorS(locoid),locoid,fstate,fKey); if (fstate>=0) StringFormatter::send(stream,F("M%cA%c%d<;>F%d%d\n"),myLocos[loco].throttle,LorS(locoid),locoid,fstate,fKey);
} }
} }