mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-03 12:55:03 +01:00
fix type and static warning step #3
This commit is contained in:
parent
67387d2dc3
commit
bf17f2018b
10
DCC.cpp
10
DCC.cpp
|
@ -138,7 +138,7 @@ void DCC::setFunctionInternal(int cab, byte byte1, byte byte2, byte count) {
|
||||||
|
|
||||||
// returns speed steps 0 to 127 (1 == emergency stop)
|
// returns speed steps 0 to 127 (1 == emergency stop)
|
||||||
// or -1 on "loco not found"
|
// or -1 on "loco not found"
|
||||||
static int8_t DCC::getThrottleSpeed(int cab) {
|
int8_t DCC::getThrottleSpeed(int cab) {
|
||||||
int reg=lookupSpeedTable(cab);
|
int reg=lookupSpeedTable(cab);
|
||||||
if (reg<0) return -1;
|
if (reg<0) return -1;
|
||||||
return speedTable[reg].speedCode & 0x7F;
|
return speedTable[reg].speedCode & 0x7F;
|
||||||
|
@ -146,7 +146,7 @@ static int8_t DCC::getThrottleSpeed(int cab) {
|
||||||
|
|
||||||
// returns speed code byte
|
// returns speed code byte
|
||||||
// or 128 (speed 0, dir forward) on "loco not found".
|
// or 128 (speed 0, dir forward) on "loco not found".
|
||||||
static uint8_t DCC::getThrottleSpeedByte(int cab) {
|
uint8_t DCC::getThrottleSpeedByte(int cab) {
|
||||||
int reg=lookupSpeedTable(cab);
|
int reg=lookupSpeedTable(cab);
|
||||||
if (reg<0)
|
if (reg<0)
|
||||||
return 128;
|
return 128;
|
||||||
|
@ -154,7 +154,7 @@ static uint8_t DCC::getThrottleSpeedByte(int cab) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns -1 for fault, 0 to 3 for frequency
|
// returns -1 for fault, 0 to 3 for frequency
|
||||||
static int8_t DCC::getThrottleFrequency(int cab) {
|
int8_t DCC::getThrottleFrequency(int cab) {
|
||||||
int reg=lookupSpeedTable(cab);
|
int reg=lookupSpeedTable(cab);
|
||||||
if (reg<0)
|
if (reg<0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -199,8 +199,8 @@ bool DCC::setFn( int cab, int16_t functionNumber, bool on) {
|
||||||
|
|
||||||
// Take care of functions:
|
// Take care of functions:
|
||||||
// Set state of function
|
// Set state of function
|
||||||
unsigned long previous=speedTable[reg].functions;
|
uint32_t previous=speedTable[reg].functions;
|
||||||
unsigned long funcmask = (1UL<<functionNumber);
|
uint32_t funcmask = (1UL<<functionNumber);
|
||||||
if (on) {
|
if (on) {
|
||||||
speedTable[reg].functions |= funcmask;
|
speedTable[reg].functions |= funcmask;
|
||||||
} else {
|
} else {
|
||||||
|
|
2
DCC.h
2
DCC.h
|
@ -99,7 +99,7 @@ public:
|
||||||
int loco;
|
int loco;
|
||||||
byte speedCode;
|
byte speedCode;
|
||||||
byte groupFlags;
|
byte groupFlags;
|
||||||
unsigned long functions;
|
uint32_t functions;
|
||||||
};
|
};
|
||||||
static LOCO speedTable[MAX_LOCOS];
|
static LOCO speedTable[MAX_LOCOS];
|
||||||
static int lookupSpeedTable(int locoId, bool autoCreate=true);
|
static int lookupSpeedTable(int locoId, bool autoCreate=true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user