aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/motion/MotionController.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/motion/MotionController.h')
-rw-r--r--src/components/motion/MotionController.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h
index b2e7e7fe..be0241d3 100644
--- a/src/components/motion/MotionController.h
+++ b/src/components/motion/MotionController.h
@@ -21,7 +21,7 @@ namespace Pinetime {
void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps);
int16_t X() const {
- return x;
+ return xHistory[0];
}
int16_t Y() const {
@@ -76,11 +76,14 @@ namespace Pinetime {
struct AccelStats {
static constexpr uint8_t numHistory = 2;
+ int16_t xMean = 0;
int16_t yMean = 0;
int16_t zMean = 0;
+ int16_t prevXMean = 0;
int16_t prevYMean = 0;
int16_t prevZMean = 0;
+ uint32_t xVariance = 0;
uint32_t yVariance = 0;
uint32_t zVariance = 0;
};
@@ -89,9 +92,8 @@ namespace Pinetime {
AccelStats stats = {};
- int16_t lastX = 0;
- int16_t x = 0;
static constexpr uint8_t histSize = 8;
+ Utility::CircularBuffer<int16_t, histSize> xHistory = {};
Utility::CircularBuffer<int16_t, histSize> yHistory = {};
Utility::CircularBuffer<int16_t, histSize> zHistory = {};
int32_t accumulatedSpeed = 0;