summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/WatchFaceDigital.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens/WatchFaceDigital.cpp')
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index 6fe076c5..c085b0b4 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -11,6 +11,7 @@
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
#include "components/heartrate/HeartRateController.h"
+#include "components/motion/MotionController.h"
#include "components/settings/Settings.h"
#include "../DisplayApp.h"
@@ -23,11 +24,13 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
Controllers::Ble& bleController,
Controllers::NotificationManager& notificatioManager,
Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController): Screen(app), currentDateTime{{}},
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController) : Screen(app), currentDateTime{{}},
dateTimeController{dateTimeController}, batteryController{batteryController},
bleController{bleController}, notificatioManager{notificatioManager},
settingsController{settingsController},
- heartRateController{heartRateController} {
+ heartRateController{heartRateController},
+ motionController{motionController} {
settingsController.SetClockFace(0);
displayedChar[0] = 0;
@@ -236,10 +239,14 @@ bool WatchFaceDigital::Refresh() {
lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
}
- // TODO stepCount = stepController.GetValue();
- if(stepCount.IsUpdated()) {
+ stepCount = motionController.NbSteps();
+ 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);