aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/motion/MotionController.cpp
diff options
context:
space:
mode:
authorFinlay Davidson <finlay.davidson@coderclass.nl>2023-03-05 14:53:49 +0100
committerRiku Isokoski <riksu9000@gmail.com>2023-03-09 10:17:03 +0200
commitf993311830df3ebe1d6ff4022aa3019a55f9bbd7 (patch)
tree90ebe08968f510481d1b6b98d3af2e04369472f2 /src/components/motion/MotionController.cpp
parentada182336f8b0cff0db21118dbd4df864f818214 (diff)
shakewake: Fix names according to style guide
Diffstat (limited to 'src/components/motion/MotionController.cpp')
-rw-r--r--src/components/motion/MotionController.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp
index 8ba46814..29b30e36 100644
--- a/src/components/motion/MotionController.cpp
+++ b/src/components/motion/MotionController.cpp
@@ -43,17 +43,17 @@ bool MotionController::Should_RaiseWake(bool isSleeping) {
return false;
}
-bool MotionController::Should_ShakeWake(uint16_t thresh) {
+bool MotionController::ShouldShakeWake(uint16_t thresh) {
bool wake = false;
auto diff = xTaskGetTickCount() - lastShakeTime;
lastShakeTime = xTaskGetTickCount();
/* Currently Polling at 10hz, If this ever goes faster scalar and EMA might need adjusting */
int32_t speed = std::abs(z + (y / 2) + (x / 4) - lastYForShake - lastZForShake) / diff * 100;
- //(.2 * speed) + ((1 - .2) * accumulatedspeed);
+ //(.2 * speed) + ((1 - .2) * accumulatedSpeed);
// implemented without floats as .25Alpha
- accumulatedspeed = (speed / 5) + ((accumulatedspeed / 5) * 4);
+ accumulatedSpeed = (speed / 5) + ((accumulatedSpeed / 5) * 4);
- if (accumulatedspeed > thresh) {
+ if (accumulatedSpeed > thresh) {
wake = true;
}
lastXForShake = x / 4;
@@ -62,10 +62,6 @@ bool MotionController::Should_ShakeWake(uint16_t thresh) {
return wake;
}
-int32_t MotionController::currentShakeSpeed() {
- return accumulatedspeed;
-}
-
void MotionController::IsSensorOk(bool isOk) {
isSensorOk = isOk;
}