From 44c5373b2b0a75349df8cfba99890dd02453006d Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Fri, 7 Jun 2024 04:11:50 -0700 Subject: [PATCH] FrogPilot setup - Determine if the map is open --- selfdrive/ui/qt/home.cc | 3 +++ selfdrive/ui/ui.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 9dbe7cbae..46a493379 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -55,6 +55,7 @@ void HomeWindow::showSidebar(bool show) { void HomeWindow::showMapPanel(bool show) { onroad->showMapPanel(show); + uiState()->scene.map_open = true; } void HomeWindow::updateState(const UIState &s) { @@ -74,6 +75,7 @@ void HomeWindow::offroadTransition(bool offroad) { slayout->setCurrentWidget(home); } else { slayout->setCurrentWidget(onroad); + uiState()->scene.map_open = onroad->isMapVisible(); } } @@ -91,6 +93,7 @@ void HomeWindow::mousePressEvent(QMouseEvent* e) { // Handle sidebar collapsing if ((onroad->isVisible() || body->isVisible()) && (!sidebar->isVisible() || e->x() > sidebar->width())) { sidebar->setVisible(!sidebar->isVisible() && !onroad->isMapVisible()); + uiState()->scene.map_open = onroad->isMapVisible(); } } diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 7238159dd..57ccda194 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -101,6 +101,10 @@ typedef struct UIScene { bool started, ignition, is_metric, map_on_left, longitudinal_control; bool world_objects_visible = false; uint64_t started_frame; + + // FrogPilot variables + bool map_open; + } UIScene; class UIState : public QObject {