nav: show warning for routing problems (#29055)

* all my debugging stuff

* this works

* add comment

* bb navd

* navInstruction is valid when we get a non-empty route response

* now don't need this

* stash

* big cleanup

* clean up

* clean up

* debug

* final clean up

* one line

* flip order

* update translations

* is this simpler?
This commit is contained in:
Shane Smiskol
2023-07-20 04:01:55 -07:00
committed by GitHub
parent d0ea8be95f
commit 5b368a67ea
8 changed files with 40 additions and 1 deletions
+15 -1
View File
@@ -211,7 +211,14 @@ void MapWindow::updateState(const UIState &s) {
}
initLayers();
setError(locationd_valid ? "" : tr("Waiting for GPS"));
if (!locationd_valid) {
setError(tr("Waiting for GPS"));
} else if (routing_problem) {
setError(tr("Waiting for internet"));
} else {
setError("");
}
if (locationd_valid) {
// Update current location marker
auto point = coordinate_to_collection(*last_position);
@@ -236,6 +243,12 @@ void MapWindow::updateState(const UIState &s) {
}
if (sm.updated("navInstruction")) {
// an invalid navInstruction packet with a nav destination is only possible if:
// - API exception/no internet
// - route response is empty
auto dest = coordinate_from_param("NavDestination");
routing_problem = !sm.valid("navInstruction") && dest.has_value();
if (sm.valid("navInstruction")) {
auto i = sm["navInstruction"].getNavInstruction();
map_eta->updateETA(i.getTimeRemaining(), i.getTimeRemainingTypical(), i.getDistanceRemaining());
@@ -393,6 +406,7 @@ void MapWindow::offroadTransition(bool offroad) {
if (offroad) {
clearRoute();
uiState()->scene.navigate_on_openpilot = false;
routing_problem = false;
} else {
auto dest = coordinate_from_param("NavDestination");
emit requestVisible(dest.has_value());
+1
View File
@@ -101,6 +101,7 @@ private:
std::optional<float> last_bearing;
FirstOrderFilter velocity_filter;
bool locationd_valid = false;
bool routing_problem = false;
QWidget *map_overlay;
QLabel *error;
+4
View File
@@ -403,6 +403,10 @@
<source>Waiting for GPS</source>
<translation>Warten auf GPS</translation>
</message>
<message>
<source>Waiting for internet</source>
<translation type="unfinished">Auf Internet warten</translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>
+4
View File
@@ -402,6 +402,10 @@
<source>Waiting for GPS</source>
<translation>GPS信号を探しています</translation>
</message>
<message>
<source>Waiting for internet</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>
+4
View File
@@ -402,6 +402,10 @@
<source>Waiting for GPS</source>
<translation>GPS </translation>
</message>
<message>
<source>Waiting for internet</source>
<translation type="unfinished"> </translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>
+4
View File
@@ -403,6 +403,10 @@
<source>Waiting for GPS</source>
<translation>Esperando por GPS</translation>
</message>
<message>
<source>Waiting for internet</source>
<translation type="unfinished">Esperando pela internet</translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>
+4
View File
@@ -402,6 +402,10 @@
<source>Waiting for GPS</source>
<translation> GPS</translation>
</message>
<message>
<source>Waiting for internet</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>
+4
View File
@@ -402,6 +402,10 @@
<source>Waiting for GPS</source>
<translation> GPS</translation>
</message>
<message>
<source>Waiting for internet</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>