From 8984a623fde03746a26a635cf69a8fcc2d5b561e Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sat, 11 May 2024 15:11:23 -0700 Subject: [PATCH] Visuals - Quality of Life - Hide Speed Hide the speed indicator in the onroad UI. Additional toggle allows it to be hidden/shown via tapping the speed itself. --- selfdrive/ui/qt/onroad/annotated_camera.cc | 4 +++- selfdrive/ui/qt/onroad/annotated_camera.h | 1 + selfdrive/ui/qt/onroad/onroad_home.cc | 7 +++++++ selfdrive/ui/ui.cc | 2 ++ selfdrive/ui/ui.h | 2 ++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index 9cbc2d475..74cf1a38b 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -224,7 +224,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) { p.restore(); // current speed - if (!bigMapOpen) { + if (!(bigMapOpen || hideSpeed)) { p.setFont(InterFont(176, QFont::Bold)); drawText(p, rect().center().x(), 210, speedStr); p.setFont(InterFont(66)); @@ -843,6 +843,8 @@ void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &painter, const UISce experimentalMode = scene.experimental_mode; + hideSpeed = scene.hide_speed; + laneDetectionWidth = scene.lane_detection_width; laneWidthLeft = scene.lane_width_left; laneWidthRight = scene.lane_width_right; diff --git a/selfdrive/ui/qt/onroad/annotated_camera.h b/selfdrive/ui/qt/onroad/annotated_camera.h index e63889053..f74290721 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.h +++ b/selfdrive/ui/qt/onroad/annotated_camera.h @@ -111,6 +111,7 @@ private: bool blindSpotRight; bool compass; bool experimentalMode; + bool hideSpeed; bool leadInfo; bool mapOpen; bool onroadDistanceButton; diff --git a/selfdrive/ui/qt/onroad/onroad_home.cc b/selfdrive/ui/qt/onroad/onroad_home.cc index 25846737a..f1fcbf4ec 100644 --- a/selfdrive/ui/qt/onroad/onroad_home.cc +++ b/selfdrive/ui/qt/onroad/onroad_home.cc @@ -127,6 +127,7 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) { QRect leftRect(0, 0, size.width() / 2, size.height()); QRect rightRect(size.width() / 2, 0, size.width() / 2, size.height()); + QRect hideSpeedRect(rect().center().x() - 175, 50, 350, 350); QRect maxSpeedRect(7, 25, 225, 225); QRect speedLimitRect(7, 250, 225, 225); @@ -144,6 +145,12 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) { return; } + if (hideSpeedRect.contains(pos) && scene.hide_speed_ui) { + scene.hide_speed = !scene.hide_speed; + params.putBoolNonBlocking("HideSpeed", scene.hide_speed); + return; + } + if (speedLimitRect.contains(pos) && scene.show_slc_offset_ui) { scene.show_slc_offset = !scene.show_slc_offset; params.putBoolNonBlocking("ShowSLCOffset", scene.show_slc_offset); diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index a9c4a037d..e05b37056 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -422,6 +422,8 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { 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.hide_speed = quality_of_life_visuals && params.getBool("HideSpeed"); + scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI"); scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController"); scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 01cd53644..d11dfc256 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -146,6 +146,8 @@ typedef struct UIScene { bool has_auto_tune; bool has_lead; bool hide_lead_marker; + bool hide_speed; + bool hide_speed_ui; bool holiday_themes; bool is_CPU; bool is_GPU;