Group Flight logbook toggle with other switches, real screen-off on timeout

Moves "Flight logbook ON/OFF" into the group of plain on/off toggles
in the Flight Options menu, right under Proximity LED, alongside the
other LED-driven alerts and the ground-vehicle filter.

The inactivity screen timeout (Menu > System > Timeout) now turns the
backlight fully off (0) instead of just dimming it, for users who want
to keep the flight logbook running without needing the screen. Night
dimming (a separate setting) already covers the "just a bit darker"
case and is unaffected. Tapping the screen still wakes it back up to
the configured normal (or night-dimmed) brightness.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Eiswolf-BG
2026-08-10 19:33:02 +02:00
parent 925e318f44
commit b28f9a7686
2 changed files with 36 additions and 28 deletions

View File

@@ -52,7 +52,6 @@ bool wasEmergency = false;
bool bannerBlinkOn = false; bool bannerBlinkOn = false;
constexpr uint8_t BACKLIGHT_FULL = 255; constexpr uint8_t BACKLIGHT_FULL = 255;
constexpr uint8_t BACKLIGHT_DIMMED = 12;
constexpr uint8_t BACKLIGHT_PWM_CHANNEL = 0; constexpr uint8_t BACKLIGHT_PWM_CHANNEL = 0;
uint32_t lastInteractionMs = 0; uint32_t lastInteractionMs = 0;
bool screenDimmed = false; bool screenDimmed = false;
@@ -605,7 +604,16 @@ void loop() {
if (!screenDimmed && timeoutMin > 0) { if (!screenDimmed && timeoutMin > 0) {
uint32_t timeoutMs = (uint32_t)timeoutMin * 60000UL; uint32_t timeoutMs = (uint32_t)timeoutMin * 60000UL;
if (nowMs - lastInteractionMs >= timeoutMs) { if (nowMs - lastInteractionMs >= timeoutMs) {
ledcWrite(BACKLIGHT_PWM_CHANNEL, min(BACKLIGHT_DIMMED, normalBacklightPwm())); // Bewusst ganz aus (0) statt nur gedimmt - fuer den
// Bildschirm-Timeout (Menue > System > Timeout). Dimmen
// uebernimmt bereits der separate Nachtmodus
// (updateNightDimming()); der Inaktivitaets-Timeout soll das
// Display wirklich abschalten, z.B. fuer Plane-Spotter, die nur
// das Flugbuch mitlaufen lassen wollen, ohne den Screen zu
// brauchen. Ein Antippen weckt ihn ueber den screenDimmed-Zweig
// oben wieder auf die eingestellte Helligkeit (bzw. Nachtmodus-
// Helligkeit, falls gerade Nachtstunden sind).
ledcWrite(BACKLIGHT_PWM_CHANNEL, 0);
screenDimmed = true; screenDimmed = true;
} }
} }

View File

@@ -398,23 +398,23 @@ void run(TFT_eSPI& tft) {
tft.println(I18n::t(StringId::MENU_CATEGORY_FLIGHT)); tft.println(I18n::t(StringId::MENU_CATEGORY_FLIGHT));
// Reine An/Aus-Schalter (Heartbeat, Notfall-Alarm, Naeherungs-LED, // Reine An/Aus-Schalter (Heartbeat, Notfall-Alarm, Naeherungs-LED,
// Beobachtungsalarm, Bodenfahrzeuge-Filter) stehen bewusst // Flugbuch, Beobachtungsalarm, Bodenfahrzeuge-Filter) stehen
// gemeinsam am Ende der Liste, direkt ueber dem Zurueck-Button - // bewusst gemeinsam am Ende der Liste, direkt ueber dem
// und darunter wiederum die LED-gesteuerten Alarme (Heartbeat, // Zurueck-Button - zuerst die LED-gesteuerten Alarme (Heartbeat,
// Notfall, Naeherung, Beobachtung; siehe LedAlert::Mode) // Notfall, Naeherung; siehe LedAlert::Mode) zusammenhaengend,
// zusammenhaengend vor dem nicht-LED-basierten // danach die beiden nicht-LED-basierten Schalter Flugbuch und
// Bodenfahrzeuge-Filter. // Beobachtungsalarm sowie zuletzt der Bodenfahrzeuge-Filter.
Rect aircraftListBtn = flightRowRect(0); Rect aircraftListBtn = flightRowRect(0);
Rect statsBtn = flightRowRect(1); Rect statsBtn = flightRowRect(1);
Rect statsHistoryBtn = flightRowRect(2); Rect statsHistoryBtn = flightRowRect(2);
Rect logFilesBtn = flightRowRect(3); Rect logFilesBtn = flightRowRect(3);
Rect logbookBtn = flightRowRect(4); Rect locationBtn = flightRowRect(4);
Rect locationBtn = flightRowRect(5); Rect airlineBtn = flightRowRect(5);
Rect airlineBtn = flightRowRect(6); Rect watchlistBtn = flightRowRect(6);
Rect watchlistBtn = flightRowRect(7); Rect heartbeatBtn = flightRowRect(7);
Rect heartbeatBtn = flightRowRect(8); Rect emergencyBtn = flightRowRect(8);
Rect emergencyBtn = flightRowRect(9); Rect proximityBtn = flightRowRect(9);
Rect proximityBtn = flightRowRect(10); Rect logbookBtn = flightRowRect(10);
Rect watchlistAlertBtn = flightRowRect(11); Rect watchlistAlertBtn = flightRowRect(11);
Rect groundBtn = flightRowRect(12); Rect groundBtn = flightRowRect(12);
Rect backBtn = flightRowRect(13); Rect backBtn = flightRowRect(13);
@@ -423,13 +423,13 @@ void run(TFT_eSPI& tft) {
drawButton(tft, statsBtn, I18n::t(StringId::MENU_STATISTICS)); drawButton(tft, statsBtn, I18n::t(StringId::MENU_STATISTICS));
drawButton(tft, statsHistoryBtn, I18n::t(StringId::MENU_STATS_HISTORY)); drawButton(tft, statsHistoryBtn, I18n::t(StringId::MENU_STATS_HISTORY));
drawButton(tft, logFilesBtn, I18n::t(StringId::MENU_LOGBOOK_FILES)); drawButton(tft, logFilesBtn, I18n::t(StringId::MENU_LOGBOOK_FILES));
drawButton(tft, logbookBtn, I18n::t(StringId::MENU_FLIGHT_LOGBOOK) + onOff(SettingsStore::flightLogbookEnabled()));
drawButton(tft, locationBtn, I18n::t(StringId::MENU_LOCATION_PRESETS)); drawButton(tft, locationBtn, I18n::t(StringId::MENU_LOCATION_PRESETS));
drawButton(tft, airlineBtn, I18n::t(StringId::MENU_AIRLINE_FILTER)); drawButton(tft, airlineBtn, I18n::t(StringId::MENU_AIRLINE_FILTER));
drawButton(tft, watchlistBtn, I18n::t(StringId::MENU_WATCHLIST)); drawButton(tft, watchlistBtn, I18n::t(StringId::MENU_WATCHLIST));
drawButton(tft, heartbeatBtn, I18n::t(StringId::MENU_LED_HEARTBEAT) + onOff(SettingsStore::ledHeartbeatEnabled())); drawButton(tft, heartbeatBtn, I18n::t(StringId::MENU_LED_HEARTBEAT) + onOff(SettingsStore::ledHeartbeatEnabled()));
drawButton(tft, emergencyBtn, I18n::t(StringId::MENU_EMERGENCY_ALERT) + onOff(SettingsStore::emergencyAlertEnabled())); drawButton(tft, emergencyBtn, I18n::t(StringId::MENU_EMERGENCY_ALERT) + onOff(SettingsStore::emergencyAlertEnabled()));
drawButton(tft, proximityBtn, I18n::t(StringId::MENU_PROXIMITY_LED) + onOff(SettingsStore::proximityAlertEnabled())); drawButton(tft, proximityBtn, I18n::t(StringId::MENU_PROXIMITY_LED) + onOff(SettingsStore::proximityAlertEnabled()));
drawButton(tft, logbookBtn, I18n::t(StringId::MENU_FLIGHT_LOGBOOK) + onOff(SettingsStore::flightLogbookEnabled()));
drawButton(tft, watchlistAlertBtn, I18n::t(StringId::MENU_WATCHLIST_ALERT) + onOff(SettingsStore::watchlistAlertEnabled())); drawButton(tft, watchlistAlertBtn, I18n::t(StringId::MENU_WATCHLIST_ALERT) + onOff(SettingsStore::watchlistAlertEnabled()));
drawButton(tft, groundBtn, I18n::t(StringId::MENU_HIDE_GROUND) + onOff(SettingsStore::hideGroundVehicles())); drawButton(tft, groundBtn, I18n::t(StringId::MENU_HIDE_GROUND) + onOff(SettingsStore::hideGroundVehicles()));
drawButton(tft, backBtn, I18n::t(StringId::BACK_ARROW)); drawButton(tft, backBtn, I18n::t(StringId::BACK_ARROW));
@@ -454,6 +454,18 @@ void run(TFT_eSPI& tft) {
StatsHistoryScreen::run(tft); StatsHistoryScreen::run(tft);
} else if (logFilesBtn.contains(tap.x, tap.y)) { } else if (logFilesBtn.contains(tap.x, tap.y)) {
LogbookFilesScreen::run(tft); LogbookFilesScreen::run(tft);
} else if (locationBtn.contains(tap.x, tap.y)) {
LocationPresetsScreen::run(tft);
} else if (airlineBtn.contains(tap.x, tap.y)) {
AirlineFilterScreen::run(tft);
} else if (watchlistBtn.contains(tap.x, tap.y)) {
AircraftWatchlistScreen::run(tft);
} else if (heartbeatBtn.contains(tap.x, tap.y)) {
SettingsStore::setLedHeartbeatEnabled(!SettingsStore::ledHeartbeatEnabled());
} else if (emergencyBtn.contains(tap.x, tap.y)) {
SettingsStore::setEmergencyAlertEnabled(!SettingsStore::emergencyAlertEnabled());
} else if (proximityBtn.contains(tap.x, tap.y)) {
SettingsStore::setProximityAlertEnabled(!SettingsStore::proximityAlertEnabled());
} else if (logbookBtn.contains(tap.x, tap.y)) { } else if (logbookBtn.contains(tap.x, tap.y)) {
if (SettingsStore::flightLogbookEnabled()) { if (SettingsStore::flightLogbookEnabled()) {
// Ausschalten ist immer unbedenklich - keine Bestaetigung noetig. // Ausschalten ist immer unbedenklich - keine Bestaetigung noetig.
@@ -468,18 +480,6 @@ void run(TFT_eSPI& tft) {
// vorhandene alte Datei weiterzuschreiben. // vorhandene alte Datei weiterzuschreiben.
SettingsStore::setFlightLogbookSessionFile(""); SettingsStore::setFlightLogbookSessionFile("");
} }
} else if (locationBtn.contains(tap.x, tap.y)) {
LocationPresetsScreen::run(tft);
} else if (airlineBtn.contains(tap.x, tap.y)) {
AirlineFilterScreen::run(tft);
} else if (watchlistBtn.contains(tap.x, tap.y)) {
AircraftWatchlistScreen::run(tft);
} else if (heartbeatBtn.contains(tap.x, tap.y)) {
SettingsStore::setLedHeartbeatEnabled(!SettingsStore::ledHeartbeatEnabled());
} else if (emergencyBtn.contains(tap.x, tap.y)) {
SettingsStore::setEmergencyAlertEnabled(!SettingsStore::emergencyAlertEnabled());
} else if (proximityBtn.contains(tap.x, tap.y)) {
SettingsStore::setProximityAlertEnabled(!SettingsStore::proximityAlertEnabled());
} else if (watchlistAlertBtn.contains(tap.x, tap.y)) { } else if (watchlistAlertBtn.contains(tap.x, tap.y)) {
SettingsStore::setWatchlistAlertEnabled(!SettingsStore::watchlistAlertEnabled()); SettingsStore::setWatchlistAlertEnabled(!SettingsStore::watchlistAlertEnabled());
} else if (groundBtn.contains(tap.x, tap.y)) { } else if (groundBtn.contains(tap.x, tap.y)) {