Skip to content

Commit

Permalink
sorento fix v3
Browse files Browse the repository at this point in the history
  • Loading branch information
royjr committed Dec 24, 2024
1 parent d23a3b4 commit 2b3598a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions opendbc/car/hyundai/hyundaicanfd.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2b3598a

Please sign in to comment.