From d0309829020454435b57033608782eca7a305ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ndor=20R=C3=A1tkai?= Date: Sun, 8 Sep 2024 01:41:41 +0200 Subject: [PATCH] Introduce an alias for the step counter's type --- src/components/motion/MotionController.cpp | 2 +- src/components/motion/MotionController.h | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index 72507ac5..62801ce7 100644 --- a/src/components/motion/MotionController.cpp +++ b/src/components/motion/MotionController.cpp @@ -35,7 +35,7 @@ namespace { } } -void MotionController::Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps) { +void MotionController::Update(int16_t x, int16_t y, int16_t z, MotionController::step_t nbSteps) { if (this->nbSteps != nbSteps && service != nullptr) { service->OnNewStepCountValue(nbSteps); } diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index be0241d3..181c595b 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -18,7 +18,9 @@ namespace Pinetime { BMA425, }; - void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps); + using step_t = uint32_t; + + void Update(int16_t x, int16_t y, int16_t z, step_t nbSteps); int16_t X() const { return xHistory[0]; @@ -32,7 +34,7 @@ namespace Pinetime { return zHistory[0]; } - uint32_t NbSteps() const { + step_t NbSteps() const { return nbSteps; } @@ -40,7 +42,7 @@ namespace Pinetime { currentTripSteps = 0; } - uint32_t GetTripSteps() const { + step_t GetTripSteps() const { return currentTripSteps; } @@ -67,8 +69,8 @@ namespace Pinetime { } private: - uint32_t nbSteps = 0; - uint32_t currentTripSteps = 0; + step_t nbSteps = 0; + step_t currentTripSteps = 0; TickType_t lastTime = 0; TickType_t time = 0;