From 734eca32a66dccde3bde79922c20fb8eeeb38964 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sun, 26 May 2024 23:10:53 -0700 Subject: [PATCH] Visuals - Quality of Life - Driver Camera On Reverse Added toggle to show the driver camera when in the reverse gear. --- selfdrive/ui/qt/home.cc | 5 +++-- selfdrive/ui/qt/home.h | 2 +- selfdrive/ui/ui.cc | 2 ++ selfdrive/ui/ui.h | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index eade15942..43a59ecde 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -70,6 +70,7 @@ void HomeWindow::updateState(const UIState &s) { } if (s.scene.started) { + showDriverView(s.scene.driver_camera_timer >= 10, true); if (s.scene.map_open) { showSidebar(false); } @@ -87,10 +88,11 @@ void HomeWindow::offroadTransition(bool offroad) { } } -void HomeWindow::showDriverView(bool show) { +void HomeWindow::showDriverView(bool show, bool started) { if (show) { emit closeSettings(); slayout->setCurrentWidget(driver_view); + sidebar->setVisible(show == false); } else { if (started) { slayout->setCurrentWidget(onroad); @@ -100,7 +102,6 @@ void HomeWindow::showDriverView(bool show) { sidebar->setVisible(show == false); } } - sidebar->setVisible(show == false); } void HomeWindow::mousePressEvent(QMouseEvent* e) { diff --git a/selfdrive/ui/qt/home.h b/selfdrive/ui/qt/home.h index 3a9ca3802..b400b20b1 100644 --- a/selfdrive/ui/qt/home.h +++ b/selfdrive/ui/qt/home.h @@ -56,7 +56,7 @@ signals: public slots: void offroadTransition(bool offroad); - void showDriverView(bool show); + void showDriverView(bool show, bool started=false); void showSidebar(bool show); void showMapPanel(bool show); diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 7e6e97a35..a9c4a037d 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -421,6 +421,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { scene.big_map = quality_of_life_visuals && params.getBool("BigMap"); scene.full_map = scene.big_map && params.getBool("FullMap"); scene.camera_view = quality_of_life_visuals ? params.getInt("CameraView") : 0; + scene.driver_camera = quality_of_life_visuals && params.getBool("DriverCamera"); scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController"); scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset"); @@ -524,6 +525,7 @@ void UIState::update() { scene.conditional_status = scene.conditional_experimental && scene.enabled ? paramsMemory.getInt("CEStatus") : 0; scene.current_holiday_theme = scene.holiday_themes ? paramsMemory.getInt("CurrentHolidayTheme") : 0; scene.current_random_event = scene.random_events ? paramsMemory.getInt("CurrentRandomEvent") : 0; + scene.driver_camera_timer = scene.driver_camera && scene.reverse ? scene.driver_camera_timer + 1 : 0; scene.started_timer = scene.started || started_prev ? scene.started_timer + 1 : 0; } diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 323f2482b..01cd53644 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -135,6 +135,7 @@ typedef struct UIScene { bool conditional_experimental; bool disable_smoothing_mtsc; bool disable_smoothing_vtsc; + bool driver_camera; bool dynamic_path_width; bool dynamic_pedals_on_ui; bool enabled; @@ -235,6 +236,7 @@ typedef struct UIScene { int custom_icons; int custom_signals; int desired_follow; + int driver_camera_timer; int model_length; int obstacle_distance; int obstacle_distance_stock;