diff options
| author | Finlay Davidson <finlay.davidson@coderclass.nl> | 2023-03-05 15:24:06 +0100 |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2023-03-09 10:17:03 +0200 |
| commit | 49ad5be7423f983804e65dd1571cc5dcea26babc (patch) | |
| tree | b55a0abf958926dada5fac1aa06c33f8bc680c0a | |
| parent | 76e79df375aca1b34a53eedc38bce7a3cda0a8a7 (diff) | |
motioncontroller: Fix clang-tidy warnings
Also move one-line functions to header.
| -rw-r--r-- | src/components/motion/MotionController.cpp | 10 | ||||
| -rw-r--r-- | src/components/motion/MotionController.h | 17 |
2 files changed, 12 insertions, 15 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index 5fc548be..5087504c 100644 --- a/src/components/motion/MotionController.cpp +++ b/src/components/motion/MotionController.cpp @@ -23,10 +23,10 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps) this->z = z; int32_t deltaSteps = nbSteps - this->nbSteps; - this->nbSteps = nbSteps; if (deltaSteps > 0) { currentTripSteps += deltaSteps; } + this->nbSteps = nbSteps; } bool MotionController::Should_RaiseWake(bool isSleeping) { @@ -61,10 +61,6 @@ bool MotionController::ShouldShakeWake(uint16_t thresh) { return accumulatedSpeed > thresh; } -void MotionController::IsSensorOk(bool isOk) { - isSensorOk = isOk; -} - void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) { switch (types) { case Drivers::Bma421::DeviceTypes::BMA421: @@ -78,7 +74,3 @@ void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) { break; } } - -void MotionController::SetService(Pinetime::Controllers::MotionService* service) { - this->service = service; -} diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index 126504a3..fce8b53f 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -50,7 +50,9 @@ namespace Pinetime { return accumulatedSpeed; } - void IsSensorOk(bool isOk); + void IsSensorOk(bool isOk) { + isSensorOk = isOk; + } bool IsSensorOk() const { return isSensorOk; @@ -61,21 +63,24 @@ namespace Pinetime { } void Init(Pinetime::Drivers::Bma421::DeviceTypes types); - void SetService(Pinetime::Controllers::MotionService* service); + + void SetService(Pinetime::Controllers::MotionService* service) { + this->service = service; + } private: - uint32_t nbSteps; + uint32_t nbSteps = 0; uint32_t currentTripSteps = 0; TickType_t lastTime = 0; TickType_t time = 0; - int16_t x; + int16_t x = 0; int16_t lastYForWakeUp = 0; int16_t lastY = 0; - int16_t y; + int16_t y = 0; int16_t lastZ = 0; - int16_t z; + int16_t z = 0; int32_t accumulatedSpeed = 0; bool isSensorOk = false; |
