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.

This commit is contained in:
Jean-François Milants
2021-04-02 16:56:14 +02:00
parent c7cc47ae30
commit 52a90288fd
7 changed files with 33 additions and 15 deletions

View File

@@ -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);