pinetimestyle: Display temp in Fahrenheit with setting

This commit is contained in:
FintasticMan 2023-07-15 02:33:57 +02:00 committed by JF
parent d889f3e444
commit e88d0afabf

View File

@ -543,7 +543,11 @@ void WatchFacePineTimeStyle::Refresh() {
if (currentWeather.IsUpdated()) { if (currentWeather.IsUpdated()) {
auto optCurrentWeather = currentWeather.Get(); auto optCurrentWeather = currentWeather.Get();
if (optCurrentWeather) { if (optCurrentWeather) {
lv_label_set_text_fmt(temperature, "%d°", (optCurrentWeather->temperature) / 100); int16_t temp = optCurrentWeather->temperature;
if (settingsController.GetWeatherFormat() == Controllers::Settings::WeatherFormat::Imperial) {
temp = Controllers::SimpleWeatherService::CelsiusToFahrenheit(temp);
}
lv_label_set_text_fmt(temperature, "%d°", temp / 100);
lv_label_set_text(weatherIcon, Symbols::GetSymbol(optCurrentWeather->iconId)); lv_label_set_text(weatherIcon, Symbols::GetSymbol(optCurrentWeather->iconId));
lv_obj_realign(temperature); lv_obj_realign(temperature);
lv_obj_realign(weatherIcon); lv_obj_realign(weatherIcon);