summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/motion/MotionController.h1
-rw-r--r--src/displayapp/screens/Motion.cpp2
-rw-r--r--src/systemtask/SystemTask.h14
3 files changed, 16 insertions, 1 deletions
diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h
index 06429c8..23410af 100644
--- a/src/components/motion/MotionController.h
+++ b/src/components/motion/MotionController.h
@@ -39,6 +39,7 @@ namespace Pinetime {
void Init(Pinetime::Drivers::Bma421::DeviceTypes types);
inline double GXYZ(double &X, double &Y, double &Z) const {
+
X = x; Y = y; Z = z;
return std::sqrt(X*X + Y*Y + Z*Z);
}
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index 79132ec..bd0191a 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -69,7 +69,7 @@ void Motion::Refresh() {
bool new_record = false;
bool jump_started_or_ended = false;
double X; double Y; double_t Z;
- double G = motionController.GXYZ(X,Y,Z);
+ double G = systemTask.ReadGXYZ(X,Y,Z);
// lv_chart_set_next(chart, ser2, motionController.Y());
// lv_chart_set_next(chart, ser3, motionController.Z());
TickType_t current_time = xTaskGetTickCount();
diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h
index cf15071..bd12005 100644
--- a/src/systemtask/SystemTask.h
+++ b/src/systemtask/SystemTask.h
@@ -140,6 +140,20 @@ namespace Pinetime {
static constexpr TickType_t batteryMeasurementPeriod = pdMS_TO_TICKS(10 * 60 * 1000);
SystemMonitor monitor;
+
+ public:
+ inline double ReadGXYZ(double &X, double &Y, double &Z) const {
+ auto motionValues = motionSensor.Process();
+ motionController.Update(motionValues.x, motionValues.y, motionValues.z);
+ X = motionValues.x; Y = motionValues.y; Z = motionValues.z;
+ return std::sqrt(X*X + Y*Y + Z*Z);
+ }
+
+ inline double ReadG() const {
+ double x, y, z;
+ return ReadGXYZ(x,y,z);
+ }
+
};
}
}