diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/motion/MotionController.cpp | 4 | ||||
| -rw-r--r-- | src/components/motion/MotionController.h | 3 | ||||
| -rw-r--r-- | src/components/settings/Settings.h | 13 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index 58a7f67..615ad26 100644 --- a/src/components/motion/MotionController.cpp +++ b/src/components/motion/MotionController.cpp @@ -45,12 +45,12 @@ bool MotionController::Should_RaiseWake(bool isSleeping) { return false; } -bool MotionController::Should_ShakeWake() { +bool MotionController::Should_ShakeWake(uint16_t thresh) { bool wake = false; auto diff = xTaskGetTickCount() - lastShakeTime; lastShakeTime = xTaskGetTickCount(); int32_t speed = std::abs(y + z - lastYForShake - lastZForShake) / diff * 10; - if (speed > 150) { // TODO move threshold to a setting + if (speed > thresh) { wake = true; } lastXForShake = x; diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index bd925cc..28f7d3a 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -35,7 +35,8 @@ namespace Pinetime { uint32_t GetTripSteps() const { return currentTripSteps; } - bool Should_ShakeWake(); + + bool Should_ShakeWake(uint16_t thresh); bool Should_RaiseWake(bool isSleeping); void IsSensorOk(bool isOk); diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 928d04c..a414573 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -109,10 +109,19 @@ namespace Pinetime { } settings.screenTimeOut = timeout; }; + uint32_t GetScreenTimeOut() const { return settings.screenTimeOut; }; + void SetShakeThreshold(uint16_t thresh){ + settings.shakeWakeThreshold = thresh; + } + + int16_t GetShakeThreshold() const{ + return settings.shakeWakeThreshold; + } + void setWakeUpMode(WakeUpMode wakeUp, bool enabled) { if (enabled != isWakeUpModeOn(wakeUp)) { settingsChanged = true; @@ -164,7 +173,7 @@ namespace Pinetime { private: Pinetime::Controllers::FS& fs; - static constexpr uint32_t settingsVersion = 0x0003; + static constexpr uint32_t settingsVersion = 0x0004; struct SettingsData { uint32_t version = settingsVersion; uint32_t stepsGoal = 10000; @@ -178,7 +187,7 @@ namespace Pinetime { PineTimeStyle PTS; std::bitset<4> wakeUpMode {0}; - + uint16_t shakeWakeThreshold = 300; Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium; }; |
