Skip to content

Commit e76ef93

Browse files
authored
ui: fix onroad transition with active nav (#23757)
1 parent 31228ce commit e76ef93

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

selfdrive/ui/qt/onroad.cc

+7-3
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,15 @@ void OnroadWindow::offroadTransition(bool offroad) {
8080
if (!offroad) {
8181
if (map == nullptr && (uiState()->prime_type || !MAPBOX_TOKEN.isEmpty())) {
8282
MapWindow * m = new MapWindow(get_mapbox_settings());
83-
m->setFixedWidth(topWidget(this)->width() / 2);
84-
m->offroadTransition(offroad);
83+
map = m;
84+
8585
QObject::connect(uiState(), &UIState::offroadTransition, m, &MapWindow::offroadTransition);
86+
87+
m->setFixedWidth(topWidget(this)->width() / 2);
8688
split->addWidget(m, 0, Qt::AlignRight);
87-
map = m;
89+
90+
// Make map visible after adding to split
91+
m->offroadTransition(offroad);
8892
}
8993
}
9094
#endif

selfdrive/ui/ui.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void UIState::updateStatus() {
208208
}
209209

210210
// Handle onroad/offroad transition
211-
if (scene.started != started_prev) {
211+
if (scene.started != started_prev || sm->frame == 1) {
212212
if (scene.started) {
213213
status = STATUS_DISENGAGED;
214214
scene.started_frame = sm->frame;
@@ -217,8 +217,6 @@ void UIState::updateStatus() {
217217
}
218218
started_prev = scene.started;
219219
emit offroadTransition(!scene.started);
220-
} else if (sm->frame == 1) {
221-
emit offroadTransition(!scene.started);
222220
}
223221
}
224222

selfdrive/ui/ui.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private slots:
141141

142142
private:
143143
QTimer *timer;
144-
bool started_prev = true;
144+
bool started_prev = false;
145145
};
146146

147147
UIState *uiState();

0 commit comments

Comments
 (0)