From fa4a3e3c6376658136a531612409fb0bce1cb739 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 14 Oct 2024 14:12:33 -0700 Subject: [PATCH] Allow throttle ui: only if openpilot longitudinal (#33787) check op long --- selfdrive/ui/qt/onroad/model.cc | 2 +- selfdrive/ui/qt/onroad/model.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/qt/onroad/model.cc b/selfdrive/ui/qt/onroad/model.cc index b39592422..595bb489a 100644 --- a/selfdrive/ui/qt/onroad/model.cc +++ b/selfdrive/ui/qt/onroad/model.cc @@ -158,7 +158,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 diff --git a/selfdrive/ui/qt/onroad/model.h b/selfdrive/ui/qt/onroad/model.h index 739dbce1c..50d81937e 100644 --- a/selfdrive/ui/qt/onroad/model.h +++ b/selfdrive/ui/qt/onroad/model.h @@ -26,7 +26,7 @@ private: 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;