ui: Add toggles for Feature Status and Onroad Settings

This commit is contained in:
Jason Wen
2024-02-16 12:47:06 +00:00
parent efd6c7554b
commit 9b48a5667c
9 changed files with 33 additions and 3 deletions
+5
View File
@@ -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
+2
View File
@@ -253,6 +253,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"EndToEndLongToggle", PERSISTENT},
{"EnforceTorqueLateral", PERSISTENT},
{"EnhancedScc", PERSISTENT},
{"FeatureStatus", PERSISTENT},
{"FleetManagerPin", PERSISTENT},
{"GmapKey", PERSISTENT},
{"HandsOnWheelMonitoring", PERSISTENT},
@@ -278,6 +279,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"OnroadScreenOff", PERSISTENT},
{"OnroadScreenOffBrightness", PERSISTENT},
{"OnroadScreenOffEvent", PERSISTENT},
{"OnroadSettings", PERSISTENT},
{"OsmLocal", PERSISTENT},
{"OsmLocationName", PERSISTENT},
{"OsmLocationTitle", PERSISTENT},
+2
View File
@@ -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"),
@@ -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"),
+4 -2
View File
@@ -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);
}
+2
View File
@@ -243,6 +243,8 @@ private:
QPixmap plus_arrow_up_img;
QPixmap minus_arrow_down_img;
bool featureStatusToggle;
protected:
void paintGL() override;
void initializeGL() override;
+1 -1
View File
@@ -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("<b>ONROAD SETTINGS | SUNNYPILOT</b>"), this);
subtitle->setStyleSheet("color: #A0A0A0; font-size: 34px; font-weight: 300;");
subtitle_heading->addWidget(subtitle, 0, Qt::AlignCenter);
}
+2
View File
@@ -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) {
+3
View File
@@ -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 {