mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-30 11:02:19 +08:00
ui/map: show map on destination set/change (#29327)
* show map on dest set/change * check for rcv_frame * clear current_nav_dest * restore allow_open * use requestShow * cleanup * one check * revert behavior changes * Update selfdrive/ui/qt/maps/map.cc * more obvious * Update selfdrive/ui/qt/maps/map.cc --------- Co-authored-by: Shane Smiskol <shane@smiskol.com> old-commit-hash: 3a277f1b81fbb16673a77a475421a18751127cf2
This commit is contained in:
@@ -156,13 +156,15 @@ void MapWindow::updateState(const UIState &s) {
|
||||
}
|
||||
|
||||
if (sm.updated("navRoute") && sm["navRoute"].getNavRoute().getCoordinates().size()) {
|
||||
auto nav_dest = coordinate_from_param("NavDestination");
|
||||
bool allow_open = std::exchange(last_valid_nav_dest, nav_dest) != nav_dest &&
|
||||
nav_dest && !isVisible();
|
||||
qWarning() << "Got new navRoute from navd. Opening map:" << allow_open;
|
||||
|
||||
// Only open the map on setting destination the first time
|
||||
// Show map on destination set/change
|
||||
if (allow_open) {
|
||||
emit requestSettings(false);
|
||||
emit requestVisible(true); // Show map on destination set/change
|
||||
allow_open = false;
|
||||
emit requestVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +293,7 @@ void MapWindow::clearRoute() {
|
||||
|
||||
map_instructions->setVisible(false);
|
||||
map_eta->setVisible(false);
|
||||
allow_open = true;
|
||||
last_valid_nav_dest = std::nullopt;
|
||||
}
|
||||
|
||||
void MapWindow::mousePressEvent(QMouseEvent *ev) {
|
||||
|
||||
@@ -50,7 +50,6 @@ private:
|
||||
void setError(const QString &err_str);
|
||||
|
||||
bool loaded_once = false;
|
||||
bool allow_open = true;
|
||||
|
||||
// Panning
|
||||
QPointF m_lastPos;
|
||||
@@ -58,6 +57,7 @@ private:
|
||||
int zoom_counter = 0;
|
||||
|
||||
// Position
|
||||
std::optional<QMapbox::Coordinate> last_valid_nav_dest;
|
||||
std::optional<QMapbox::Coordinate> last_position;
|
||||
std::optional<float> last_bearing;
|
||||
FirstOrderFilter velocity_filter;
|
||||
|
||||
Reference in New Issue
Block a user