summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/WatchFaceDigital.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-04-02 16:56:14 +0200
committerJean-François Milants <jf@codingfield.com>2021-04-04 15:56:11 +0200
commit52a90288fd2b744b68d584db316fcf3fede84262 (patch)
treec349c0bbc00c88d1c271604ba84f5e528e093330 /src/displayapp/screens/WatchFaceDigital.cpp
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/screens/WatchFaceDigital.cpp')
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index 2204e177..2dd89bb4 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);