From 2b3598a44b2887c068ca10f21c8476c6d97ba7ac Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 20:14:51 -0500 Subject: [PATCH] sorento fix v3 --- opendbc/car/hyundai/hyundaicanfd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 9a088d0a8b..fa4a9a86d9 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -1,7 +1,7 @@ from opendbc.car import CanBusBase from opendbc.car.common.conversions import Conversions as CV from opendbc.car.common.numpy_fast import clip -from opendbc.car.hyundai.values import HyundaiFlags +from opendbc.car.hyundai.values import HyundaiFlags, CAR class CanBus(CanBusBase): @@ -178,11 +178,13 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # OP LONG if CP.openpilotLongitudinalControl: + setspeed_factor = 1 if CS.is_metric and CP.carFingerprint in (CAR.KIA_SORENTO_2024,) else CV.KPH_TO_MPH + # SETSPEED, DISTANCE msg_161.update({ "SETSPEED": 3 if enabled else 1, "SETSPEED_HUD": 2 if enabled else 1, - "SETSPEED_SPEED": 25 if (s := round(CS.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s, + "SETSPEED_SPEED": 25 if (s := round(CS.out.vCruiseCluster * setspeed_factor)) > 100 else s, "DISTANCE": hud.leadDistanceBars, "DISTANCE_SPACING": 1 if enabled else 0, "DISTANCE_LEAD": 2 if enabled and hud.leadVisible else 1 if enabled else 0,