From b28f9a76864861704eb1cb7bead940207d94c57a Mon Sep 17 00:00:00 2001 From: Eiswolf-BG <37225519+Eiswolf-BG@users.noreply.github.com> Date: Mon, 10 Aug 2026 19:33:02 +0200 Subject: [PATCH] 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 --- src/main.cpp | 12 +++++++++-- src/menu_screen.cpp | 52 ++++++++++++++++++++++----------------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 98aca78..d854ea1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,7 +52,6 @@ bool wasEmergency = false; bool bannerBlinkOn = false; constexpr uint8_t BACKLIGHT_FULL = 255; -constexpr uint8_t BACKLIGHT_DIMMED = 12; constexpr uint8_t BACKLIGHT_PWM_CHANNEL = 0; uint32_t lastInteractionMs = 0; bool screenDimmed = false; @@ -605,7 +604,16 @@ void loop() { if (!screenDimmed && timeoutMin > 0) { uint32_t timeoutMs = (uint32_t)timeoutMin * 60000UL; 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; } } diff --git a/src/menu_screen.cpp b/src/menu_screen.cpp index 1153df6..13afc65 100644 --- a/src/menu_screen.cpp +++ b/src/menu_screen.cpp @@ -398,23 +398,23 @@ void run(TFT_eSPI& tft) { tft.println(I18n::t(StringId::MENU_CATEGORY_FLIGHT)); // Reine An/Aus-Schalter (Heartbeat, Notfall-Alarm, Naeherungs-LED, - // Beobachtungsalarm, Bodenfahrzeuge-Filter) stehen bewusst - // gemeinsam am Ende der Liste, direkt ueber dem Zurueck-Button - - // und darunter wiederum die LED-gesteuerten Alarme (Heartbeat, - // Notfall, Naeherung, Beobachtung; siehe LedAlert::Mode) - // zusammenhaengend vor dem nicht-LED-basierten - // Bodenfahrzeuge-Filter. + // Flugbuch, Beobachtungsalarm, Bodenfahrzeuge-Filter) stehen + // bewusst gemeinsam am Ende der Liste, direkt ueber dem + // Zurueck-Button - zuerst die LED-gesteuerten Alarme (Heartbeat, + // Notfall, Naeherung; siehe LedAlert::Mode) zusammenhaengend, + // danach die beiden nicht-LED-basierten Schalter Flugbuch und + // Beobachtungsalarm sowie zuletzt der Bodenfahrzeuge-Filter. Rect aircraftListBtn = flightRowRect(0); Rect statsBtn = flightRowRect(1); Rect statsHistoryBtn = flightRowRect(2); Rect logFilesBtn = flightRowRect(3); - Rect logbookBtn = flightRowRect(4); - Rect locationBtn = flightRowRect(5); - Rect airlineBtn = flightRowRect(6); - Rect watchlistBtn = flightRowRect(7); - Rect heartbeatBtn = flightRowRect(8); - Rect emergencyBtn = flightRowRect(9); - Rect proximityBtn = flightRowRect(10); + Rect locationBtn = flightRowRect(4); + Rect airlineBtn = flightRowRect(5); + Rect watchlistBtn = flightRowRect(6); + Rect heartbeatBtn = flightRowRect(7); + Rect emergencyBtn = flightRowRect(8); + Rect proximityBtn = flightRowRect(9); + Rect logbookBtn = flightRowRect(10); Rect watchlistAlertBtn = flightRowRect(11); Rect groundBtn = flightRowRect(12); Rect backBtn = flightRowRect(13); @@ -423,13 +423,13 @@ void run(TFT_eSPI& tft) { drawButton(tft, statsBtn, I18n::t(StringId::MENU_STATISTICS)); drawButton(tft, statsHistoryBtn, I18n::t(StringId::MENU_STATS_HISTORY)); 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, airlineBtn, I18n::t(StringId::MENU_AIRLINE_FILTER)); drawButton(tft, watchlistBtn, I18n::t(StringId::MENU_WATCHLIST)); 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, 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, groundBtn, I18n::t(StringId::MENU_HIDE_GROUND) + onOff(SettingsStore::hideGroundVehicles())); drawButton(tft, backBtn, I18n::t(StringId::BACK_ARROW)); @@ -454,6 +454,18 @@ void run(TFT_eSPI& tft) { StatsHistoryScreen::run(tft); } else if (logFilesBtn.contains(tap.x, tap.y)) { 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)) { if (SettingsStore::flightLogbookEnabled()) { // Ausschalten ist immer unbedenklich - keine Bestaetigung noetig. @@ -468,18 +480,6 @@ void run(TFT_eSPI& tft) { // vorhandene alte Datei weiterzuschreiben. 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)) { SettingsStore::setWatchlistAlertEnabled(!SettingsStore::watchlistAlertEnabled()); } else if (groundBtn.contains(tap.x, tap.y)) {