From 005c6aed95eee2c2896601ed2d7a51e81e14383e Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 22 Sep 2025 08:54:16 -0400 Subject: [PATCH] ui: separate road name toggle param and bigger fonts (#1277) * ui: separate road name toggle param and bigger fonts * slightly lower --- common/params_keys.h | 3 ++- selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc | 2 +- selfdrive/ui/sunnypilot/qt/onroad/hud.cc | 4 ++-- selfdrive/ui/sunnypilot/ui.cc | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/params_keys.h b/common/params_keys.h index e9ffcfc1fd..32a7695b3b 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -224,7 +224,8 @@ inline static std::unordered_map keys = { {"OsmStateName", {PERSISTENT, STRING, "All"}}, {"OsmStateTitle", {PERSISTENT, STRING}}, {"OsmWayTest", {PERSISTENT, STRING}}, - {"RoadName", {PERSISTENT, STRING}}, + {"RoadName", {CLEAR_ON_ONROAD_TRANSITION, STRING}}, + {"RoadNameToggle", {PERSISTENT, STRING}}, // Speed Limit {"SpeedLimitMode", {PERSISTENT | BACKUP, INT, "1"}}, diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc index ca58282a3d..10ead53774 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/visuals_panel.cc @@ -43,7 +43,7 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) { false, }, { - "RoadName", + "RoadNameToggle", tr("Display Road Name"), tr("Displays the name of the road the car is traveling on. The OpenStreetMap database of the location must be downloaded from the OSM panel to fetch the road name."), "", diff --git a/selfdrive/ui/sunnypilot/qt/onroad/hud.cc b/selfdrive/ui/sunnypilot/qt/onroad/hud.cc index db6ca1952b..9409612f47 100644 --- a/selfdrive/ui/sunnypilot/qt/onroad/hud.cc +++ b/selfdrive/ui/sunnypilot/qt/onroad/hud.cc @@ -528,7 +528,7 @@ void HudRendererSP::drawRoadName(QPainter &p, const QRect &surface_rect) { if (!roadName || roadNameStr.isEmpty()) return; // Measure text to size container - p.setFont(InterFont(40, QFont::Normal)); + p.setFont(InterFont(46, QFont::DemiBold)); QFontMetrics fm(p.font()); int text_width = fm.horizontalAdvance(roadNameStr); @@ -541,7 +541,7 @@ void HudRendererSP::drawRoadName(QPainter &p, const QRect &surface_rect) { rect_width = std::max(min_width, std::min(rect_width, max_width)); // Center at top of screen - QRect road_rect(surface_rect.width() / 2 - rect_width / 2, -6, rect_width, 60); + QRect road_rect(surface_rect.width() / 2 - rect_width / 2, -4, rect_width, 60); p.setPen(Qt::NoPen); p.setBrush(QColor(0, 0, 0, 120)); diff --git a/selfdrive/ui/sunnypilot/ui.cc b/selfdrive/ui/sunnypilot/ui.cc index 9acf844088..fd7365821c 100644 --- a/selfdrive/ui/sunnypilot/ui.cc +++ b/selfdrive/ui/sunnypilot/ui.cc @@ -54,7 +54,7 @@ void ui_update_params_sp(UIStateSP *s) { s->scene.dev_ui_info = std::atoi(params.get("DevUIInfo").c_str()); s->scene.standstill_timer = params.getBool("StandstillTimer"); s->scene.speed_limit_mode = std::atoi(params.get("SpeedLimitMode").c_str()); - s->scene.road_name = params.getBool("RoadName"); + s->scene.road_name = params.getBool("RoadNameToggle"); } DeviceSP::DeviceSP(QObject *parent) : Device(parent) {