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 dbce980
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 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
16 changes: 8 additions & 8 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 "Clouds";
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";
return "Rain";
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";
return "Snow";
case Pinetime::Controllers::SimpleWeatherService::Icons::Smog:
return "Misty";
return "Mist";
default:
return "";
}
Expand Down

0 comments on commit dbce980

Please sign in to comment.