Skip to content

Commit

Permalink
ui: fix onroad transition with active nav (commaai#23757)
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm authored Feb 14, 2022
1 parent 31228ce commit e76ef93
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 7 additions & 3 deletions selfdrive/ui/qt/onroad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,15 @@ void OnroadWindow::offroadTransition(bool offroad) {
if (!offroad) {
if (map == nullptr && (uiState()->prime_type || !MAPBOX_TOKEN.isEmpty())) {
MapWindow * m = new MapWindow(get_mapbox_settings());
m->setFixedWidth(topWidget(this)->width() / 2);
m->offroadTransition(offroad);
map = m;

QObject::connect(uiState(), &UIState::offroadTransition, m, &MapWindow::offroadTransition);

m->setFixedWidth(topWidget(this)->width() / 2);
split->addWidget(m, 0, Qt::AlignRight);
map = m;

// Make map visible after adding to split
m->offroadTransition(offroad);
}
}
#endif
Expand Down
4 changes: 1 addition & 3 deletions selfdrive/ui/ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void UIState::updateStatus() {
}

// Handle onroad/offroad transition
if (scene.started != started_prev) {
if (scene.started != started_prev || sm->frame == 1) {
if (scene.started) {
status = STATUS_DISENGAGED;
scene.started_frame = sm->frame;
Expand All @@ -217,8 +217,6 @@ void UIState::updateStatus() {
}
started_prev = scene.started;
emit offroadTransition(!scene.started);
} else if (sm->frame == 1) {
emit offroadTransition(!scene.started);
}
}

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/ui/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private slots:

private:
QTimer *timer;
bool started_prev = true;
bool started_prev = false;
};

UIState *uiState();
Expand Down

0 comments on commit e76ef93

Please sign in to comment.