From 6093345711a6277d58f1b31224b4ebe0e044a1ad Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:34:47 -0700 Subject: [PATCH] Detect if the map is open --- selfdrive/ui/qt/maps/map_panel.cc | 5 +++++ selfdrive/ui/qt/maps/map_panel.h | 1 + selfdrive/ui/qt/onroad.cc | 4 +++- selfdrive/ui/qt/onroad.h | 1 + selfdrive/ui/ui.h | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/maps/map_panel.cc b/selfdrive/ui/qt/maps/map_panel.cc index c4cc20e2..1044cc00 100644 --- a/selfdrive/ui/qt/maps/map_panel.cc +++ b/selfdrive/ui/qt/maps/map_panel.cc @@ -41,3 +41,8 @@ void MapPanel::toggleMapSettings() { emit mapPanelRequested(); show(); } + +void MapPanel::setVisible(bool visible) { + QFrame::setVisible(visible); + uiState()->scene.map_open = visible; +} diff --git a/selfdrive/ui/qt/maps/map_panel.h b/selfdrive/ui/qt/maps/map_panel.h index 190bb634..ed287b15 100644 --- a/selfdrive/ui/qt/maps/map_panel.h +++ b/selfdrive/ui/qt/maps/map_panel.h @@ -9,6 +9,7 @@ class MapPanel : public QFrame { public: explicit MapPanel(const QMapLibre::Settings &settings, QWidget *parent = nullptr); + void setVisible(bool visible); signals: void mapPanelRequested(); diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 75b31172..ba1748cc 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -859,6 +859,8 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) { experimentalMode = scene.experimental_mode; + mapOpen = scene.map_open; + turnSignalLeft = scene.turn_signal_left; turnSignalRight = scene.turn_signal_right; @@ -950,7 +952,7 @@ void AnnotatedCameraWidget::drawStatusBar(QPainter &p) { // Update status text if (alwaysOnLateralActive) { - newStatus = QString("Always On Lateral active. Press the \"Cruise Control\" button to disable"); + newStatus = QString("Always On Lateral active") + (mapOpen ? "" : ". Press the \"Cruise Control\" button to disable"); } else if (conditionalExperimental) { newStatus = conditionalStatusMap[status != STATUS_DISENGAGED ? conditionalStatus : 0]; } diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index b4f1fce0..664d219c 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -125,6 +125,7 @@ private: bool blindSpotRight; bool conditionalExperimental; bool experimentalMode; + bool mapOpen; bool turnSignalLeft; bool turnSignalRight; diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index bf0eea9a..e8ce4382 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -179,6 +179,7 @@ typedef struct UIScene { bool dynamic_path_width; bool enabled; bool experimental_mode; + bool map_open; bool model_ui; bool turn_signal_left; bool turn_signal_right;