summaryrefslogtreecommitdiff
path: root/src/components/motion/MotionController.cpp
diff options
context:
space:
mode:
authorStephanie <eng.steph@gmail.com>2021-10-22 03:37:35 (GMT)
committerJF <JF002@users.noreply.github.com>2021-12-30 20:51:43 (GMT)
commitf7d1b3f36847bcbd0699feeb8515bb6517690066 (patch)
tree690a297b78c10a421db90b7f950f8361a854661e /src/components/motion/MotionController.cpp
parentfb87fdb2d9720ce1bca2c4920b859658a6480167 (diff)
Moved trip meter update to MotionController and changed trip meter logic
Diffstat (limited to 'src/components/motion/MotionController.cpp')
-rw-r--r--src/components/motion/MotionController.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp
index cae4910..59114f4 100644
--- a/src/components/motion/MotionController.cpp
+++ b/src/components/motion/MotionController.cpp
@@ -14,7 +14,11 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps)
this->x = x;
this->y = y;
this->z = z;
+ deltaSteps = nbSteps - this->nbSteps;
this->nbSteps = nbSteps;
+ if(deltaSteps > 0){
+ currentTripSteps += deltaSteps;
+ }
}
bool MotionController::ShouldWakeUp(bool isSleeping) {