summaryrefslogtreecommitdiff
path: root/src/components/motion/MotionController.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-11-11 09:08:20 (GMT)
committerJean-François Milants <jf@codingfield.com>2021-11-11 09:08:20 (GMT)
commitf6d0ec49e6f2669c64729b081eb3342f02151f4a (patch)
tree7e21c83726bd3e0d18ec4ebe871274b1dbe2eb38 /src/components/motion/MotionController.cpp
parentf41aaad6836ae348d1b5b084b4533b636f516b93 (diff)
parenta57fda6ba4a29866083a1254ffdf92939d00e182 (diff)
Merge branch 'develop'
# Conflicts: # doc/buildAndProgram.md
Diffstat (limited to 'src/components/motion/MotionController.cpp')
-rw-r--r--src/components/motion/MotionController.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp
index b0dbada..a2384d7 100644
--- a/src/components/motion/MotionController.cpp
+++ b/src/components/motion/MotionController.cpp
@@ -3,6 +3,14 @@
using namespace Pinetime::Controllers;
void MotionController::Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps) {
+ if (this->nbSteps != nbSteps && service != nullptr) {
+ service->OnNewStepCountValue(nbSteps);
+ }
+
+ if(service != nullptr && (this->x != x || this->y != y || this->z != z)) {
+ service->OnNewMotionValues(x, y, z);
+ }
+
this->x = x;
this->y = y;
this->z = z;
@@ -41,3 +49,6 @@ void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) {
default: this->deviceType = DeviceTypes::Unknown; break;
}
}
+void MotionController::SetService(Pinetime::Controllers::MotionService* service) {
+ this->service = service;
+}