Skip to content

Commit

Permalink
weather: Fix inverted imperial forecase temperatures
Browse files Browse the repository at this point in the history
When converting to imperial units, the min and max temperatures were
incorrectly inverted, causing confusion in the display.

Fixes #2183
  • Loading branch information
vkareh committed Dec 6, 2024
1 parent 2105a7b commit 15c9c1b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/displayapp/screens/Weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ void Weather::Refresh() {
std::tm localTime = *std::localtime(reinterpret_cast<const time_t*>(&optCurrentForecast->timestamp));

for (int i = 0; i < optCurrentForecast->nbDays; i++) {
int16_t minTemp = optCurrentForecast->days[i]->minTemperature.Celsius();
int16_t maxTemp = optCurrentForecast->days[i]->maxTemperature.Celsius();
int16_t minTemp = optCurrentForecast->days[i]->minTemperature.Celsius();
if (settingsController.GetWeatherFormat() == Controllers::Settings::WeatherFormat::Imperial) {
minTemp = optCurrentForecast->days[i]->maxTemperature.Fahrenheit();
maxTemp = optCurrentForecast->days[i]->minTemperature.Fahrenheit();
maxTemp = optCurrentForecast->days[i]->maxTemperature.Fahrenheit();
minTemp = optCurrentForecast->days[i]->minTemperature.Fahrenheit();
}
lv_table_set_cell_type(forecast, 2, i, TemperatureStyle(optCurrentForecast->days[i]->maxTemperature));
lv_table_set_cell_type(forecast, 3, i, TemperatureStyle(optCurrentForecast->days[i]->minTemperature));
Expand Down

0 comments on commit 15c9c1b

Please sign in to comment.