From 52a90288fd2b744b68d584db316fcf3fede84262 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Fri, 2 Apr 2021 16:56:14 +0200 Subject: 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. --- src/displayapp/screens/WatchFaceDigital.cpp | 8 ++++++-- src/displayapp/screens/WatchFaceDigital.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/displayapp/screens') 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); diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index e6514f1e..0f6a2f0c 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -50,6 +50,7 @@ namespace Pinetime { DirtyValue batteryPercentRemaining {}; DirtyValue bleState {}; DirtyValue> currentDateTime{}; + DirtyValue motionSensorOk {}; DirtyValue stepCount {}; DirtyValue heartbeat {}; DirtyValue heartbeatRunning {}; -- cgit v1.2.3-70-g09d2