summaryrefslogtreecommitdiff
path: root/src/components/motion/MotionController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/motion/MotionController.cpp')
-rw-r--r--src/components/motion/MotionController.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp
index 0404e3f..12c3514 100644
--- a/src/components/motion/MotionController.cpp
+++ b/src/components/motion/MotionController.cpp
@@ -1,3 +1,4 @@
+#include <cmath>
#include "components/motion/MotionController.h"
#include "os/os_cputime.h"
using namespace Pinetime::Controllers;
@@ -8,6 +9,13 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z) {
this->z = z;
}
+int16_t MotionController::G() {
+ float X = x; X *= X;
+ float Y = y; Y *= Y;
+ float Z = z; Z *= Z;
+ return (int16_t) std::sqrtf(X + Y + Z);
+}
+
bool MotionController::Should_RaiseWake(bool isSleeping) {
if ((x + 335) <= 670 && z < 0) {
if (not isSleeping) {