mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-17 06:29:15 +01:00
momentum range fix
This commit is contained in:
parent
2894a34591
commit
cda27f0420
3
DCC.cpp
3
DCC.cpp
@ -942,7 +942,8 @@ bool DCC::setMomentum(int locoId,int16_t accelerating, int16_t decelerating) {
|
|||||||
}
|
}
|
||||||
// -1 is ok and means this loco should use the default.
|
// -1 is ok and means this loco should use the default.
|
||||||
if (accelerating<-1 || decelerating<-1) return false;
|
if (accelerating<-1 || decelerating<-1) return false;
|
||||||
if (accelerating>2000 || decelerating>2000) return false;
|
if (accelerating/MOMENTUM_FACTOR >= MOMENTUM_USE_DEFAULT ||
|
||||||
|
decelerating/MOMENTUM_FACTOR >= MOMENTUM_USE_DEFAULT) return false;
|
||||||
|
|
||||||
// Values stored are 255=MOMENTUM_USE_DEFAULT, or millis/MOMENTUM_FACTOR.
|
// Values stored are 255=MOMENTUM_USE_DEFAULT, or millis/MOMENTUM_FACTOR.
|
||||||
// This is to keep the values in a byte rather than int16
|
// This is to keep the values in a byte rather than int16
|
||||||
|
Loading…
Reference in New Issue
Block a user