88#include " components/heartrate/HeartRateController.h"
99#include " components/motion/MotionController.h"
1010#include " components/settings/Settings.h"
11+ #include " components/ble/SimpleWeatherService.h"
12+ #include " displayapp/screens/WeatherSymbols.h"
1113#include " displayapp/InfiniTimeTheme.h"
1214
1315using namespace Pinetime ::Applications::Screens;
@@ -18,15 +20,17 @@ WatchFaceTerminal::WatchFaceTerminal(Controllers::DateTime& dateTimeController,
1820 Controllers::NotificationManager& notificationManager,
1921 Controllers::Settings& settingsController,
2022 Controllers::HeartRateController& heartRateController,
21- Controllers::MotionController& motionController)
23+ Controllers::MotionController& motionController,
24+ Controllers::SimpleWeatherService& weatherService)
2225 : currentDateTime {{}},
2326 dateTimeController {dateTimeController},
2427 batteryController {batteryController},
2528 bleController {bleController},
2629 notificationManager {notificationManager},
2730 settingsController {settingsController},
2831 heartRateController {heartRateController},
29- motionController {motionController} {
32+ motionController {motionController},
33+ weatherService {weatherService} {
3034
3135 container = lv_cont_create (lv_scr_act (), nullptr );
3236 lv_cont_set_layout (container, LV_LAYOUT_COLUMN_LEFT);
@@ -56,14 +60,17 @@ WatchFaceTerminal::WatchFaceTerminal(Controllers::DateTime& dateTimeController,
5660 heartbeatValue = lv_label_create (container, nullptr );
5761 lv_label_set_recolor (heartbeatValue, true );
5862
63+ weather = lv_label_create (container, nullptr );
64+ lv_label_set_recolor (weather, true );
65+
5966 connectState = lv_label_create (container, nullptr );
6067 lv_label_set_recolor (connectState, true );
6168
6269 label_prompt_2 = lv_label_create (container, nullptr );
6370 lv_obj_set_style_local_text_color (label_prompt_2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray);
6471 lv_label_set_text_static (label_prompt_2, " user@watch:~ $" );
6572
66- lv_obj_align (container, nullptr , LV_ALIGN_IN_TOP_LEFT, 0 , 20 );
73+ lv_obj_align (container, nullptr , LV_ALIGN_IN_TOP_LEFT, 0 , 10 );
6774
6875 taskRefresh = lv_task_create (RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this );
6976 Refresh ();
@@ -147,6 +154,26 @@ void WatchFaceTerminal::Refresh() {
147154 }
148155 }
149156
157+ currentWeather = weatherService.Current ();
158+ if (currentWeather.IsUpdated ()) {
159+ auto optCurrentWeather = currentWeather.Get ();
160+ if (optCurrentWeather) {
161+ int16_t temp = optCurrentWeather->temperature .Celsius ();
162+ char tempUnit = ' C' ;
163+ if (settingsController.GetWeatherFormat () == Controllers::Settings::WeatherFormat::Imperial) {
164+ temp = optCurrentWeather->temperature .Fahrenheit ();
165+ tempUnit = ' F' ;
166+ }
167+ lv_label_set_text_fmt (weather,
168+ " [WTHR]#ffdd00 %d°%c %s#" ,
169+ temp,
170+ tempUnit,
171+ Symbols::GetSimpleCondition (optCurrentWeather->iconId ));
172+ } else {
173+ lv_label_set_text (weather, " [WTHR]#ffdd00 ---" );
174+ }
175+ }
176+
150177 bleState = bleController.IsConnected ();
151178 bleRadioEnabled = bleController.IsRadioEnabled ();
152179 if (bleState.IsUpdated () || bleRadioEnabled.IsUpdated ()) {
0 commit comments