nav: show error when route request fails

old-commit-hash: f6b7128741
commatwo_master
Willem Melching 4 years ago
parent 63a4bdf281
commit fe1eb7e99f
  1. 8
      selfdrive/ui/qt/maps/map.cc

@ -147,7 +147,7 @@ void MapWindow::timerUpdate() {
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");
return; return;
} }
@ -343,6 +343,7 @@ void MapWindow::calculateRoute(QMapbox::Coordinate destination) {
} }
void MapWindow::routeCalculated(QGeoRouteReply *reply) { void MapWindow::routeCalculated(QGeoRouteReply *reply) {
bool got_route = false;
if (reply->error() == QGeoRouteReply::NoError) { if (reply->error() == QGeoRouteReply::NoError) {
if (reply->routes().size() != 0) { if (reply->routes().size() != 0) {
qWarning() << "Got route response"; qWarning() << "Got route response";
@ -357,6 +358,7 @@ void MapWindow::routeCalculated(QGeoRouteReply *reply) {
navSource["data"] = QVariant::fromValue<QMapbox::Feature>(feature); navSource["data"] = QVariant::fromValue<QMapbox::Feature>(feature);
m_map->updateSource("navSource", navSource); m_map->updateSource("navSource", navSource);
m_map->setLayoutProperty("navLayer", "visibility", "visible"); m_map->setLayoutProperty("navLayer", "visibility", "visible");
got_route = true;
updateETA(); updateETA();
} else { } else {
@ -366,6 +368,10 @@ void MapWindow::routeCalculated(QGeoRouteReply *reply) {
qWarning() << "Got error in route reply" << reply->errorString(); qWarning() << "Got error in route reply" << reply->errorString();
} }
if (!got_route) {
map_instructions->showError("Failed to Route");
}
reply->deleteLater(); reply->deleteLater();
} }

Loading…
Cancel
Save