Skip to content

Commit

Permalink
Allow throttle ui: only if openpilot longitudinal (commaai#33787)
Browse files Browse the repository at this point in the history
check op long
  • Loading branch information
sshane authored and cydia2020 committed Oct 14, 2024
1 parent a466192 commit d7e407d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion selfdrive/ui/qt/onroad/model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void ModelRenderer::updatePathGradient(QLinearGradient &bg) {
constexpr float transition_speed = 0.1f;

// Start transition if throttle state changes
bool allow_throttle = (*uiState()->sm)["longitudinalPlan"].getLongitudinalPlan().getAllowThrottle();
bool allow_throttle = (*uiState()->sm)["longitudinalPlan"].getLongitudinalPlan().getAllowThrottle() || !longitudinal_control;
if (allow_throttle != prev_allow_throttle) {
prev_allow_throttle = allow_throttle;
// Invert blend factor for a smooth transition when the state changes mid-animation
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/ui/qt/onroad/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ModelRenderer {
bool longitudinal_control = false;
bool experimental_mode = false;
float blend_factor = 1.0f;
bool prev_allow_throttle = false;
bool prev_allow_throttle = true;
float lane_line_probs[4] = {};
float road_edge_stds[2] = {};
QPolygonF track_vertices;
Expand Down

0 comments on commit d7e407d

Please sign in to comment.