Initial commit

This commit is contained in:
2026-08-01 23:38:09 +02:00
parent 0d9cca3668
commit a99b986544
28 changed files with 1476 additions and 1 deletions
+67
View File
@@ -0,0 +1,67 @@
#include "weather_detail_screen.h"
#include <M5Stack.h>
#include "../../include/theme.h"
#include "../icons/icons.h"
#include "../api/weather_api.h"
namespace {
WeatherData lastWeather;
bool ok = false;
}
void renderWeatherDetailScreen(bool forceRefresh) {
if (forceRefresh || !ok) {
WeatherData w = fetchWeather();
ok = w.valid;
if (w.valid) lastWeather = w;
}
M5.Lcd.fillScreen(Theme::BG);
M5.Lcd.setTextColor(Theme::TEXT, Theme::BG);
M5.Lcd.setTextSize(2);
M5.Lcd.setCursor(10, 10);
M5.Lcd.print("Wettervorhersage");
if (!ok) {
Icons::drawRetryIcon(30, 60, 12);
M5.Lcd.setTextColor(Theme::TEXT_DIM, Theme::BG);
M5.Lcd.setCursor(50, 55);
M5.Lcd.print("Keine Verbindung");
return;
}
int y = 40;
int shown = 0;
for (const auto &fe : lastWeather.forecast) {
if (shown >= 6 || y > 220) break;
Icons::drawWeatherIcon(fe.symbol, 20, y + 8, 10);
M5.Lcd.setTextColor(Theme::TEXT, Theme::BG);
M5.Lcd.setTextSize(1);
int tIdx = fe.time.indexOf('T');
String hhmm = tIdx > 0 ? fe.time.substring(tIdx + 1, tIdx + 6) : fe.time;
M5.Lcd.setCursor(40, y);
M5.Lcd.print(hhmm);
M5.Lcd.setCursor(90, y);
M5.Lcd.printf("%d C", fe.temperature);
M5.Lcd.setCursor(140, y);
M5.Lcd.print(fe.description.substring(0, 12));
if (fe.precipitationType == "rain" && fe.precipitationProbability > 0.0f) {
M5.Lcd.setTextColor(Theme::ACCENT_RAIN, Theme::BG);
M5.Lcd.setCursor(250, y);
M5.Lcd.printf("%.0f%%", fe.precipitationProbability * 100);
}
y += 28;
shown++;
}
M5.Lcd.setTextColor(Theme::TEXT_DIM, Theme::BG);
M5.Lcd.setTextSize(1);
M5.Lcd.setCursor(10, 228);
M5.Lcd.print("A:Kalender B:Home C:MVG");
}