@@ -48,25 +48,29 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
4848 lv_label_set_text_static (label_time_ampm, " " );
4949 lv_obj_align (label_time_ampm, lv_scr_act (), LV_ALIGN_IN_RIGHT_MID, -30 , -55 );
5050
51- heartbeatIcon = lv_label_create (lv_scr_act (), nullptr );
52- lv_label_set_text_static (heartbeatIcon, Symbols::heartBeat);
53- lv_obj_set_style_local_text_color (heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0xCE1B1B ));
54- lv_obj_align (heartbeatIcon, lv_scr_act (), LV_ALIGN_IN_BOTTOM_LEFT, 0 , 0 );
55-
56- heartbeatValue = lv_label_create (lv_scr_act (), nullptr );
57- lv_obj_set_style_local_text_color (heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0xCE1B1B ));
58- lv_label_set_text_static (heartbeatValue, " " );
59- lv_obj_align (heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5 , 0 );
60-
61- stepValue = lv_label_create (lv_scr_act (), nullptr );
62- lv_obj_set_style_local_text_color (stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x00FFE7 ));
63- lv_label_set_text_static (stepValue, " 0" );
64- lv_obj_align (stepValue, lv_scr_act (), LV_ALIGN_IN_BOTTOM_RIGHT, 0 , 0 );
65-
66- stepIcon = lv_label_create (lv_scr_act (), nullptr );
67- lv_obj_set_style_local_text_color (stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x00FFE7 ));
68- lv_label_set_text_static (stepIcon, Symbols::shoe);
69- lv_obj_align (stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5 , 0 );
51+ if (settingsController.IsWidgetOn (Pinetime::Controllers::Settings::Widget::HeartRate)) {
52+ heartbeatIcon = lv_label_create (lv_scr_act (), nullptr );
53+ lv_label_set_text_static (heartbeatIcon, Symbols::heartBeat);
54+ lv_obj_set_style_local_text_color (heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0xCE1B1B ));
55+ lv_obj_align (heartbeatIcon, lv_scr_act (), LV_ALIGN_IN_BOTTOM_LEFT, 0 , 0 );
56+
57+ heartbeatValue = lv_label_create (lv_scr_act (), nullptr );
58+ lv_obj_set_style_local_text_color (heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0xCE1B1B ));
59+ lv_label_set_text_static (heartbeatValue, " " );
60+ lv_obj_align (heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5 , 0 );
61+ }
62+
63+ if (settingsController.IsWidgetOn (Pinetime::Controllers::Settings::Widget::Steps)) {
64+ stepValue = lv_label_create (lv_scr_act (), nullptr );
65+ lv_obj_set_style_local_text_color (stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x00FFE7 ));
66+ lv_label_set_text_static (stepValue, " 0" );
67+ lv_obj_align (stepValue, lv_scr_act (), LV_ALIGN_IN_BOTTOM_RIGHT, 0 , 0 );
68+
69+ stepIcon = lv_label_create (lv_scr_act (), nullptr );
70+ lv_obj_set_style_local_text_color (stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x00FFE7 ));
71+ lv_label_set_text_static (stepIcon, Symbols::shoe);
72+ lv_obj_align (stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5 , 0 );
73+ }
7074
7175 taskRefresh = lv_task_create (RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this );
7276 Refresh ();
@@ -132,25 +136,29 @@ void WatchFaceDigital::Refresh() {
132136 }
133137 }
134138
135- heartbeat = heartRateController.HeartRate ();
136- heartbeatRunning = heartRateController.State () != Controllers::HeartRateController::States::Stopped;
137- if (heartbeat.IsUpdated () || heartbeatRunning.IsUpdated ()) {
138- if (heartbeatRunning.Get ()) {
139- lv_obj_set_style_local_text_color (heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0xCE1B1B ));
140- lv_label_set_text_fmt (heartbeatValue, " %d" , heartbeat.Get ());
141- } else {
142- lv_obj_set_style_local_text_color (heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x1B1B1B ));
143- lv_label_set_text_static (heartbeatValue, " " );
144- }
139+ if (settingsController.IsWidgetOn (Pinetime::Controllers::Settings::Widget::HeartRate)) {
140+ heartbeat = heartRateController.HeartRate ();
141+ heartbeatRunning = heartRateController.State () != Controllers::HeartRateController::States::Stopped;
142+ if (heartbeat.IsUpdated () || heartbeatRunning.IsUpdated ()) {
143+ if (heartbeatRunning.Get ()) {
144+ lv_obj_set_style_local_text_color (heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0xCE1B1B ));
145+ lv_label_set_text_fmt (heartbeatValue, " %d" , heartbeat.Get ());
146+ } else {
147+ lv_obj_set_style_local_text_color (heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x1B1B1B ));
148+ lv_label_set_text_static (heartbeatValue, " " );
149+ }
145150
146- lv_obj_realign (heartbeatIcon);
147- lv_obj_realign (heartbeatValue);
151+ lv_obj_realign (heartbeatIcon);
152+ lv_obj_realign (heartbeatValue);
153+ }
148154 }
149155
150- stepCount = motionController.NbSteps ();
151- if (stepCount.IsUpdated ()) {
152- lv_label_set_text_fmt (stepValue, " %lu" , stepCount.Get ());
153- lv_obj_realign (stepValue);
154- lv_obj_realign (stepIcon);
156+ if (settingsController.IsWidgetOn (Pinetime::Controllers::Settings::Widget::Steps)) {
157+ stepCount = motionController.NbSteps ();
158+ if (stepCount.IsUpdated ()) {
159+ lv_label_set_text_fmt (stepValue, " %lu" , stepCount.Get ());
160+ lv_obj_realign (stepValue);
161+ lv_obj_realign (stepIcon);
162+ }
155163 }
156164}
0 commit comments