Heartrate removed, steps moved, and seconds label added

(cherry picked from commit 191f99904c)
This commit is contained in:
Josh 2023-10-21 19:15:42 -04:00 committed by Josh
parent f7f2040516
commit 9aefffcc2c
2 changed files with 9 additions and 40 deletions

View File

@ -9,7 +9,6 @@
#include "components/battery/BatteryController.h" #include "components/battery/BatteryController.h"
#include "components/ble/BleController.h" #include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h" #include "components/ble/NotificationManager.h"
#include "components/heartrate/HeartRateController.h"
#include "components/motion/MotionController.h" #include "components/motion/MotionController.h"
#include "components/settings/Settings.h" #include "components/settings/Settings.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
@ -19,7 +18,6 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi
const Controllers::Ble& bleController, const Controllers::Ble& bleController,
Controllers::NotificationManager& notificatioManager, Controllers::NotificationManager& notificatioManager,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController,
Controllers::MotionController& motionController, Controllers::MotionController& motionController,
Controllers::FS& filesystem) Controllers::FS& filesystem)
: currentDateTime {{}}, : currentDateTime {{}},
@ -29,7 +27,6 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi
bleController {bleController}, bleController {bleController},
notificatioManager {notificatioManager}, notificatioManager {notificatioManager},
settingsController {settingsController}, settingsController {settingsController},
heartRateController {heartRateController},
motionController {motionController} { motionController {motionController} {
lfs_file f = {}; lfs_file f = {};
@ -160,15 +157,10 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi
lv_label_set_text_static(stepValue, ""); lv_label_set_text_static(stepValue, "");
lv_obj_align(stepValue, stepIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); lv_obj_align(stepValue, stepIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
oldStepValue = lv_label_create(lv_scr_act(), nullptr); label_seconds = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(oldStepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text); lv_obj_set_style_local_text_color(label_seconds, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(oldStepValue, "0"); lv_label_set_text_static(label_seconds, "0");
lv_obj_align(oldStepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); lv_obj_align(label_seconds, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
oldStepIcon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(oldStepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(oldStepIcon, Symbols::shoe);
lv_obj_align(oldStepIcon, oldStepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
Refresh(); Refresh();
@ -291,26 +283,11 @@ void WatchFaceCasioStyleG7710::Refresh() {
} }
} }
heartbeat = heartRateController.HeartRate();
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
if (heartbeatRunning.Get()) {
lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
} else {
lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B));
lv_label_set_text_static(heartbeatValue, "");
}
lv_obj_realign(stepIcon);
lv_obj_realign(heartbeatValue);
}
stepCount = motionController.NbSteps(); stepCount = motionController.NbSteps();
if (stepCount.IsUpdated()) { if (stepCount.IsUpdated()) {
lv_label_set_text_fmt(oldStepValue, "%lu", stepCount.Get()); lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
lv_obj_realign(oldStepValue); lv_obj_realign(stepValue);
lv_obj_realign(oldStepIcon); lv_obj_realign(stepValue);
} }
} }

View File

@ -18,7 +18,6 @@ namespace Pinetime {
class Battery; class Battery;
class Ble; class Ble;
class NotificationManager; class NotificationManager;
class HeartRateController;
class MotionController; class MotionController;
} }
@ -32,7 +31,6 @@ namespace Pinetime {
const Controllers::Ble& bleController, const Controllers::Ble& bleController,
Controllers::NotificationManager& notificatioManager, Controllers::NotificationManager& notificatioManager,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController,
Controllers::MotionController& motionController, Controllers::MotionController& motionController,
Controllers::FS& filesystem); Controllers::FS& filesystem);
~WatchFaceCasioStyleG7710() override; ~WatchFaceCasioStyleG7710() override;
@ -48,8 +46,6 @@ namespace Pinetime {
Utility::DirtyValue<bool> bleRadioEnabled {}; Utility::DirtyValue<bool> bleRadioEnabled {};
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {}; Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {};
Utility::DirtyValue<uint32_t> stepCount {}; Utility::DirtyValue<uint32_t> stepCount {};
Utility::DirtyValue<uint8_t> heartbeat {};
Utility::DirtyValue<bool> heartbeatRunning {};
Utility::DirtyValue<bool> notificationState {}; Utility::DirtyValue<bool> notificationState {};
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
@ -65,6 +61,7 @@ namespace Pinetime {
lv_style_t style_border; lv_style_t style_border;
lv_obj_t* label_time; lv_obj_t* label_time;
lv_obj_t* label_seconds;
lv_obj_t* line_time; lv_obj_t* line_time;
lv_obj_t* label_time_ampm; lv_obj_t* label_time_ampm;
lv_obj_t* label_date; lv_obj_t* label_date;
@ -78,12 +75,8 @@ namespace Pinetime {
lv_obj_t* bleIcon; lv_obj_t* bleIcon;
lv_obj_t* batteryPlug; lv_obj_t* batteryPlug;
lv_obj_t* label_battery_value; lv_obj_t* label_battery_value;
lv_obj_t* heartbeatIcon; lv_obj_t* stepIcon;
lv_obj_t* heartbeatValue;
lv_obj_t* stepIcon; //TODO: remove unused variables
lv_obj_t* oldStepIcon;
lv_obj_t* stepValue; lv_obj_t* stepValue;
lv_obj_t* oldStepValue;
lv_obj_t* notificationIcon; lv_obj_t* notificationIcon;
lv_obj_t* line_icons; lv_obj_t* line_icons;
@ -94,7 +87,6 @@ namespace Pinetime {
const Controllers::Ble& bleController; const Controllers::Ble& bleController;
Controllers::NotificationManager& notificatioManager; Controllers::NotificationManager& notificatioManager;
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
Controllers::HeartRateController& heartRateController;
Controllers::MotionController& motionController; Controllers::MotionController& motionController;
lv_task_t* taskRefresh; lv_task_t* taskRefresh;