Sun-based night dimming; separate marker for Heavy aircraft

Night dimming now uses the actual sunrise/sunset at the active
location (classic Almanac algorithm) instead of a fixed 22:00-06:00
window, with a fallback to that fixed window while location or time
isn't known yet. Applies to both the backlight (main.cpp) and the
radar's own color dimming (radar_screen.cpp).

Heavy-category aircraft (ADS-B emitter category "A5") now get a
distinct marker (larger circle with an outer ring, plus the usual
heading line) instead of sharing the orange "notable" ring, on both
the device display and the WebUI radar.

Note: the orange "notable" ring itself (military/government callsign
prefixes) remains unimplemented - Config::NOTABLE_CALLSIGN_PREFIXES
has never been defined anywhere in this project. The WebUI radar's
"notable" field is hardcoded false until that's actually specified;
on the device it was never wired up in the first place.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Eiswolf-BG
2026-08-13 04:13:41 +02:00
parent 5e22025d7a
commit fe3eec29b8
11 changed files with 237 additions and 19 deletions

24
src/sun_times.h Normal file
View File

@@ -0,0 +1,24 @@
#pragma once
#include <Arduino.h>
// Berechnet Sonnenauf-/untergang (lokale Zeit) fuer einen gegebenen Ort und
// Tag - Grundlage fuer die standortbasierte Nachtdimmung (siehe main.cpp::
// isNightDimHours()), die das vorherige feste 22:00-06:00-Fenster ersetzt.
namespace SunTimes {
struct Result {
bool valid = false; // false = Standort noch unbekannt (lat/lon == 0,0)
bool alwaysDay = false; // Polartag: Sonne geht heute an diesem Ort nicht unter
bool alwaysNight = false; // Polarnacht: Sonne geht heute an diesem Ort nicht auf
float sunriseHour = 0; // Lokale Dezimalstunde (0-24), nur gueltig wenn weder
float sunsetHour = 0; // alwaysDay noch alwaysNight gesetzt ist.
};
// year/month/day sind lokale Kalenderdatumswerte (z.B. aus localtime_r()),
// utcOffsetSeconds die bekannte Zeitzonenverschiebung (siehe
// LocationManager::utcOffsetSeconds()). Nutzt den klassischen "Almanac"-
// Sonnenauf-/untergangsalgorithmus (Sonnenzenit 90.833 Grad, beruecksichtigt
// atmosphaerische Refraktion) - Genauigkeit liegt typischerweise im Bereich
// weniger Minuten, fuer eine sanfte Backlight-Dimmung mehr als ausreichend.
Result compute(double lat, double lon, int year, int month, int day, int32_t utcOffsetSeconds);
}