From 89ab6b591acee76bb816c910ae574c42395f7354 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sat, 11 May 2024 15:38:15 -0700 Subject: [PATCH] Visuals - Screen Management - Hide UI Elements - Alerts Hide non-critical alerts on the onroad screen. --- selfdrive/ui/qt/onroad/alerts.cc | 6 ++++++ selfdrive/ui/qt/onroad/alerts.h | 1 + selfdrive/ui/ui.cc | 4 ++++ selfdrive/ui/ui.h | 1 + 4 files changed, 12 insertions(+) diff --git a/selfdrive/ui/qt/onroad/alerts.cc b/selfdrive/ui/qt/onroad/alerts.cc index 1c3447d3b..1914f5943 100644 --- a/selfdrive/ui/qt/onroad/alerts.cc +++ b/selfdrive/ui/qt/onroad/alerts.cc @@ -15,6 +15,7 @@ void OnroadAlerts::updateState(const UIState &s) { // FrogPilot variables const UIScene &scene = s.scene; + hideAlerts = scene.hide_alerts; roadNameUI = scene.road_name_ui; showAOLStatusBar = scene.show_aol_status_bar; showCEMStatusBar = scene.show_cem_status_bar; @@ -65,6 +66,11 @@ void OnroadAlerts::paintEvent(QPaintEvent *event) { if (alert.size == cereal::ControlsState::AlertSize::NONE) { return; } + + if (hideAlerts && alert.status == cereal::ControlsState::AlertStatus::NORMAL) { + return; + } + static std::map alert_heights = { {cereal::ControlsState::AlertSize::SMALL, 271}, {cereal::ControlsState::AlertSize::MID, 420}, diff --git a/selfdrive/ui/qt/onroad/alerts.h b/selfdrive/ui/qt/onroad/alerts.h index 8efac918d..65cbb86e0 100644 --- a/selfdrive/ui/qt/onroad/alerts.h +++ b/selfdrive/ui/qt/onroad/alerts.h @@ -41,6 +41,7 @@ protected: Alert alert = {}; // FrogPilot variables + bool hideAlerts; bool roadNameUI; bool showAOLStatusBar; bool showCEMStatusBar; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 2cc51508d..3f8842a2f 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -428,6 +428,10 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { scene.stopped_timer = quality_of_life_visuals && params.getBool("StoppedTimer"); scene.wheel_speed = quality_of_life_visuals && params.getBool("WheelSpeed"); + bool screen_management = params.getBool("ScreenManagement"); + bool hide_ui_elements = screen_management && params.getBool("HideUIElements"); + scene.hide_alerts = hide_ui_elements && params.getBool("HideAlerts"); + scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController"); scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset"); scene.show_slc_offset_ui = scene.speed_limit_controller && params.getBool("ShowSLCOffsetUI"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 0b166c24c..9d6d6e660 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -145,6 +145,7 @@ typedef struct UIScene { bool full_map; bool has_auto_tune; bool has_lead; + bool hide_alerts; bool hide_lead_marker; bool hide_speed; bool hide_speed_ui;