localization
This commit is contained in:
@@ -19,9 +19,9 @@ namespace {
|
||||
double lastLon = 0;
|
||||
bool hasLastLocation = false;
|
||||
|
||||
// Ordnet den WMO-Wettercode von Open-Meteo (Feld "weathercode", siehe
|
||||
// https://open-meteo.com/en/docs) einer der wenigen Icon-Kategorien zu,
|
||||
// die main.cpp zeichnen kann.
|
||||
// Maps the WMO weather code from Open-Meteo (field "weathercode", see
|
||||
// https://open-meteo.com/en/docs) to one of the few icon categories
|
||||
// that main.cpp can draw.
|
||||
Condition conditionFromWmoCode(int code) {
|
||||
if (code == 0) return Condition::Clear;
|
||||
if (code == 1 || code == 2) return Condition::PartlyCloudy;
|
||||
@@ -56,10 +56,10 @@ namespace {
|
||||
return;
|
||||
}
|
||||
|
||||
// Body erst komplett als String einsammeln (getString() kuemmert
|
||||
// sich zuverlaessig um Chunked-Transfer-Encoding), statt direkt aus
|
||||
// http.getStream() zu parsen - Letzteres scheiterte bei Open-Meteo
|
||||
// zuverlaessig mit einem ArduinoJson-"InvalidInput"-Fehler.
|
||||
// Collect body as a complete string first (getString() reliably handles
|
||||
// chunked transfer encoding) instead of parsing directly from
|
||||
// http.getStream() - the latter reliably failed with Open-Meteo
|
||||
// with an ArduinoJson "InvalidInput" error.
|
||||
String body = http.getString();
|
||||
http.end();
|
||||
|
||||
@@ -79,10 +79,9 @@ void update() {
|
||||
LocationManager::getHomeLocation(lat, lon);
|
||||
if (lat == 0 && lon == 0) return;
|
||||
|
||||
// Deutliche Standort-Aenderung (z.B. anderes Standort-Preset aktiviert)
|
||||
// - sofort neu abfragen statt bis zum naechsten regulaeren Intervall zu
|
||||
// warten, damit das Icon nicht minutenlang das Wetter des alten
|
||||
// Standorts zeigt.
|
||||
// Significant location change (e.g., another location preset activated)
|
||||
// - query immediately instead of waiting for the next regular interval,
|
||||
// so the icon does not show the old location's weather for minutes.
|
||||
bool locationChanged = !hasLastLocation ||
|
||||
fabs(lat - lastLat) > 0.01 || fabs(lon - lastLon) > 0.01;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user