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.
This commit is contained in:
JustScott 2024-02-05 15:35:40 -06:00
parent 833b8d693f
commit 118905325f
3 changed files with 11 additions and 13 deletions

View file

@ -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, "");
}
@ -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);
@ -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");
}
}

View file

@ -49,7 +49,6 @@ namespace Pinetime {
Utility::DirtyValue<bool> notificationState {};
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::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;

View file

@ -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 "";
}