diff options
| author | Kieran Cawthray <kieranc@gmail.com> | 2021-11-07 16:49:54 (GMT) |
|---|---|---|
| committer | Kieran Cawthray <kieranc@gmail.com> | 2021-11-07 16:49:54 (GMT) |
| commit | 18e3cc7038d0f6c0cebc5d042e0740f968f890db (patch) | |
| tree | 4fd50ddece4d92c06ea0e16cc06902703a2b6202 /src/components/motion/MotionController.cpp | |
| parent | 85d494a987e8edfd51fbb0eb6dfa04ea108cbb48 (diff) | |
| parent | 4a5b5f954f12de1574af8e3efec094bb4bdbb542 (diff) | |
Merge remote-tracking branch 'upstream/develop' into pts-settings
Diffstat (limited to 'src/components/motion/MotionController.cpp')
| -rw-r--r-- | src/components/motion/MotionController.cpp | 11 |
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; +} |
