Skip to content

Commit

Permalink
Apply commaai#1285
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin committed Sep 25, 2024
1 parent f9058a3 commit a99debe
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions opendbc/car/hyundai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime
# FIXME: the Optima Hybrid 2017 uses a different SCC12 checksum
ret.dashcamOnly = candidate in {CAR.KIA_OPTIMA_H, }

_CAN_CAM = CanBus(None, False, fingerprint).CAM
hda2 = Ecu.adas in [fw.ecu for fw in car_fw] or \
0x50 in fingerprint[_CAN_CAM] or 0x110 in fingerprint[_CAN_CAM]
# Check if the ADAS Driving ECU is present in the firmware response.
# If not found, check the CAM CAN bus fingerprint for known HDA2 steering messages (0x50 or 0x110),
# that indicate an HDA2 car even without a direct ADAS Driving ECU response.
if Ecu.adas in [fw.ecu for fw in car_fw]:
hda2 = True
else:
# Some HDA2 cars do not respond ADAS Driving ECU if the known HDA2 steering messages are present.
# The hda2 flag to initialize CanBus is not critical here since we only care about CAM bus steering messages.
cam_can = CanBus(None, False, fingerprint).CAM
hda2 = 0x50 in fingerprint[cam_can] or 0x110 in fingerprint[cam_can]

CAN = CanBus(None, hda2, fingerprint)

if candidate in CANFD_CAR:
Expand Down

0 comments on commit a99debe

Please sign in to comment.