diff --git a/common/params.cc b/common/params.cc index 87959b0..a95a8a5 100644 --- a/common/params.cc +++ b/common/params.cc @@ -254,6 +254,7 @@ std::unordered_map keys = { {"GasRegenCmd", PERSISTENT}, {"GoatScream", PERSISTENT}, {"GreenLightAlert", PERSISTENT}, + {"HideSpeed", PERSISTENT}, {"LaneLinesWidth", PERSISTENT}, {"LateralTune", PERSISTENT}, {"LeadInfo", PERSISTENT}, diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 688fc7f..f2870d5 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -106,8 +106,16 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) { // FrogPilot clickable widgets bool widgetClicked = false; + // Hide speed button + QRect speedRect(rect().center().x() - 175, 50, 350, 350); + bool isSpeedClicked = speedRect.contains(e->pos()); + + if (isSpeedClicked) { + speedHidden = !params.getBool("HideSpeed"); + params.putBoolNonBlocking("HideSpeed", speedHidden); + widgetClicked = true; // If the click wasn't for anything specific, change the value of "ExperimentalMode" - if (scene.experimental_mode_via_press && e->pos() != timeoutPoint) { + } else if (scene.experimental_mode_via_press && e->pos() != timeoutPoint) { if (clickTimer.isActive()) { clickTimer.stop(); if (scene.conditional_experimental) { @@ -552,10 +560,12 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) { } // current speed - p.setFont(InterFont(176, QFont::Bold)); - drawText(p, rect().center().x(), 210, speedStr); - p.setFont(InterFont(66)); - drawText(p, rect().center().x(), 290, speedUnit, 200); + if (!speedHidden) { + p.setFont(InterFont(176, QFont::Bold)); + drawText(p, rect().center().x(), 210, speedStr); + p.setFont(InterFont(66)); + drawText(p, rect().center().x(), 290, speedUnit, 200); + } p.restore(); } @@ -1020,6 +1030,10 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() { main_layout->addLayout(bottom_layout); + if (params.getBool("HideSpeed")) { + speedHidden = true; + } + // Custom themes configuration themeConfiguration = { {1, {QString("frog_theme"), {QColor(23, 134, 68, 242), {{0.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.9))}, diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index 50c36d5..70be466 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -16,6 +16,7 @@ const int btn_size = 192; const int img_size = (btn_size / 4) * 3; // FrogPilot global variables +static bool speedHidden; static double fps; // ***** onroad widgets *****