Skip to content

Commit

Permalink
ui: delay DM camera initialization when reversing (commaai#87)
Browse files Browse the repository at this point in the history
* ui: delay DM camera initialization when reversing

* faster
  • Loading branch information
sunnyhaibin authored Jun 3, 2023
1 parent 892ce27 commit e4668cb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion selfdrive/ui/qt/onroad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,19 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
setProperty("curveSign", lp.getTurnSign());
}

setProperty("reversing", int(car_state.getGearShifter()) == 4);
static int reverse_delay = 0;
bool reverse_allowed = false;
if (int(car_state.getGearShifter()) != 4) {
reverse_delay = 0;
reverse_allowed = false;
} else {
reverse_delay += 50;
if (reverse_delay >= 1000) {
reverse_allowed = true;
}
}

setProperty("reversing", reverse_allowed);

// DM icon transition
dm_fade_state = fmax(0.0, fmin(1.0, dm_fade_state+0.2*(0.5-(float)(dmActive))));
Expand Down

0 comments on commit e4668cb

Please sign in to comment.