diff options
author | Tim Keller <geekboy1011@gmail.com> | 2021-09-28 03:50:08 +0000 |
---|---|---|
committer | Tim Keller <geekboy1011@gmail.com> | 2022-01-04 02:00:02 +0000 |
commit | d2510d7926227df36ff0dcb9fe1b5ea9d586596c (patch) | |
tree | 43cf0d085c203ddecf5abe8d975071ad04e9f763 /src/components | |
parent | 6d748206983ca1ae7c929fba58d62ddfdb365650 (diff) |
Better Sensitivity UI, Calibration button added
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/motion/MotionController.cpp | 13 | ||||
-rw-r--r-- | src/components/motion/MotionController.h | 2 | ||||
-rw-r--r-- | src/components/settings/Settings.h | 3 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index 4843f304..d26fffd0 100644 --- a/src/components/motion/MotionController.cpp +++ b/src/components/motion/MotionController.cpp @@ -1,6 +1,5 @@ #include "components/motion/MotionController.h" #include "os/os_cputime.h" - using namespace Pinetime::Controllers; void MotionController::Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps) { @@ -49,18 +48,22 @@ 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; + int32_t speed = std::abs(z + (y/2) + (x/4)- lastYForShake - lastZForShake) / diff * 100; //(.2 * speed) + ((1 - .2) * accumulatedspeed); //implemented without floats as .25Alpha - accumulatedspeed = (speed/4) + ((accumulatedspeed/4)*3); + accumulatedspeed = (speed/5) + ((accumulatedspeed/5)*4); + if (accumulatedspeed > thresh) { wake = true; } - lastXForShake = x; - lastYForShake = y; + lastXForShake = x/4; + lastYForShake = y/2; lastZForShake = z; return wake; } +int32_t MotionController::currentShakeSpeed(){ + return accumulatedspeed; +} void MotionController::IsSensorOk(bool isOk) { isSensorOk = isOk; diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index aee9e63f..f80b11b9 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -38,7 +38,7 @@ namespace Pinetime { bool Should_ShakeWake(uint16_t thresh); bool Should_RaiseWake(bool isSleeping); - + int32_t currentShakeSpeed(); void IsSensorOk(bool isOk); bool IsSensorOk() const { return isSensorOk; diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 5c3d2f4d..e623f3a5 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -136,8 +136,7 @@ namespace Pinetime { case WakeUpMode::DoubleTap: settings.wakeUpMode.set(static_cast<size_t>(WakeUpMode::SingleTap), false); break; - case WakeUpMode::RaiseWrist: - case WakeUpMode::Shake: + default: break; } } |