Add MotionService : expose step count and RAW X/Y/Z values to the host.
This commit is contained in:
parent
d1f50157c7
commit
60a49af886
8 changed files with 190 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue