99#include " components/heartrate/HeartRateController.h"
1010#include " components/motion/MotionController.h"
1111#include " components/settings/Settings.h"
12+ #include " components/ble/SimpleWeatherService.h"
13+ #include " displayapp/screens/WeatherSymbols.h"
14+ #include " displayapp/InfiniTimeTheme.h"
1215
1316using namespace Pinetime ::Applications::Screens;
1417
18+
1519WatchFaceTerminal::WatchFaceTerminal (Controllers::DateTime& dateTimeController,
1620 const Controllers::Battery& batteryController,
1721 const Controllers::Ble& bleController,
1822 Controllers::NotificationManager& notificationManager,
1923 Controllers::Settings& settingsController,
2024 Controllers::HeartRateController& heartRateController,
21- Controllers::MotionController& motionController)
25+ Controllers::MotionController& motionController,
26+ Controllers::SimpleWeatherService& weatherService)
2227 : currentDateTime {{}},
2328 dateTimeController {dateTimeController},
2429 batteryController {batteryController},
2530 bleController {bleController},
2631 notificationManager {notificationManager},
2732 settingsController {settingsController},
2833 heartRateController {heartRateController},
29- motionController {motionController} {
34+ motionController {motionController},
35+ weatherService {weatherService} {
3036 batteryValue = lv_label_create (lv_scr_act (), nullptr );
3137 lv_label_set_recolor (batteryValue, true );
3238 lv_obj_align (batteryValue, lv_scr_act (), LV_ALIGN_IN_LEFT_MID, 0 , -20 );
@@ -47,7 +53,7 @@ WatchFaceTerminal::WatchFaceTerminal(Controllers::DateTime& dateTimeController,
4753 lv_label_set_text_static (label_prompt_1, " user@watch:~ $ now" );
4854
4955 label_prompt_2 = lv_label_create (lv_scr_act (), nullptr );
50- lv_obj_align (label_prompt_2, lv_scr_act (), LV_ALIGN_IN_LEFT_MID, 0 , 60 );
56+ lv_obj_align (label_prompt_2, lv_scr_act (), LV_ALIGN_IN_LEFT_MID, 0 , 80 );
5157 lv_label_set_text_static (label_prompt_2, " user@watch:~ $" );
5258
5359 label_time = lv_label_create (lv_scr_act (), nullptr );
@@ -62,6 +68,10 @@ WatchFaceTerminal::WatchFaceTerminal(Controllers::DateTime& dateTimeController,
6268 lv_label_set_recolor (stepValue, true );
6369 lv_obj_align (stepValue, lv_scr_act (), LV_ALIGN_IN_LEFT_MID, 0 , 0 );
6470
71+ weather = lv_label_create (lv_scr_act (), nullptr );
72+ lv_label_set_recolor (weather, true );
73+ lv_obj_align (weather, lv_scr_act (), LV_ALIGN_IN_LEFT_MID, 0 , 60 );
74+
6575 taskRefresh = lv_task_create (RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this );
6676 Refresh ();
6777}
@@ -148,4 +158,25 @@ void WatchFaceTerminal::Refresh() {
148158 if (stepCount.IsUpdated ()) {
149159 lv_label_set_text_fmt (stepValue, " [STEP]#ee3377 %lu steps#" , stepCount.Get ());
150160 }
161+
162+ currentWeather = weatherService.Current ();
163+ if (currentWeather.IsUpdated ()) {
164+ auto optCurrentWeather = currentWeather.Get ();
165+ if (optCurrentWeather) {
166+ int16_t temp = optCurrentWeather->temperature .Celsius ();
167+ char tempUnit = ' C' ;
168+ if (settingsController.GetWeatherFormat () == Controllers::Settings::WeatherFormat::Imperial) {
169+ temp = optCurrentWeather->temperature .Fahrenheit ();
170+ tempUnit = ' F' ;
171+ }
172+ lv_label_set_text_fmt (weather,
173+ " [WTHR]#ffdd00 %d°%c %s#" ,
174+ temp,
175+ tempUnit,
176+ // Change to GetSimpleCondition with pull request #2134 (Add shorter/simpler weather condition options)
177+ Symbols::GetCondition (optCurrentWeather->iconId ));
178+ } else {
179+ lv_label_set_text (weather, " [WTHR]#ffdd00 ---°" );
180+ }
181+ }
151182}
0 commit comments