From cda27f04202b48dc7470967725326076b4d85290 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Mon, 5 Aug 2024 16:33:26 +0100 Subject: [PATCH] momentum range fix --- DCC.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DCC.cpp b/DCC.cpp index fabfe84c..0ea73b31 100644 --- a/DCC.cpp +++ b/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. 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