Skip to content

Commit

Permalink
momentum range fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Asbelos committed Aug 5, 2024
1 parent 2894a34 commit cda27f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion DCC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cda27f0

Please sign in to comment.