From 3787b6daf7fe91151109c7fbe5648c9ebad8d7d3 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 23 Sep 2024 18:46:30 -0400 Subject: [PATCH] Add second alt limits (will open another PR on this) --- opendbc/car/hyundai/interface.py | 6 ++++++ opendbc/car/hyundai/values.py | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/interface.py b/opendbc/car/hyundai/interface.py index 27df5b556d..7cce11bfe2 100644 --- a/opendbc/car/hyundai/interface.py +++ b/opendbc/car/hyundai/interface.py @@ -130,6 +130,12 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime ret.flags |= HyundaiFlags.ALT_LIMITS.value ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_ALT_LIMITS + # TODO: Enforce in panda safety + if candidate in CAR.KIA_SPORTAGE_5TH_GEN: + for fw in car_fw: + if fw.ecu == "fwdCamera" and fw.fwVersion == "" b'\xf1\x00NQ5 FR_CMR AT USA LHD 1.00 1.01 99211-P1060 680': + ret.flags |= HyundaiFlags.ALT_LIMITS_2.value + ret.centerToFront = ret.wheelbase * 0.4 return ret diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 37b3297bdc..ad5cd02a67 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -26,13 +26,18 @@ def __init__(self, CP): self.STEER_STEP = 1 # 100 Hz if CP.carFingerprint in CANFD_CAR: - self.STEER_MAX = 170 self.STEER_DRIVER_ALLOWANCE = 250 self.STEER_DRIVER_MULTIPLIER = 2 self.STEER_THRESHOLD = 250 self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 + if CP.flags & HyundaiFlags.ALT_LIMITS_2: + self.STEER_MAX = 170 + + else: + self.STEER_MAX = 270 + # To determine the limit for your car, find the maximum value that the stock LKAS will request. # If the max stock LKAS request is <384, add your car to this list. elif CP.carFingerprint in (CAR.GENESIS_G80, CAR.GENESIS_G90, CAR.HYUNDAI_ELANTRA, CAR.HYUNDAI_ELANTRA_GT_I30, CAR.HYUNDAI_IONIQ, @@ -95,6 +100,8 @@ class HyundaiFlags(IntFlag): MIN_STEER_32_MPH = 2 ** 23 + ALT_LIMITS_2 = 2 ** 24 + class Footnote(Enum): CANFD = CarFootnote(