Skip to content

Commit a02aef7

Browse files
committed
settings: Add global widget selection
Instead of each watch face implementing their own settings for which widgets to display, we can have a global selection of widgets. All watch faces can then determine whether it is enabled and so display it in whichever way makes sense for that face. Current widgets supported are heart rate, step counter, and weather.
1 parent a6cd367 commit a02aef7

14 files changed

+348
-236
lines changed

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ list(APPEND SOURCE_FILES
409409
displayapp/screens/settings/SettingTimeFormat.cpp
410410
displayapp/screens/settings/SettingWeatherFormat.cpp
411411
displayapp/screens/settings/SettingWakeUp.cpp
412+
displayapp/screens/settings/SettingWidgets.cpp
412413
displayapp/screens/settings/SettingDisplay.cpp
413414
displayapp/screens/settings/SettingSteps.cpp
414415
displayapp/screens/settings/SettingSetDateTime.cpp

src/components/settings/Settings.h

+17-12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace Pinetime {
1414
enum class Notification : uint8_t { On, Off, Sleep };
1515
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
1616
enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 };
17+
enum class Widget : uint8_t { HeartRate = 0, Steps = 1, Weather = 2 };
1718
enum class Colors : uint8_t {
1819
White,
1920
Silver,
@@ -35,14 +36,12 @@ namespace Pinetime {
3536
Pink
3637
};
3738
enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric };
38-
enum class PTSWeather : uint8_t { On, Off };
3939

4040
struct PineTimeStyle {
4141
Colors ColorTime = Colors::Teal;
4242
Colors ColorBar = Colors::Teal;
4343
Colors ColorBG = Colors::Black;
4444
PTSGaugeStyle gaugeStyle = PTSGaugeStyle::Full;
45-
PTSWeather weatherEnable = PTSWeather::Off;
4645
};
4746

4847
struct WatchFaceInfineat {
@@ -144,16 +143,6 @@ namespace Pinetime {
144143
return settings.PTS.gaugeStyle;
145144
};
146145

147-
void SetPTSWeather(PTSWeather weatherEnable) {
148-
if (weatherEnable != settings.PTS.weatherEnable)
149-
settingsChanged = true;
150-
settings.PTS.weatherEnable = weatherEnable;
151-
};
152-
153-
PTSWeather GetPTSWeather() const {
154-
return settings.PTS.weatherEnable;
155-
};
156-
157146
void SetAppMenu(uint8_t menu) {
158147
appMenu = menu;
159148
};
@@ -192,6 +181,21 @@ namespace Pinetime {
192181
return settings.weatherFormat;
193182
};
194183

184+
void SetWidget(Widget widget, bool enabled) {
185+
if (enabled != IsWidgetOn(widget)) {
186+
settingsChanged = true;
187+
}
188+
settings.widgets.set(static_cast<size_t>(widget), enabled);
189+
}
190+
191+
std::bitset<3> GetWidgets() const {
192+
return settings.widgets;
193+
}
194+
195+
bool IsWidgetOn(const Widget widget) const {
196+
return GetWidgets()[static_cast<size_t>(widget)];
197+
}
198+
195199
void SetNotificationStatus(Notification status) {
196200
if (status != settings.notificationStatus) {
197201
settingsChanged = true;
@@ -304,6 +308,7 @@ namespace Pinetime {
304308

305309
WatchFaceInfineat watchFaceInfineat;
306310

311+
std::bitset<3> widgets {0b111}; // Set all 3 widgets to enabled by default
307312
std::bitset<5> wakeUpMode {0};
308313
uint16_t shakeWakeThreshold = 150;
309314

src/displayapp/DisplayApp.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "displayapp/screens/settings/SettingTimeFormat.h"
4343
#include "displayapp/screens/settings/SettingWeatherFormat.h"
4444
#include "displayapp/screens/settings/SettingWakeUp.h"
45+
#include "displayapp/screens/settings/SettingWidgets.h"
4546
#include "displayapp/screens/settings/SettingDisplay.h"
4647
#include "displayapp/screens/settings/SettingSteps.h"
4748
#include "displayapp/screens/settings/SettingSetDateTime.h"
@@ -507,6 +508,9 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
507508
case Apps::SettingWakeUp:
508509
currentScreen = std::make_unique<Screens::SettingWakeUp>(settingsController);
509510
break;
511+
case Apps::SettingWidgets:
512+
currentScreen = std::make_unique<Screens::SettingWidgets>(settingsController);
513+
break;
510514
case Apps::SettingDisplay:
511515
currentScreen = std::make_unique<Screens::SettingDisplay>(this, settingsController);
512516
break;

src/displayapp/apps/Apps.h.in

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace Pinetime {
3636
SettingWeatherFormat,
3737
SettingDisplay,
3838
SettingWakeUp,
39+
SettingWidgets,
3940
SettingSteps,
4041
SettingSetDateTime,
4142
SettingChimes,

src/displayapp/fonts/fonts.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
{
99
"file": "FontAwesome5-Solid+Brands+Regular.woff",
10-
"range": "0xf294, 0xf242, 0xf54b, 0xf21e, 0xf1e6, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf06e, 0xf015, 0xf00c, 0xf522, 0xf743"
10+
"range": "0xf294, 0xf242, 0xf54b, 0xf21e, 0xf1e6, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf06e, 0xf015, 0xf00c, 0xf522, 0xf743, 0xf0ad"
1111
}
1212
],
1313
"bpp": 1,

src/displayapp/screens/Symbols.h

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace Pinetime {
3838
static constexpr const char* eye = "\xEF\x81\xAE";
3939
static constexpr const char* home = "\xEF\x80\x95";
4040
static constexpr const char* sleep = "\xEE\xBD\x84";
41+
static constexpr const char* wrench = "\xEF\x82\xAD";
4142

4243
// fontawesome_weathericons.c
4344
// static constexpr const char* sun = "\xEF\x86\x85";

src/displayapp/screens/WatchFaceCasioStyleG7710.cpp

+44-36
Original file line numberDiff line numberDiff line change
@@ -148,25 +148,29 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi
148148
lv_obj_set_pos(backgroundLabel, 0, 0);
149149
lv_label_set_text_static(backgroundLabel, "");
150150

151-
heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
152-
lv_label_set_text_static(heartbeatIcon, Symbols::heartBeat);
153-
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
154-
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
155-
156-
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
157-
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
158-
lv_label_set_text_static(heartbeatValue, "");
159-
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
160-
161-
stepValue = lv_label_create(lv_scr_act(), nullptr);
162-
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
163-
lv_label_set_text_static(stepValue, "0");
164-
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
165-
166-
stepIcon = lv_label_create(lv_scr_act(), nullptr);
167-
lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
168-
lv_label_set_text_static(stepIcon, Symbols::shoe);
169-
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
151+
if (settingsController.IsWidgetOn(Pinetime::Controllers::Settings::Widget::HeartRate)) {
152+
heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
153+
lv_label_set_text_static(heartbeatIcon, Symbols::heartBeat);
154+
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
155+
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
156+
157+
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
158+
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
159+
lv_label_set_text_static(heartbeatValue, "");
160+
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
161+
}
162+
163+
if (settingsController.IsWidgetOn(Pinetime::Controllers::Settings::Widget::Steps)) {
164+
stepValue = lv_label_create(lv_scr_act(), nullptr);
165+
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
166+
lv_label_set_text_static(stepValue, "0");
167+
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
168+
169+
stepIcon = lv_label_create(lv_scr_act(), nullptr);
170+
lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
171+
lv_label_set_text_static(stepIcon, Symbols::shoe);
172+
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
173+
}
170174

171175
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
172176
Refresh();
@@ -289,26 +293,30 @@ void WatchFaceCasioStyleG7710::Refresh() {
289293
}
290294
}
291295

292-
heartbeat = heartRateController.HeartRate();
293-
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
294-
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
295-
if (heartbeatRunning.Get()) {
296-
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
297-
lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
298-
} else {
299-
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B));
300-
lv_label_set_text_static(heartbeatValue, "");
301-
}
296+
if (settingsController.IsWidgetOn(Pinetime::Controllers::Settings::Widget::HeartRate)) {
297+
heartbeat = heartRateController.HeartRate();
298+
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
299+
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
300+
if (heartbeatRunning.Get()) {
301+
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
302+
lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
303+
} else {
304+
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B));
305+
lv_label_set_text_static(heartbeatValue, "");
306+
}
302307

303-
lv_obj_realign(heartbeatIcon);
304-
lv_obj_realign(heartbeatValue);
308+
lv_obj_realign(heartbeatIcon);
309+
lv_obj_realign(heartbeatValue);
310+
}
305311
}
306312

307-
stepCount = motionController.NbSteps();
308-
if (stepCount.IsUpdated()) {
309-
lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
310-
lv_obj_realign(stepValue);
311-
lv_obj_realign(stepIcon);
313+
if (settingsController.IsWidgetOn(Pinetime::Controllers::Settings::Widget::Steps)) {
314+
stepCount = motionController.NbSteps();
315+
if (stepCount.IsUpdated()) {
316+
lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
317+
lv_obj_realign(stepValue);
318+
lv_obj_realign(stepIcon);
319+
}
312320
}
313321
}
314322

src/displayapp/screens/WatchFaceDigital.cpp

+44-36
Original file line numberDiff line numberDiff line change
@@ -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
}

src/displayapp/screens/WatchFaceInfineat.cpp

+19-15
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,18 @@ WatchFaceInfineat::WatchFaceInfineat(Controllers::DateTime& dateTimeController,
230230
lv_label_set_text_static(bleIcon, Symbols::bluetooth);
231231
lv_obj_align(bleIcon, dateContainer, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
232232

233-
stepValue = lv_label_create(lv_scr_act(), nullptr);
234-
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor);
235-
lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko);
236-
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 10, 0);
237-
lv_label_set_text_static(stepValue, "0");
238-
239-
stepIcon = lv_label_create(lv_scr_act(), nullptr);
240-
lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor);
241-
lv_label_set_text_static(stepIcon, Symbols::shoe);
242-
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
233+
if (settingsController.IsWidgetOn(Pinetime::Controllers::Settings::Widget::Steps)) {
234+
stepValue = lv_label_create(lv_scr_act(), nullptr);
235+
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor);
236+
lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko);
237+
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 10, 0);
238+
lv_label_set_text_static(stepValue, "0");
239+
240+
stepIcon = lv_label_create(lv_scr_act(), nullptr);
241+
lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor);
242+
lv_label_set_text_static(stepIcon, Symbols::shoe);
243+
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
244+
}
243245

244246
// Setting buttons
245247
btnClose = lv_btn_create(lv_scr_act(), nullptr);
@@ -451,11 +453,13 @@ void WatchFaceInfineat::Refresh() {
451453
lv_obj_align(bleIcon, dateContainer, LV_ALIGN_OUT_BOTTOM_MID, 0, 3);
452454
}
453455

454-
stepCount = motionController.NbSteps();
455-
if (stepCount.IsUpdated()) {
456-
lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
457-
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 10, 0);
458-
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
456+
if (settingsController.IsWidgetOn(Pinetime::Controllers::Settings::Widget::Steps)) {
457+
stepCount = motionController.NbSteps();
458+
if (stepCount.IsUpdated()) {
459+
lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
460+
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 10, 0);
461+
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
462+
}
459463
}
460464

461465
if (!lv_obj_get_hidden(btnSettings)) {

0 commit comments

Comments
 (0)