nav: open map on new route without valid OpenGL context (#23140)

pull/23142/head
Willem Melching 3 years ago committed by GitHub
parent 8545901c0c
commit 790a64af90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      selfdrive/ui/qt/maps/map.cc

@ -112,10 +112,6 @@ void MapWindow::timerUpdate() {
update(); update();
if (m_map.isNull()) {
return;
}
sm->update(0); sm->update(0);
if (sm->updated("liveLocationKalman")) { if (sm->updated("liveLocationKalman")) {
auto location = (*sm)["liveLocationKalman"].getLiveLocationKalman(); auto location = (*sm)["liveLocationKalman"].getLiveLocationKalman();
@ -134,6 +130,21 @@ void MapWindow::timerUpdate() {
velocity_filter.update(velocity); velocity_filter.update(velocity);
} }
} }
if (sm->updated("navRoute")) {
qWarning() << "Got new navRoute from navd. Opening map:" << allow_open;
// Only open the map on setting destination the first time
if (allow_open) {
setVisible(true); // Show map on destination set/change
allow_open = false;
}
}
if (m_map.isNull()) {
return;
}
loaded_once = loaded_once || m_map->isFullyLoaded(); loaded_once = loaded_once || m_map->isFullyLoaded();
if (!loaded_once) { if (!loaded_once) {
map_instructions->showError("Map Loading"); map_instructions->showError("Map Loading");
@ -186,7 +197,7 @@ void MapWindow::timerUpdate() {
} }
if (sm->rcv_frame("navRoute") != route_rcv_frame) { if (sm->rcv_frame("navRoute") != route_rcv_frame) {
qWarning() << "Got new navRoute from navd"; qWarning() << "Updating navLayer with new route";
auto route = (*sm)["navRoute"].getNavRoute(); auto route = (*sm)["navRoute"].getNavRoute();
auto route_points = capnp_coordinate_list_to_collection(route.getCoordinates()); auto route_points = capnp_coordinate_list_to_collection(route.getCoordinates());
QMapbox::Feature feature(QMapbox::Feature::LineStringType, route_points, {}, {}); QMapbox::Feature feature(QMapbox::Feature::LineStringType, route_points, {}, {});
@ -196,11 +207,6 @@ void MapWindow::timerUpdate() {
m_map->updateSource("navSource", navSource); m_map->updateSource("navSource", navSource);
m_map->setLayoutProperty("navLayer", "visibility", "visible"); m_map->setLayoutProperty("navLayer", "visibility", "visible");
// Only open the map on setting destination the first time
if (allow_open) {
setVisible(true); // Show map on destination set/change
allow_open = false;
}
route_rcv_frame = sm->rcv_frame("navRoute"); route_rcv_frame = sm->rcv_frame("navRoute");
} }
} }

Loading…
Cancel
Save