From f7d1b3f36847bcbd0699feeb8515bb6517690066 Mon Sep 17 00:00:00 2001 From: Stephanie Date: Thu, 21 Oct 2021 23:37:35 -0400 Subject: Moved trip meter update to MotionController and changed trip meter logic --- src/components/motion/MotionController.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/components/motion/MotionController.cpp') diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index cae49105..59114f4c 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) { -- cgit v1.2.3-70-g09d2