diff --git a/opendbc/car/hyundai/interface.py b/opendbc/car/hyundai/interface.py index 5bf4ebb70..9dc18c93c 100644 --- a/opendbc/car/hyundai/interface.py +++ b/opendbc/car/hyundai/interface.py @@ -1,8 +1,6 @@ from opendbc.car import Bus, get_safety_config, structs, uds from opendbc.car.hyundai.hyundaicanfd import CanBus -from opendbc.car.hyundai.values import HyundaiFlags, CAR, DBC, \ - CANFD_UNSUPPORTED_LONGITUDINAL_CAR, \ - UNSUPPORTED_LONGITUDINAL_CAR, HyundaiSafetyFlags +from opendbc.car.hyundai.values import HyundaiFlags, CAR, DBC, HyundaiSafetyFlags from opendbc.car.hyundai.radar_interface import RADAR_START_ADDR from opendbc.car.interfaces import CarInterfaceBase from opendbc.car.disable_ecu import disable_ecu @@ -38,7 +36,7 @@ class CarInterface(CarInterfaceBase): if ret.flags & HyundaiFlags.CANFD: # Shared configuration for CAN-FD cars - ret.alphaLongitudinalAvailable = candidate not in CANFD_UNSUPPORTED_LONGITUDINAL_CAR + ret.alphaLongitudinalAvailable = not (ret.flags & HyundaiFlags.CANFD_NO_RADAR_DISABLE) if lka_steering and Ecu.adas not in [fw.ecu for fw in car_fw]: # this needs to be figured out for cars without an ADAS ECU ret.alphaLongitudinalAvailable = False @@ -85,7 +83,7 @@ class CarInterface(CarInterfaceBase): else: # Shared configuration for non CAN-FD cars - ret.alphaLongitudinalAvailable = candidate not in UNSUPPORTED_LONGITUDINAL_CAR + ret.alphaLongitudinalAvailable = not (ret.flags & (HyundaiFlags.LEGACY | HyundaiFlags.UNSUPPORTED_LONGITUDINAL)) ret.enableBsm = 0x58b in fingerprint[0] # Send LFA message on cars with HDA diff --git a/opendbc/car/hyundai/tests/test_hyundai.py b/opendbc/car/hyundai/tests/test_hyundai.py index 25c88d47f..4481c6215 100644 --- a/opendbc/car/hyundai/tests/test_hyundai.py +++ b/opendbc/car/hyundai/tests/test_hyundai.py @@ -74,7 +74,8 @@ class TestHyundaiFingerprint(unittest.TestCase): assert set.union(*CAN_GEARS.values()) & (HYBRID_CAR | EV_CAR) == set() # Test CAN FD car not in CAN feature lists - can_specific_feature_list = set.union(*CAN_GEARS.values(), *CHECKSUM.values(), LEGACY_SAFETY_MODE_CAR, UNSUPPORTED_LONGITUDINAL_CAR, CAMERA_SCC_CAR) + can_specific_feature_list = set.union(*CAN_GEARS.values(), *CHECKSUM.values(), LEGACY_SAFETY_MODE_CAR, + *UNSUPPORTED_LONGITUDINAL_CAR.values(), CAMERA_SCC_CAR) for car_model in CANFD_CAR: assert car_model not in can_specific_feature_list, "CAN FD car unexpectedly found in a CAN feature list" diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 56eced638..0042982de 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -775,9 +775,6 @@ CAN_GEARS = { } CANFD_CAR = CAR.with_flags(HyundaiFlags.CANFD) -CANFD_RADAR_SCC_CAR = CAR.with_flags(HyundaiFlags.RADAR_SCC) # TODO: merge with UNSUPPORTED_LONGITUDINAL_CAR - -CANFD_UNSUPPORTED_LONGITUDINAL_CAR = CAR.with_flags(HyundaiFlags.CANFD_NO_RADAR_DISABLE) # TODO: merge with UNSUPPORTED_LONGITUDINAL_CAR CAMERA_SCC_CAR = CAR.with_flags(HyundaiFlags.CAMERA_SCC) @@ -787,8 +784,9 @@ EV_CAR = CAR.with_flags(HyundaiFlags.EV) LEGACY_SAFETY_MODE_CAR = CAR.with_flags(HyundaiFlags.LEGACY) -# TODO: another PR with (HyundaiFlags.LEGACY | HyundaiFlags.UNSUPPORTED_LONGITUDINAL | HyundaiFlags.CAMERA_SCC | -# HyundaiFlags.CANFD_RADAR_SCC | HyundaiFlags.CANFD_NO_RADAR_DISABLE | ) -UNSUPPORTED_LONGITUDINAL_CAR = CAR.with_flags(HyundaiFlags.LEGACY) | CAR.with_flags(HyundaiFlags.UNSUPPORTED_LONGITUDINAL) +UNSUPPORTED_LONGITUDINAL_CAR = { + "legacy": CAR.with_flags(HyundaiFlags.LEGACY), + "can": CAR.with_flags(HyundaiFlags.UNSUPPORTED_LONGITUDINAL), +} DBC = CAR.create_dbc_map()