aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/motion
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/motion')
-rw-r--r--src/components/motion/MotionController.cpp8
-rw-r--r--src/components/motion/MotionController.h5
2 files changed, 10 insertions, 3 deletions
diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp
index 7dd32127..8ba46814 100644
--- a/src/components/motion/MotionController.cpp
+++ b/src/components/motion/MotionController.cpp
@@ -26,10 +26,9 @@ bool MotionController::Should_RaiseWake(bool isSleeping) {
if (not isSleeping) {
if (y <= 0) {
return false;
- } else {
- lastYForWakeUp = 0;
- return false;
}
+ lastYForWakeUp = 0;
+ return false;
}
if (y >= 0) {
@@ -62,6 +61,7 @@ bool MotionController::Should_ShakeWake(uint16_t thresh) {
lastZForShake = z;
return wake;
}
+
int32_t MotionController::currentShakeSpeed() {
return accumulatedspeed;
}
@@ -69,6 +69,7 @@ int32_t MotionController::currentShakeSpeed() {
void MotionController::IsSensorOk(bool isOk) {
isSensorOk = isOk;
}
+
void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) {
switch (types) {
case Drivers::Bma421::DeviceTypes::BMA421:
@@ -82,6 +83,7 @@ void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) {
break;
}
}
+
void MotionController::SetService(Pinetime::Controllers::MotionService* service) {
this->service = service;
}
diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h
index f80b11b9..857bd45a 100644
--- a/src/components/motion/MotionController.h
+++ b/src/components/motion/MotionController.h
@@ -19,12 +19,15 @@ namespace Pinetime {
int16_t X() const {
return x;
}
+
int16_t Y() const {
return y;
}
+
int16_t Z() const {
return z;
}
+
uint32_t NbSteps() const {
return nbSteps;
}
@@ -32,6 +35,7 @@ namespace Pinetime {
void ResetTrip() {
currentTripSteps = 0;
}
+
uint32_t GetTripSteps() const {
return currentTripSteps;
}
@@ -40,6 +44,7 @@ namespace Pinetime {
bool Should_RaiseWake(bool isSleeping);
int32_t currentShakeSpeed();
void IsSensorOk(bool isOk);
+
bool IsSensorOk() const {
return isSensorOk;
}