summaryrefslogtreecommitdiff
path: root/src/displayapp/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens')
-rw-r--r--src/displayapp/screens/Clock.cpp2
-rw-r--r--src/displayapp/screens/PineTimeStyle.cpp56
-rw-r--r--src/displayapp/screens/PineTimeStyle.h9
3 files changed, 37 insertions, 30 deletions
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp
index 3b288d94..e0684976 100644
--- a/src/displayapp/screens/Clock.cpp
+++ b/src/displayapp/screens/Clock.cpp
@@ -87,7 +87,7 @@ std::unique_ptr<Screen> Clock::PineTimeStyleScreen() {
bleController,
notificatioManager,
settingsController,
- heartRateController);
+ motionController);
}
/*
diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp
index 787bb40a..ab6e2a74 100644
--- a/src/displayapp/screens/PineTimeStyle.cpp
+++ b/src/displayapp/screens/PineTimeStyle.cpp
@@ -30,7 +30,7 @@
#include "components/battery/BatteryController.h"
#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"
@@ -42,7 +42,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
Controllers::Ble& bleController,
Controllers::NotificationManager& notificatioManager,
Controllers::Settings& settingsController,
- Controllers::HeartRateController& heartRateController)
+ Controllers::MotionController& motionController)
: Screen(app),
currentDateTime {{}},
dateTimeController {dateTimeController},
@@ -50,7 +50,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
bleController {bleController},
notificatioManager {notificatioManager},
settingsController {settingsController},
- heartRateController {heartRateController} {
+ motionController {motionController} {
/* This sets the watchface number to return to after leaving the menu */
settingsController.SetClockFace(2);
@@ -165,17 +165,29 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_label_set_text(dateMonth, "MAR");
lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32);
- /* Display heartrate info */
-
- heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
- lv_label_set_text(heartbeatIcon, Symbols::heartBeat);
- lv_obj_align(heartbeatIcon, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -30);
-
- heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
- lv_label_set_text(heartbeatValue, "---");
- lv_obj_align(heartbeatValue, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -10);
+ // Step count gauge
+ static lv_color_t needle_colors[1];
+ needle_colors[0] = LV_COLOR_WHITE;
+ stepGauge = lv_gauge_create(lv_scr_act(), nullptr);
+ lv_gauge_set_needle_count(stepGauge, 1, needle_colors);
+ lv_obj_set_size(stepGauge, 40, 40);
+ lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
+ lv_gauge_set_scale(stepGauge, 360, 11, 0);
+ lv_gauge_set_angle_offset(stepGauge, 180);
+ lv_gauge_set_critical_value(stepGauge, (settingsController.GetStepsGoal() / 100));
+ lv_gauge_set_range(stepGauge, 0, (settingsController.GetStepsGoal() / 100));
+ lv_gauge_set_value(stepGauge, 0, 0);
+
+ lv_obj_set_style_local_pad_right(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3);
+ lv_obj_set_style_local_pad_left(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3);
+ lv_obj_set_style_local_pad_bottom(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3);
+ lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_obj_set_style_local_scale_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4);
+ lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4);
+ lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+ lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4);
+ lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4);
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_click(backgroundLabel, true);
@@ -286,17 +298,11 @@ bool PineTimeStyle::Refresh() {
}
}
- heartbeat = heartRateController.HeartRate();
- heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
- if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
- char heartbeatBuffer[4];
- if (heartbeatRunning.Get())
- sprintf(heartbeatBuffer, "%d", heartbeat.Get());
- else
- sprintf(heartbeatBuffer, "---");
-
- lv_label_set_text(heartbeatValue, heartbeatBuffer);
- lv_obj_realign(heartbeatValue);
+ stepCount = motionController.NbSteps();
+ motionSensorOk = motionController.IsSensorOk();
+ if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
+ lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / 100));
+ lv_obj_realign(stepGauge);
}
return running;
diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h
index 55752412..4530bb5f 100644
--- a/src/displayapp/screens/PineTimeStyle.h
+++ b/src/displayapp/screens/PineTimeStyle.h
@@ -27,7 +27,7 @@ namespace Pinetime {
Controllers::Ble& bleController,
Controllers::NotificationManager& notificatioManager,
Controllers::Settings& settingsController,
- Controllers::HeartRateController& heartRateController);
+ Controllers::MotionController& motionController);
~PineTimeStyle() override;
bool Refresh() override;
@@ -45,8 +45,8 @@ namespace Pinetime {
DirtyValue<int> batteryPercentRemaining {};
DirtyValue<bool> bleState {};
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
- DirtyValue<uint8_t> heartbeat {};
- DirtyValue<bool> heartbeatRunning {};
+ DirtyValue<bool> motionSensorOk {};
+ DirtyValue<uint32_t> stepCount {};
DirtyValue<bool> notificationState {};
lv_obj_t* timebar;
@@ -70,13 +70,14 @@ namespace Pinetime {
lv_obj_t* heartbeatValue;
lv_obj_t* heartbeatBpm;
lv_obj_t* notificationIcon;
+ lv_obj_t* stepGauge;
Controllers::DateTime& dateTimeController;
Controllers::Battery& batteryController;
Controllers::Ble& bleController;
Controllers::NotificationManager& notificatioManager;
Controllers::Settings& settingsController;
- Controllers::HeartRateController& heartRateController;
+ Controllers::MotionController& motionController;
};
}
}