Have isSleeping be checked by SystemTask, and fix incorrect array size

This commit is contained in:
Finlay Davidson 2021-11-14 01:31:29 +01:00
parent a6d9028f86
commit a90d44f664
3 changed files with 5 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}