From e13be735961a385f577ad54479178f6513af5fc4 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Mon, 28 Sep 2026 23:13:31 +0200 Subject: [PATCH] m5paper: clear-night icon for sunny hours without UV, center hourly temperature without precipitation --- include/m5paper_weather.h | 3 +++ mcu-m5paper.yaml | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/m5paper_weather.h b/include/m5paper_weather.h index 8bfbff5..5db99ea 100644 --- a/include/m5paper_weather.h +++ b/include/m5paper_weather.h @@ -123,6 +123,9 @@ inline bool parse(ArduinoJson::JsonObjectConst response, const char *entity, uin } Hour &hour = out.hours[out.count++]; hour.cond = condition_code(item["condition"] | ""); + // OpenWeatherMap reports "sunny" for clear nights too; no UV means the sun is down + if (hour.cond == condition_code("sunny") && (item["uv_index"] | 1.0f) == 0.0f) + hour.cond = condition_code("clear-night"); float temp = item["temperature"] | NAN; hour.temp2 = std::isnan(temp) ? NO_TEMP : int8_t(std::max(-127L, std::min(127L, lroundf(temp * 2)))); float wind = item["wind_speed"] | NAN; diff --git a/mcu-m5paper.yaml b/mcu-m5paper.yaml index 312f9c7..4c3dafb 100644 --- a/mcu-m5paper.yaml +++ b/mcu-m5paper.yaml @@ -616,9 +616,11 @@ display: it.printf(x, y + 14, id(font_hour), id(ink), "%02d", t.hour); if (h->cond < NUM_CONDITIONS) it.image(x + 42, y + 8, small[h->cond], id(ink)); + // temperature in line with the hour, lifted only to make room for the precipitation below + const bool show_pop = h->pop != NO_VALUE && h->pop >= 10; if (h->temp2 != NO_TEMP) - it.printf(x + 94, y + 6, id(font_hour), id(ink), "%.0f°", h->temp2 / 2.0f); - if (h->pop != NO_VALUE && h->pop >= 10) + it.printf(x + 94, show_pop ? y + 6 : y + 14, id(font_hour), id(ink), "%.0f°", h->temp2 / 2.0f); + if (show_pop) it.printf(x + 94, y + 38, id(font_tiny), id(ink), "%u %%", h->pop); } for (int c = 1; c < 3; c++)