summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-04-02 14:56:14 (GMT)
committerJean-François Milants <jf@codingfield.com>2021-04-04 13:56:11 (GMT)
commit52a90288fd2b744b68d584db316fcf3fede84262 (patch)
treec349c0bbc00c88d1c271604ba84f5e528e093330 /src/displayapp
parentc7cc47ae306b8012c196587f156519b0773aef93 (diff)
Handle return code from BMA driver, and set a flag is the initialization fails. This allows to boot InfiniTime even if the device cannot initialize.
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp8
-rw-r--r--src/displayapp/screens/WatchFaceDigital.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index 2204e17..2dd89bb 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -240,9 +240,13 @@ bool WatchFaceDigital::Refresh() {
}
stepCount = motionController.NbSteps();
- if(stepCount.IsUpdated()) {
+ motionSensorOk = motionController.IsSensorOk();
+ if(stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
char stepBuffer[5];
- sprintf(stepBuffer, "%lu", stepCount.Get());
+ if(motionSensorOk.Get())
+ sprintf(stepBuffer, "%lu", stepCount.Get());
+ else
+ sprintf(stepBuffer, "---", stepCount.Get());
lv_label_set_text(stepValue, stepBuffer);
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h
index e6514f1..0f6a2f0 100644
--- a/src/displayapp/screens/WatchFaceDigital.h
+++ b/src/displayapp/screens/WatchFaceDigital.h
@@ -50,6 +50,7 @@ namespace Pinetime {
DirtyValue<int> batteryPercentRemaining {};
DirtyValue<bool> bleState {};
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime{};
+ DirtyValue<bool> motionSensorOk {};
DirtyValue<uint32_t> stepCount {};
DirtyValue<uint8_t> heartbeat {};
DirtyValue<bool> heartbeatRunning {};