66#include " displayapp/screens/NotificationIcon.h"
77#include " displayapp/screens/Symbols.h"
88#include " displayapp/screens/WeatherSymbols.h"
9+ #include " displayapp/screens/WeatherSymbols.h"
10+ #include " displayapp/screens/StopWatch.h"
911#include " components/battery/BatteryController.h"
1012#include " components/ble/BleController.h"
1113#include " components/ble/NotificationManager.h"
@@ -24,13 +26,15 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
2426 Controllers::Settings& settingsController,
2527 Controllers::HeartRateController& heartRateController,
2628 Controllers::MotionController& motionController,
29+ Controllers::StopWatchController& stopWatchController,
2730 Controllers::SimpleWeatherService& weatherService)
2831 : currentDateTime {{}},
2932 dateTimeController {dateTimeController},
3033 notificationManager {notificationManager},
3134 settingsController {settingsController},
3235 heartRateController {heartRateController},
3336 motionController {motionController},
37+ stopWatchController {stopWatchController},
3438 weatherService {weatherService},
3539 statusIcons (batteryController, bleController, alarmController) {
3640
@@ -86,6 +90,16 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
8690 lv_label_set_text_static (stepIcon, Symbols::shoe);
8791 lv_obj_align (stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5 , 0 );
8892
93+ stopWatchIcon = lv_label_create (lv_scr_act (), nullptr );
94+ lv_obj_set_style_local_text_color (stopWatchIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0xFFFFFF ));
95+ lv_label_set_text_static (stopWatchIcon, " " );
96+ lv_obj_align (stopWatchIcon, lv_scr_act (), LV_ALIGN_IN_TOP_LEFT, 0 , 0 );
97+
98+ stopWatchValue = lv_label_create (lv_scr_act (), nullptr );
99+ lv_obj_set_style_local_text_color (stopWatchValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0xFFFFFF ));
100+ lv_label_set_text_static (stopWatchValue, " " );
101+ lv_obj_align (stopWatchValue, stopWatchIcon, LV_ALIGN_OUT_RIGHT_MID, 5 , 0 );
102+
89103 taskRefresh = lv_task_create (RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this );
90104 Refresh ();
91105}
@@ -172,6 +186,21 @@ void WatchFaceDigital::Refresh() {
172186 lv_obj_realign (stepIcon);
173187 }
174188
189+ stopWatchTime = stopWatchController.GetElapsedTime ();
190+ stopWatchRunning = !stopWatchController.IsCleared ();
191+ if (stopWatchTime.IsUpdated () || stopWatchRunning.IsUpdated ()) {
192+ if (stopWatchRunning.Get ()) {
193+ TimeSeparated elapsedTime = ConvertTicksToTimeSegments (stopWatchTime.Get ());
194+ lv_label_set_text_fmt (stopWatchValue, " %02d:%02d:%02d:%02d" , elapsedTime.hours , elapsedTime.mins , elapsedTime.secs , elapsedTime.hundredths );
195+ lv_label_set_text_static (stopWatchIcon, Symbols::stopWatch);
196+ } else {
197+ lv_label_set_text_fmt (stopWatchValue, " " );
198+ lv_label_set_text_static (stopWatchIcon, " " );
199+ }
200+ lv_obj_realign (stopWatchValue);
201+ lv_obj_realign (stopWatchIcon);
202+ }
203+
175204 currentWeather = weatherService.Current ();
176205 if (currentWeather.IsUpdated ()) {
177206 auto optCurrentWeather = currentWeather.Get ();
0 commit comments