Visuals - Quality of Life - Driver Camera On Reverse

Added toggle to show the driver camera when in the reverse gear.
This commit is contained in:
FrogAi 2024-05-26 23:10:53 -07:00
parent 0ce100c7ce
commit c4a5749c6c
4 changed files with 13 additions and 3 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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;