ui: only draw speedCluster speed over "MAX" when ICBM is enabled (#1374)

This commit is contained in:
Jason Wen
2025-10-13 20:36:24 -04:00
committed by GitHub
parent e5f1f86ac2
commit 285fd97606
3 changed files with 5 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ void HudRendererSP::updateState(const UIState &s) {
const auto gpsLocation = is_gps_location_external ? sm["gpsLocationExternal"].getGpsLocationExternal() : sm["gpsLocation"].getGpsLocation();
const auto ltp = sm["liveTorqueParameters"].getLiveTorqueParameters();
const auto car_params = sm["carParams"].getCarParams();
const auto car_params_sp = sm["carParamsSP"].getCarParamsSP();
const auto lp_sp = sm["longitudinalPlanSP"].getLongitudinalPlanSP();
const auto lmd = sm["liveMapDataSP"].getLiveMapDataSP();
@@ -130,6 +131,7 @@ void HudRendererSP::updateState(const UIState &s) {
carControlEnabled = car_control.getEnabled();
speedCluster = car_state.getCruiseState().getSpeedCluster() * speedConv;
pcmCruiseSpeed = car_params_sp.getPcmCruiseSpeed();
}
void HudRendererSP::draw(QPainter &p, const QRect &surface_rect) {
@@ -689,7 +691,7 @@ void HudRendererSP::drawSetSpeedSP(QPainter &p, const QRect &surface_rect) {
}
// Draw "MAX" or carState.cruiseState.speedCluster (when ICBM is active) text
if (carControlEnabled) {
if (!pcmCruiseSpeed && carControlEnabled) {
if (std::nearbyint(set_speed) != std::nearbyint(speedCluster)) {
icbm_active_counter = 3 * UI_FREQ;
} else if (icbm_active_counter > 0) {

View File

@@ -120,4 +120,5 @@ private:
bool carControlEnabled;
float speedCluster = 0;
int icbm_active_counter = 0;
bool pcmCruiseSpeed;
};

View File

@@ -29,7 +29,7 @@ UIStateSP::UIStateSP(QObject *parent) : UIState(parent) {
"wideRoadCameraState", "managerState", "selfdriveState", "longitudinalPlan",
"modelManagerSP", "selfdriveStateSP", "longitudinalPlanSP", "backupManagerSP",
"carControl", "gpsLocationExternal", "gpsLocation", "liveTorqueParameters",
"carStateSP", "liveParameters", "liveMapDataSP"
"carStateSP", "liveParameters", "liveMapDataSP", "carParamsSP"
});
// update timer