diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index 2593d33a..da553603 100644 --- a/src/components/motion/MotionController.cpp +++ b/src/components/motion/MotionController.cpp @@ -66,11 +66,12 @@ int32_t MotionController::currentShakeSpeed() { return accumulatedspeed; } -bool MotionController::ShouldSleep(bool isSleeping) { +bool MotionController::ShouldSleep() { bool ret = false; - if (y >= lastYForSleep + 192 && !isSleeping) + if (y >= lastYForSleep + 192) { ret = true; + } lastYForSleep = (y > 320) ? y : 320; diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index 0b9f5b18..3c8bca63 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -39,7 +39,7 @@ namespace Pinetime { bool Should_ShakeWake(uint16_t thresh); bool Should_RaiseWake(bool isSleeping); int32_t currentShakeSpeed(); - bool ShouldSleep(bool isSleeping); + bool ShouldSleep(); void IsSensorOk(bool isOk); bool IsSensorOk() const { return isSensorOk; diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index e9f90df8..545b8349 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -504,7 +504,7 @@ void SystemTask::UpdateMotion() { GoToRunning(); } if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::LowerWrist)) { - if (motionController.ShouldSleep(isSleeping)) + if (motionController.ShouldSleep() && !isSleeping) PushMessage(Messages::GoToSleep); } }