diff --git a/.gitignore b/.gitignore index 0474017b8d..81e49ae083 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,6 @@ Testing/Temporary/ #build files src/nRF5_SDK_15.3.0_59ac345 src/arm-none-eabi + +# clangd +.cache/ diff --git a/src/components/ble/MotionService.cpp b/src/components/ble/MotionService.cpp index 121ad3b08a..6ec089ab7d 100644 --- a/src/components/ble/MotionService.cpp +++ b/src/components/ble/MotionService.cpp @@ -119,3 +119,7 @@ void MotionService::UnsubscribeNotification(uint16_t connectionHandle, uint16_t else if (attributeHandle == motionValuesHandle) motionValuesNoficationEnabled = false; } + +bool MotionService::IsMotionNotificationSubscribed() const { + return motionValuesNoficationEnabled; +} diff --git a/src/components/ble/MotionService.h b/src/components/ble/MotionService.h index 1b4ac0a37e..b2a1b61ecf 100644 --- a/src/components/ble/MotionService.h +++ b/src/components/ble/MotionService.h @@ -22,6 +22,7 @@ namespace Pinetime { void SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle); void UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle); + bool IsMotionNotificationSubscribed() const; private: Pinetime::System::SystemTask& system; diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index 7dd321271c..233a2a0680 100644 --- a/src/components/motion/MotionController.cpp +++ b/src/components/motion/MotionController.cpp @@ -85,3 +85,7 @@ void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) { void MotionController::SetService(Pinetime::Controllers::MotionService* service) { this->service = service; } + +Pinetime::Controllers::MotionService* MotionController::GetService() const { + return this->service; +} diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index f80b11b994..9d40b87ffb 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -50,6 +50,7 @@ namespace Pinetime { void Init(Pinetime::Drivers::Bma421::DeviceTypes types); void SetService(Pinetime::Controllers::MotionService* service); + Pinetime::Controllers::MotionService* GetService() const; private: uint32_t nbSteps; @@ -69,4 +70,4 @@ namespace Pinetime { uint32_t lastShakeTime = 0; }; } -} \ No newline at end of file +} diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index d3f1278912..2303fbd024 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -469,7 +469,8 @@ void SystemTask::UpdateMotion() { } if (state == SystemTaskState::Sleeping && !(settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) || - settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake))) { + settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake) || + motionController.GetService()->IsMotionNotificationSubscribed())) { return; }