diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-03 21:53:27 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-03 21:53:27 (GMT) |
| commit | 603d1f38ca3caad0abed2e884bb36504a71b623e (patch) | |
| tree | c40ac3d66fe6a136887f2314d511136b509c35be | |
| parent | 96b982fd94b48e441ab3a582bfafc7410bf0cbb1 (diff) | |
Read accelerometer at 100 instead of 10 Hz
| -rw-r--r-- | src/components/motion/MotionController.h | 1 | ||||
| -rw-r--r-- | src/displayapp/screens/Motion.cpp | 2 | ||||
| -rw-r--r-- | src/systemtask/SystemTask.h | 14 |
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); + } + }; } } |
