diff options
| author | JF002 <JF002@users.noreply.github.com> | 2021-01-20 20:11:56 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-20 20:11:56 +0000 |
| commit | a0f2fa8469f3a2c0f5f2f914ad174029da321cc0 (patch) | |
| tree | 4ac5f59cd088aea9af51d2d183376de279808e63 /src/displayapp/screens/Clock.cpp | |
| parent | 35d4f6d4875b68ff8fdecb436e3bc0a6f91099f3 (diff) | |
| parent | 68674cec53e2e2add1c0a0b109e5a0e7d9ed5479 (diff) | |
Merge pull request #169 from JF002/heartRateSensor
Heart rate sensor
Diffstat (limited to 'src/displayapp/screens/Clock.cpp')
| -rw-r--r-- | src/displayapp/screens/Clock.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 57659141..2988922e 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -10,6 +10,7 @@ #include "components/battery/BatteryController.h" #include "components/ble/BleController.h" #include "components/ble/NotificationManager.h" +#include "components/heartrate/HeartRateController.h" #include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; @@ -26,9 +27,11 @@ Clock::Clock(DisplayApp* app, Controllers::DateTime& dateTimeController, Controllers::Battery& batteryController, Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager) : Screen(app), currentDateTime{{}}, + Controllers::NotificationManager& notificatioManager, + Controllers::HeartRateController& heartRateController): Screen(app), currentDateTime{{}}, dateTimeController{dateTimeController}, batteryController{batteryController}, - bleController{bleController}, notificatioManager{notificatioManager} { + bleController{bleController}, notificatioManager{notificatioManager}, + heartRateController{heartRateController} { displayedChar[0] = 0; displayedChar[1] = 0; displayedChar[2] = 0; @@ -171,10 +174,15 @@ bool Clock::Refresh() { } } - // TODO heartbeat = heartBeatController.GetValue(); - if(heartbeat.IsUpdated()) { + heartbeat = heartRateController.HeartRate(); + heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; + if(heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { char heartbeatBuffer[4]; - sprintf(heartbeatBuffer, "%d", heartbeat.Get()); + if(heartbeatRunning.Get()) + sprintf(heartbeatBuffer, "%d", heartbeat.Get()); + else + sprintf(heartbeatBuffer, "---"); + lv_label_set_text(heartbeatValue, heartbeatBuffer); lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); |
