diff --git a/selfdrive/car/hyundai/hyundaicanfd.py b/selfdrive/car/hyundai/hyundaicanfd.py index 680a9ec1a2..b4c7e5dddf 100644 --- a/selfdrive/car/hyundai/hyundaicanfd.py +++ b/selfdrive/car/hyundai/hyundaicanfd.py @@ -11,14 +11,13 @@ class CanBus: num = math.ceil(max([k for k, v in fingerprint.items() if len(v)], default=1) / 4) else: hda2 = CP.flags & HyundaiFlags.CANFD_HDA2.value - can_canfd_hda2 = CP.flags & HyundaiFlags.CAN_CANFD_HDA2 num = len(CP.safetyConfigs) # On the CAN-FD platforms, the LKAS camera is on both A-CAN and E-CAN. HDA2 cars # have a different harness than the HDA1 and non-HDA variants in order to split # a different bus, since the steering is done by different ECUs. self._a, self._e = 1, 0 - if hda2 or can_canfd_hda2: + if hda2: self._a, self._e = 0, 1 offset = 4*(num - 1) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index c9d6f08c3d..92a0f26611 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -49,7 +49,7 @@ class CarInterface(CarInterfaceBase): ret.flags |= HyundaiFlags.CANFD_CAMERA_SCC.value else: # detect HDA2 with CAN and CAN-FD definitions with ADAS Driving ECU - if Ecu.adas in [fw.ecu for fw in car_fw]: + if hda2: ret.flags |= HyundaiFlags.CAN_CANFD_HDA2.value # Send LFA message on cars with HDA @@ -282,8 +282,10 @@ class CarInterface(CarInterfaceBase): # these cars require a special panda safety mode due to missing counters and checksums in the messages ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hyundaiLegacy)] elif ret.flags & HyundaiFlags.CAN_CANFD_HDA2: - ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.noOutput), - get_safety_config(car.CarParams.SafetyModel.hyundai)] + cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundai), ] + if CAN.ECAN >= 4: + cfgs.insert(0, get_safety_config(car.CarParams.SafetyModel.noOutput)) + ret.safetyConfigs = cfgs ret.safetyConfigs[1].safetyParam |= Panda.FLAG_HYUNDAI_CAN_CANFD_HDA2 else: ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hyundai, 0)]