Improved UI and fixed a bug

This commit is contained in:
Avamander
2021-12-01 01:15:11 +02:00
parent c870f8ed30
commit 06b022fc4d
2 changed files with 31 additions and 10 deletions

View File

@@ -74,6 +74,16 @@ std::unique_ptr<Screen> Weather::CreateScreenTemperature() {
std::unique_ptr<Controllers::WeatherData::Temperature>& current = weatherService.GetCurrentTemperature();
if (current->timestamp == 0) {
// Do not use the data, it's invalid
lv_label_set_text_fmt(label,
"#FFFF00 Temperature#\n\n"
"#444444 %d#\n\n"
"#444444 %d#\n\n"
"%d\n"
"%d\n",
0,
0,
0,
0);
} else {
lv_label_set_text_fmt(label,
"#FFFF00 Temperature#\n\n"
@@ -97,6 +107,16 @@ std::unique_ptr<Screen> Weather::CreateScreenAir() {
std::unique_ptr<Controllers::WeatherData::AirQuality>& current = weatherService.GetCurrentQuality();
if (current->timestamp == 0) {
// Do not use the data, it's invalid
lv_label_set_text_fmt(label,
"#FFFF00 Air quality#\n\n"
"#444444 %s#\n"
"#444444 %d#\n\n"
"%d\n"
"%d\n",
"",
0,
0,
0);
} else {
lv_label_set_text_fmt(label,
"#FFFF00 Air quality#\n\n"