diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 4b04357..8c54ea4 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -67,6 +67,10 @@ void HomeWindow::updateState(const UIState &s) { body->setEnabled(true); slayout->setCurrentWidget(body); } + + if (s.scene.started) { + showDriverView(s.scene.driver_camera_timer >= 10, true); + } } void HomeWindow::offroadTransition(bool offroad) { @@ -80,10 +84,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); @@ -93,7 +98,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 13d97b0..5ea4a16 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 24eb7cc..74e565d 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -237,6 +237,7 @@ static void update_state(UIState *s) { scene.blind_spot_left = carState.getLeftBlindspot(); scene.blind_spot_right = carState.getRightBlindspot(); scene.parked = carState.getGearShifter() == cereal::CarState::GearShifter::PARK; + scene.reverse = carState.getGearShifter() == cereal::CarState::GearShifter::REVERSE; scene.standstill = carState.getStandstill(); scene.steering_angle_deg = -carState.getSteeringAngleDeg(); scene.turn_signal_left = carState.getLeftBlinker(); @@ -401,6 +402,7 @@ void ui_update_frogpilot_params(UIState *s) { 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"); @@ -480,6 +482,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; } void UIState::setPrimeType(PrimeType type) { diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 70b035f..fd84d13 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -199,6 +199,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; @@ -226,6 +227,7 @@ typedef struct UIScene { bool parked; bool pedals_on_ui; bool random_events; + bool reverse; bool reverse_cruise; bool reverse_cruise_ui; bool right_hand_drive; @@ -291,6 +293,7 @@ typedef struct UIScene { int custom_icons; int custom_signals; int desired_follow; + int driver_camera_timer; int obstacle_distance; int obstacle_distance_stock; int steering_angle_deg;