Skip to content

Commit

Permalink
Pass the value for the weather condition variable directly instead of
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JustScott committed Feb 5, 2024
1 parent 1d69e47 commit 1c7fcb9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/displayapp/screens/WatchFaceTerminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void WatchFaceTerminal::Refresh() {
notificationState = notificationManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) {
if (notificationState.Get()) {
lv_label_set_text_static(notificationIcon, "You have mail.");
lv_label_set_text_static(notificationIcon, "[1]+ Notify");
} else {
lv_label_set_text_static(notificationIcon, "");
}
Expand Down Expand Up @@ -144,11 +144,10 @@ void WatchFaceTerminal::Refresh() {
char tempUnit = 'C';
lv_obj_set_style_local_text_color(weather, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, temperatureColor(temp));
if (settingsController.GetWeatherFormat() == Controllers::Settings::WeatherFormat::Imperial) {
condition = Symbols::GetSimpleCondition(optCurrentWeather->iconId);
temp = Controllers::SimpleWeatherService::CelsiusToFahrenheit(temp);
tempUnit = 'F';
}
lv_label_set_text_fmt(weather, "#ffffff [WTHR]# %i°%c %s ", temp / 100, tempUnit, condition);
lv_label_set_text_fmt(weather, "#ffffff [WTHR]# %i°%c %s ", temp / 100, tempUnit, Symbols::GetSimpleCondition(optCurrentWeather->iconId));
} else {
lv_label_set_text(weather, "#ffffff [WTHR]# ---");
lv_obj_set_style_local_text_color(weather, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
Expand All @@ -165,7 +164,7 @@ void WatchFaceTerminal::Refresh() {
uint8_t hue = batteryPercentRemaining.Get() * 120 / 100;
lv_obj_set_style_local_text_color(batteryValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(hue, 100, 100));
lv_label_set_text_fmt(batteryValue, "#ffffff [BATT]# %d%%", batteryPercentRemaining.Get());
if (batteryController.IsPowerPresent()) {
if (batteryController.IsCharging()) {
lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging");
}
}
Expand Down
1 change: 0 additions & 1 deletion src/displayapp/screens/WatchFaceTerminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ namespace Pinetime {
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
Utility::DirtyValue<std::optional<Controllers::SimpleWeatherService::CurrentWeather>> currentWeather {};
Utility::DirtyValue<const char*> condition {};

lv_obj_t* notificationIcon;
lv_obj_t* label_prompt_1;
Expand Down
12 changes: 6 additions & 6 deletions src/displayapp/screens/WeatherSymbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ const char* Pinetime::Applications::Screens::Symbols::GetSimpleCondition(const P
case Pinetime::Controllers::SimpleWeatherService::Icons::Sun:
return "Clear";
case Pinetime::Controllers::SimpleWeatherService::Icons::CloudsSun:
return "Cloudy";
return "Cloud";
case Pinetime::Controllers::SimpleWeatherService::Icons::Clouds:
return "Cloudy";
return "Clouds";
case Pinetime::Controllers::SimpleWeatherService::Icons::BrokenClouds:
return "Cloudy";
return "Clouds";
case Pinetime::Controllers::SimpleWeatherService::Icons::CloudShowerHeavy:
return "Rainy";
case Pinetime::Controllers::SimpleWeatherService::Icons::CloudSunRain:
return "Rainy";
return "Drizzle";
case Pinetime::Controllers::SimpleWeatherService::Icons::Thunderstorm:
return "Stormy";
return "Thunder";
case Pinetime::Controllers::SimpleWeatherService::Icons::Snow:
return "Snowy";
case Pinetime::Controllers::SimpleWeatherService::Icons::Smog:
return "Misty";
return "Mist";
default:
return "";
}
Expand Down

0 comments on commit 1c7fcb9

Please sign in to comment.