1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00

momentum range fix

This commit is contained in:
Asbelos 2024-08-05 16:33:26 +01:00
parent 2894a34591
commit cda27f0420

View File

@ -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.
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.
// This is to keep the values in a byte rather than int16