From 9b48a5667c774c90b90df8d4b232a271abef175f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 16 Feb 2024 12:47:06 +0000 Subject: [PATCH] ui: Add toggles for Feature Status and Onroad Settings --- CHANGELOGS.md | 5 +++++ common/params.cc | 2 ++ selfdrive/manager/manager.py | 2 ++ .../ui/qt/offroad/sunnypilot/visuals_settings.cc | 12 ++++++++++++ selfdrive/ui/qt/onroad.cc | 6 ++++-- selfdrive/ui/qt/onroad.h | 2 ++ selfdrive/ui/qt/onroad_settings.cc | 2 +- selfdrive/ui/ui.cc | 2 ++ selfdrive/ui/ui.h | 3 +++ 9 files changed, 33 insertions(+), 3 deletions(-) diff --git a/CHANGELOGS.md b/CHANGELOGS.md index 7f729fc9cf..8a16d8d17e 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -26,6 +26,11 @@ sunnypilot - 0.9.6.0 (2024-xx-xx) * UPDATED: Custom Offsets * Continued support for Legacy Driving Models (e.g., ND, BDv2, BDv1, FV, NS) * Deprecate support for newer Driving Models (e.g., CHv2, CH, LAv2, LAv1) +* UI Updates + * NEW❗: Visuals: Display Feature Status toggle + * Display the statuses of certain features on the driving screen + * NEW❗: Visuals: Enable Onroad Settings toggle + * Display the Onroad Settings button on the driving screen to adjust feature options on the driving screen, without navigating into the settings menu * FIXED: New comma 3X support * FIXED: New comma eSIM support * Bug fixes and performance improvements diff --git a/common/params.cc b/common/params.cc index 354f6b400f..a72c05f0e4 100644 --- a/common/params.cc +++ b/common/params.cc @@ -253,6 +253,7 @@ std::unordered_map keys = { {"EndToEndLongToggle", PERSISTENT}, {"EnforceTorqueLateral", PERSISTENT}, {"EnhancedScc", PERSISTENT}, + {"FeatureStatus", PERSISTENT}, {"FleetManagerPin", PERSISTENT}, {"GmapKey", PERSISTENT}, {"HandsOnWheelMonitoring", PERSISTENT}, @@ -278,6 +279,7 @@ std::unordered_map keys = { {"OnroadScreenOff", PERSISTENT}, {"OnroadScreenOffBrightness", PERSISTENT}, {"OnroadScreenOffEvent", PERSISTENT}, + {"OnroadSettings", PERSISTENT}, {"OsmLocal", PERSISTENT}, {"OsmLocationName", PERSISTENT}, {"OsmLocationTitle", PERSISTENT}, diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index e39892a13b..e76e5d8839 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -65,6 +65,7 @@ def manager_init() -> None: ("DynamicLaneProfile", "1"), ("EnableMads", "1"), ("EnhancedScc", "0"), + ("FeatureStatus", "1"), ("HandsOnWheelMonitoring", "0"), ("HideVEgoUi", "0"), ("LastSpeedLimitSignTap", "0"), @@ -75,6 +76,7 @@ def manager_init() -> None: ("OnroadScreenOff", "-2"), ("OnroadScreenOffBrightness", "50"), ("OnroadScreenOffEvent", "1"), + ("OnroadSettings", "1"), ("PathOffset", "0"), ("ReverseAccChange", "0"), ("ScreenRecorder", "1"), diff --git a/selfdrive/ui/qt/offroad/sunnypilot/visuals_settings.cc b/selfdrive/ui/qt/offroad/sunnypilot/visuals_settings.cc index f75b98ac9e..e1061f29bf 100644 --- a/selfdrive/ui/qt/offroad/sunnypilot/visuals_settings.cc +++ b/selfdrive/ui/qt/offroad/sunnypilot/visuals_settings.cc @@ -27,6 +27,18 @@ VisualsPanel::VisualsPanel(QWidget *parent) : ListWidget(parent) { tr("OSM: Show UI elements that aid debugging."), "../assets/offroad/icon_blank.png", }, + { + "FeatureStatus", + tr("Display Feature Status"), + tr("Display the statuses of certain features on the driving screen."), + "../assets/offroad/icon_blank.png", + }, + { + "OnroadSettings", + tr("Enable Onroad Settings"), + tr("Display the Onroad Settings button on the driving screen to adjust feature options on the driving screen, without navigating into the settings menu."), + "../assets/offroad/icon_blank.png", + }, { "TrueVEgoUi", tr("Speedometer: Display True Speed"), diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 1a424d45a7..b1930a2495 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -354,7 +354,7 @@ void OnroadSettingsButton::paintEvent(QPaintEvent *event) { void OnroadSettingsButton::updateState(const UIState &s) { const auto cp = (*s.sm)["carParams"].getCarParams(); auto dlp_enabled = true; - bool allow_btn = dlp_enabled || hasLongitudinalControl(cp) || !cp.getPcmCruiseSpeed(); + bool allow_btn = s.scene.onroad_settings_toggle && (dlp_enabled || hasLongitudinalControl(cp) || !cp.getPcmCruiseSpeed()); setVisible(allow_btn); setEnabled(allow_btn); @@ -734,6 +734,8 @@ void AnnotatedCameraWidget::updateState(const UIState &s) { e2eStatus = chime_prompt; e2eState = e2eLStatus; + featureStatusToggle = s.scene.feature_status_toggle; + experimental_btn->setVisible(!(showDebugUI && showVTC)); } @@ -911,7 +913,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) { drawE2eStatus(p, UI_BORDER_SIZE * 2 + 190, 45, 150, 150, e2eState); } - if (!hideBottomIcons) { + if (!hideBottomIcons && featureStatusToggle) { drawFeatureStatusText(p, UI_BORDER_SIZE * 2 + 370, rect().bottom() - 160 - uiState()->scene.rn_offset); } diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index 091a47da88..67d871af93 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -243,6 +243,8 @@ private: QPixmap plus_arrow_up_img; QPixmap minus_arrow_down_img; + bool featureStatusToggle; + protected: void paintGL() override; void initializeGL() override; diff --git a/selfdrive/ui/qt/onroad_settings.cc b/selfdrive/ui/qt/onroad_settings.cc index e33e769f7e..0e56c47de4 100644 --- a/selfdrive/ui/qt/onroad_settings.cc +++ b/selfdrive/ui/qt/onroad_settings.cc @@ -89,7 +89,7 @@ OnroadSettings::OnroadSettings(bool closeable, QWidget *parent) : QFrame(parent) auto *subtitle_heading = new QVBoxLayout; subtitle_heading->setContentsMargins(0, 0, 0, 0); { - auto *subtitle = new QLabel(tr("SUNNYPILOT FEATURES"), this); + auto *subtitle = new QLabel(tr("ONROAD SETTINGS | SUNNYPILOT"), this); subtitle->setStyleSheet("color: #A0A0A0; font-size: 34px; font-weight: 300;"); subtitle_heading->addWidget(subtitle, 0, Qt::AlignCenter); } diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 3ac796124d..d0003e2c85 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -265,6 +265,8 @@ void ui_update_params(UIState *s) { s->scene.speed_limit_warning_value_offset = std::atoi(params.get("SpeedLimitWarningValueOffset").c_str()); s->scene.driving_model_gen = std::atoi(params.get("DrivingModelGeneration").c_str()); s->scene.speed_limit_control_enabled = params.getBool("EnableSlc"); + s->scene.feature_status_toggle = params.getBool("FeatureStatus"); + s->scene.onroad_settings_toggle = params.getBool("OnroadSettings"); // Handle Onroad Screen Off params if (s->scene.onroadScreenOff > 0) { diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 9595357fab..0f3e434181 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -257,6 +257,9 @@ typedef struct UIScene { int speed_limit_warning_value_offset; int driving_model_gen; + + bool feature_status_toggle; + bool onroad_settings_toggle; } UIScene; class UIState : public QObject {