This commit is contained in:
Jason Wen
2023-06-03 11:58:24 -04:00
parent 9c83051ec0
commit bc28976359
2 changed files with 6 additions and 5 deletions
+1 -2
View File
@@ -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)
+5 -3
View File
@@ -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)]