Skip to content

Commit dbce980

Browse files
committed
Pass the value for the weather condition variable directly instead of
defining it first. changed the 'you have mail' to '[1]+ Notify, to better align with terminal lore. Use `IsCharging` instead of `IsPowerPresent` to stop displaying the 'Charging' text once the battery's full. Update the return values for weather condition in `GetSimpleCondition` to match the standard names used in the rest of the project.
1 parent 1d69e47 commit dbce980

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/displayapp/screens/WatchFaceTerminal.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void WatchFaceTerminal::Refresh() {
100100
notificationState = notificationManager.AreNewNotificationsAvailable();
101101
if (notificationState.IsUpdated()) {
102102
if (notificationState.Get()) {
103-
lv_label_set_text_static(notificationIcon, "You have mail.");
103+
lv_label_set_text_static(notificationIcon, "[1]+ Notify");
104104
} else {
105105
lv_label_set_text_static(notificationIcon, "");
106106
}
@@ -144,11 +144,10 @@ void WatchFaceTerminal::Refresh() {
144144
char tempUnit = 'C';
145145
lv_obj_set_style_local_text_color(weather, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, temperatureColor(temp));
146146
if (settingsController.GetWeatherFormat() == Controllers::Settings::WeatherFormat::Imperial) {
147-
condition = Symbols::GetSimpleCondition(optCurrentWeather->iconId);
148147
temp = Controllers::SimpleWeatherService::CelsiusToFahrenheit(temp);
149148
tempUnit = 'F';
150149
}
151-
lv_label_set_text_fmt(weather, "#ffffff [WTHR]# %i°%c %s ", temp / 100, tempUnit, condition);
150+
lv_label_set_text_fmt(weather, "#ffffff [WTHR]# %i°%c %s ", temp / 100, tempUnit, Symbols::GetSimpleCondition(optCurrentWeather->iconId));
152151
} else {
153152
lv_label_set_text(weather, "#ffffff [WTHR]# ---");
154153
lv_obj_set_style_local_text_color(weather, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
@@ -165,7 +164,7 @@ void WatchFaceTerminal::Refresh() {
165164
uint8_t hue = batteryPercentRemaining.Get() * 120 / 100;
166165
lv_obj_set_style_local_text_color(batteryValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(hue, 100, 100));
167166
lv_label_set_text_fmt(batteryValue, "#ffffff [BATT]# %d%%", batteryPercentRemaining.Get());
168-
if (batteryController.IsPowerPresent()) {
167+
if (batteryController.IsCharging()) {
169168
lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging");
170169
}
171170
}

src/displayapp/screens/WatchFaceTerminal.h

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ namespace Pinetime {
5050
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
5151
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
5252
Utility::DirtyValue<std::optional<Controllers::SimpleWeatherService::CurrentWeather>> currentWeather {};
53-
Utility::DirtyValue<const char*> condition {};
5453

5554
lv_obj_t* notificationIcon;
5655
lv_obj_t* label_prompt_1;

src/displayapp/screens/WeatherSymbols.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ const char* Pinetime::Applications::Screens::Symbols::GetSimpleCondition(const P
4040
case Pinetime::Controllers::SimpleWeatherService::Icons::Sun:
4141
return "Clear";
4242
case Pinetime::Controllers::SimpleWeatherService::Icons::CloudsSun:
43-
return "Cloudy";
43+
return "Clouds";
4444
case Pinetime::Controllers::SimpleWeatherService::Icons::Clouds:
45-
return "Cloudy";
45+
return "Clouds";
4646
case Pinetime::Controllers::SimpleWeatherService::Icons::BrokenClouds:
47-
return "Cloudy";
47+
return "Clouds";
4848
case Pinetime::Controllers::SimpleWeatherService::Icons::CloudShowerHeavy:
49-
return "Rainy";
49+
return "Rain";
5050
case Pinetime::Controllers::SimpleWeatherService::Icons::CloudSunRain:
51-
return "Rainy";
51+
return "Drizzle";
5252
case Pinetime::Controllers::SimpleWeatherService::Icons::Thunderstorm:
53-
return "Stormy";
53+
return "Thunder";
5454
case Pinetime::Controllers::SimpleWeatherService::Icons::Snow:
55-
return "Snowy";
55+
return "Snow";
5656
case Pinetime::Controllers::SimpleWeatherService::Icons::Smog:
57-
return "Misty";
57+
return "Mist";
5858
default:
5959
return "";
6060
}

0 commit comments

Comments
 (0)