diff options
| author | Finlay Davidson <finlay.davidson@coderclass.nl> | 2023-03-05 14:44:05 +0100 |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2023-03-09 10:17:03 +0200 |
| commit | a43463762c7983a27d2a020a05a77dff5beb30c9 (patch) | |
| tree | b1b75621204117e6718e01c3469115c37cfca316 /src/components | |
| parent | 6cf6455313b9166b408d0edb5b369ba458b347a4 (diff) | |
shakewake: Simplify return code
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/motion/MotionController.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index c3b80a0e..aab8b9d4 100644 --- a/src/components/motion/MotionController.cpp +++ b/src/components/motion/MotionController.cpp @@ -50,7 +50,6 @@ bool MotionController::Should_RaiseWake(bool isSleeping) { } bool MotionController::ShouldShakeWake(uint16_t thresh) { - bool wake = false; auto diff = xTaskGetTickCount() - lastShakeTime; lastShakeTime = xTaskGetTickCount(); /* Currently Polling at 10hz, If this ever goes faster scalar and EMA might need adjusting */ @@ -59,10 +58,7 @@ bool MotionController::ShouldShakeWake(uint16_t thresh) { // implemented without floats as .25Alpha accumulatedSpeed = (speed / 5) + ((accumulatedSpeed / 5) * 4); - if (accumulatedSpeed > thresh) { - wake = true; - } - return wake; + return accumulatedSpeed > thresh; } void MotionController::IsSensorOk(bool isOk) { |
