diff --git a/opendbc_repo/opendbc/car/hyundai/fingerprints.py b/opendbc_repo/opendbc/car/hyundai/fingerprints.py index 71aa17f05f..1ab4a65fce 100644 --- a/opendbc_repo/opendbc/car/hyundai/fingerprints.py +++ b/opendbc_repo/opendbc/car/hyundai/fingerprints.py @@ -1,6 +1,6 @@ """ AUTO-FORMATTED USING opendbc/car/debug/format_fingerprints.py, EDIT STRUCTURE THERE.""" from opendbc.car.structs import CarParams -from opendbc.car.hyundai.values import CAR +from opendbc.car.hyundai.values import CAR, CARNIVAL_2027_CAMERA_FW Ecu = CarParams.Ecu @@ -153,10 +153,12 @@ FW_VERSIONS = { }, CAR.KIA_CARNIVAL_2025: { (Ecu.fwdCamera, 0x7c4, None): [ + CARNIVAL_2027_CAMERA_FW, b'\xf1\x00KA4 MFC AT CAN LHD 1.00 1.00 99210-R0700 250324', b'\xf1\x00KA4 MFC AT USA LHD 1.00 1.05 99210-R0500 240305', ], (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00KA4_ RDR ----- 1.00 1.02 99110-R0510 ', b'\xf1\x00KA4_ SCC FHCUP 1.00 1.01 99110-R0510 ', b'\xf1\x00KA4_ RDR ----- 1.00 1.01 99110-R0510 ', ], diff --git a/opendbc_repo/opendbc/car/hyundai/interface.py b/opendbc_repo/opendbc/car/hyundai/interface.py index 18ef233d06..aaa65b3ac5 100644 --- a/opendbc_repo/opendbc/car/hyundai/interface.py +++ b/opendbc_repo/opendbc/car/hyundai/interface.py @@ -7,7 +7,7 @@ from opendbc.car.hyundai.discovery import kona_electric_se_candidate from opendbc.car.hyundai.hyundaicanfd import CanBus from opendbc.car.hyundai.non_scc_aol import NON_SCC_IDS from opendbc.car.hyundai.values import (is_blended, is_blended_alpha, HyundaiFlags, CAR, DBC, HyundaiSafetyFlags, CANFD_ANGLE_MODEL_BITS, - CANFD_ANGLE_OBSERVED_ADAS_BIT, HYUNDAI_MRR35_RADAR_DBC, HYUNDAI_MRR30_RADAR_DBC, + CANFD_ANGLE_OBSERVED_ADAS_BIT, CARNIVAL_2027_CAMERA_FW, HYUNDAI_MRR35_RADAR_DBC, HYUNDAI_MRR30_RADAR_DBC, HYUNDAI_GV70_RADAR_DBC, HYUNDAI_G90_RADAR_DBC, HYUNDAI_MRREVO14F_RADAR_DBC) from opendbc.car.hyundai.radar_interface import RADAR_START_ADDR, MRR35_RADAR_START_ADDR, MRR30_RADAR_START_ADDR, radar_bus, \ stinger_2022_radar_available @@ -325,6 +325,8 @@ class CarInterface(CarInterfaceBase): ret.alphaLongitudinalAvailable = not is_release alpha_long = False from opendbc.car.hyundai.legacy_long_aol import CARS as legacy_long_cars + if candidate == CAR.KIA_CARNIVAL_2025 and any(fw.ecu == Ecu.fwdCamera and fw.fwVersion == CARNIVAL_2027_CAMERA_FW for fw in car_fw): + ret.alphaLongitudinalAvailable = False ret.openpilotLongitudinalControl = alpha_long and ret.alphaLongitudinalAvailable and candidate not in legacy_long_cars if (candidate in (CAR.KIA_CARNIVAL_2025, CAR.KIA_CARNIVAL_HEV_4TH_GEN) and ret.flags & HyundaiFlags.CANFD_ALT_BUTTONS and 0x1aa in fingerprint[CAN.ECAN] and diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_canfd_discovery_variants.py b/opendbc_repo/opendbc/car/hyundai/tests/test_canfd_discovery_variants.py index 6ab0275c57..956612f8b7 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_canfd_discovery_variants.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_canfd_discovery_variants.py @@ -122,3 +122,31 @@ def test_exact_recorded_configuration_keeps_irq_fault_blocking(): assert cp.alternativeExperience == 0 and cp.pcmCruise and not cp.openpilotLongitudinalControl assert blocking_fault_mask(8, cp) assert blocking_fault_list([log.PandaState.FaultType.interruptRateCan2], cp) + + +def test_carnival_2027_uses_the_gas_ccnc_profile_and_standard_stock_acc(): + from opendbc.car import gen_empty_fingerprint + from opendbc.car.fw_versions import match_fw_to_car + from opendbc.car.hyundai.interface import CarInterface + from opendbc.car.hyundai.values import CAR, HyundaiFlags + from opendbc.car.structs import CarParams + + fw = [CarParams.CarFw(ecu=ecu, address=address, fwVersion=version, brand='hyundai') for ecu, address, version in ( + (CarParams.Ecu.fwdCamera, 0x7c4, b'\xf1\x00KA4 MFC AT USA LHD 1.00 1.02 99210-R0800 251031'), + (CarParams.Ecu.fwdRadar, 0x7d0, b'\xf1\x00KA4_ RDR ----- 1.00 1.02 99110-R0510 '), + (CarParams.Ecu.adas, 0x730, b'\xf1\x00KA4 FBL6 1.00 1.02 251159'), + )] + exact, matches = match_fw_to_car(fw, VIN_UNKNOWN) + assert exact and matches == {CAR.KIA_CARNIVAL_2025} + observed = gen_empty_fingerprint() + observed[0].update({0x3A5: 24}) + observed[1].update({0x100: 32, 0x40: 32, 0xEA: 24, 0xA0: 24, 0x1A0: 32, 0x1CF: 8, 0x1AA: 16}) + observed[2].update({0x110: 32, 0x362: 32}) + frames = [CanData(address, bytes(length), bus) for bus in (0, 1, 2) for address, length in observed[bus].items()] + assert normal_bus_topology(lambda **kw: [frames]) + for alpha_requested in (False, True): + cp = CarInterface.get_params(CAR.KIA_CARNIVAL_2025, observed, fw, alpha_requested, False, False) + assert cp.pcmCruise and not cp.openpilotLongitudinalControl and not cp.alphaLongitudinalAvailable + assert cp.flags & HyundaiFlags.CANFD_LKA_STEER_MSG_ALT + assert not cp.flags & (HyundaiFlags.CANFD_ALT_BUTTONS | HyundaiFlags.HYBRID) + assert cp.safetyConfigs[-1].safetyParam == 0x90 diff --git a/opendbc_repo/opendbc/car/hyundai/values.py b/opendbc_repo/opendbc/car/hyundai/values.py index f91929a0b2..799d022a00 100644 --- a/opendbc_repo/opendbc/car/hyundai/values.py +++ b/opendbc_repo/opendbc/car/hyundai/values.py @@ -263,6 +263,9 @@ class HyundaiCanFDPlatformConfig(PlatformConfig): self.dbc_dict = {Bus.pt: "hyundai_canfd_generated", Bus.radar: self.radar_dbc} +CARNIVAL_2027_CAMERA_FW = b'\xf1\x00KA4 MFC AT USA LHD 1.00 1.02 99210-R0800 251031' + + class CAR(Platforms): # Hyundai HYUNDAI_AZERA_6TH_GEN = HyundaiPlatformConfig( @@ -824,6 +827,7 @@ class CAR(Platforms): [ HyundaiCarDocs("Kia Carnival 2025", car_parts=CarParts.common([CarHarness.hyundai_k])), HyundaiCarDocs("Kia Carnival (with HDA II) 2025", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_q])), + HyundaiCarDocs("Kia Carnival (with HDA II) 2027", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_q])), ], KIA_CARNIVAL_4TH_GEN.specs, flags=HyundaiFlags.CCNC, diff --git a/prebuilt.json b/prebuilt.json index 4d78f54f01..601f9f9665 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "937d459f6925d89c7561ead40ffb4371ba83a4df16ba77eaa7c5d2282b58a9c9", "schema_version": 1} +{"protected_inventory_sha256": "14e2e4a997af03ab6a3670ed4d0e4e4736cb394c94e6778682f69a87158f138a", "schema_version": 1}