From 7aac14e6fced40663c09fc2103deab017f11b95f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 8 Oct 2025 21:54:24 -0400 Subject: [PATCH] ui: Speedometer: Hide from onroad screen (#1336) * ui: Speedometer: Display True Speed * update * ui: Speedometer: Hide from onroad screen * wrong * use stock one --- common/params_keys.h | 1 + .../ui/sunnypilot/qt/offroad/settings/visuals_panel.cc | 7 +++++++ selfdrive/ui/sunnypilot/qt/onroad/hud.cc | 5 +++++ selfdrive/ui/sunnypilot/qt/onroad/hud.h | 1 + selfdrive/ui/sunnypilot/ui.cc | 1 + selfdrive/ui/sunnypilot/ui_scene.h | 1 + 6 files changed, 16 insertions(+) diff --git a/common/params_keys.h b/common/params_keys.h index 1c7b9985ca..f2aca858b2 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -150,6 +150,7 @@ inline static std::unordered_map keys = { {"EnableGithubRunner", {PERSISTENT | BACKUP, BOOL}}, {"GreenLightAlert", {PERSISTENT | BACKUP, BOOL, "0"}}, {"GithubRunnerSufficientVoltage", {CLEAR_ON_MANAGER_START , BOOL}}, + {"HideVEgoUI", {PERSISTENT | BACKUP, BOOL, "0"}}, {"IntelligentCruiseButtonManagement", {PERSISTENT | BACKUP , BOOL}}, {"InteractivityTimeout", {PERSISTENT | BACKUP, INT, "0"}}, {"IsDevelopmentBranch", {CLEAR_ON_MANAGER_START, BOOL}}, diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc index 98f5634409..8e26494a93 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc @@ -76,6 +76,13 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) { "", false, }, + { + "HideVEgoUI", + tr("Speedometer: Hide from Onroad Screen"), + tr("Always display the true vehicle current speed from wheel speed sensors."), + "", + false, + } }; // Add regular toggles first diff --git a/selfdrive/ui/sunnypilot/qt/onroad/hud.cc b/selfdrive/ui/sunnypilot/qt/onroad/hud.cc index e539f1c110..510fc2d69c 100644 --- a/selfdrive/ui/sunnypilot/qt/onroad/hud.cc +++ b/selfdrive/ui/sunnypilot/qt/onroad/hud.cc @@ -119,6 +119,7 @@ void HudRendererSP::updateState(const UIState &s) { // override stock current speed values float v_ego = (v_ego_cluster_seen && !s.scene.trueVEgoUI) ? car_state.getVEgoCluster() : car_state.getVEgo(); speed = std::max(0.0f, v_ego * (is_metric ? MS_TO_KPH : MS_TO_MPH)); + hideVEgoUI = s.scene.hideVEgoUI; } void HudRendererSP::draw(QPainter &p, const QRect &surface_rect) { @@ -133,6 +134,10 @@ void HudRendererSP::draw(QPainter &p, const QRect &surface_rect) { } drawCurrentSpeedSP(p, surface_rect); + if (!hideVEgoUI) { + drawCurrentSpeedSP(p, surface_rect); + } + if (!reversing) { // Smart Cruise Control int x_offset = -260; diff --git a/selfdrive/ui/sunnypilot/qt/onroad/hud.h b/selfdrive/ui/sunnypilot/qt/onroad/hud.h index 066a01c800..16179b02a9 100644 --- a/selfdrive/ui/sunnypilot/qt/onroad/hud.h +++ b/selfdrive/ui/sunnypilot/qt/onroad/hud.h @@ -107,4 +107,5 @@ private: QPixmap lead_depart_alert_large_img; QString alert_text; QPixmap alert_img; + bool hideVEgoUI; }; diff --git a/selfdrive/ui/sunnypilot/ui.cc b/selfdrive/ui/sunnypilot/ui.cc index 30472ebdbc..e4d5b41adb 100644 --- a/selfdrive/ui/sunnypilot/ui.cc +++ b/selfdrive/ui/sunnypilot/ui.cc @@ -65,6 +65,7 @@ void ui_update_params_sp(UIStateSP *s) { s->scene.speed_limit_mode = std::atoi(params.get("SpeedLimitMode").c_str()); s->scene.road_name = params.getBool("RoadNameToggle"); s->scene.trueVEgoUI = params.getBool("TrueVEgoUI"); + s->scene.hideVEgoUI = params.getBool("HideVEgoUI"); // Onroad Screen Brightness s->scene.onroadScreenOffBrightness = std::atoi(params.get("OnroadScreenOffBrightness").c_str()); diff --git a/selfdrive/ui/sunnypilot/ui_scene.h b/selfdrive/ui/sunnypilot/ui_scene.h index 6675916f38..5bf1156648 100644 --- a/selfdrive/ui/sunnypilot/ui_scene.h +++ b/selfdrive/ui/sunnypilot/ui_scene.h @@ -16,4 +16,5 @@ typedef struct UISceneSP : UIScene { bool onroadScreenOffControl; int onroadScreenOffTimerParam; bool trueVEgoUI; + bool hideVEgoUI; } UISceneSP;