From 0b3997491d82ce5f25f06883b44fb75b9d27bc1b Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Mon, 5 Oct 2026 14:38:45 -0500 Subject: [PATCH] ID4 Vehicle Detection Co-authored-by: Ian --- .../car/volkswagen/tests/test_volkswagen.py | 18 ++++++++++++++++++ opendbc_repo/opendbc/car/volkswagen/values.py | 4 +++- prebuilt.json | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/opendbc_repo/opendbc/car/volkswagen/tests/test_volkswagen.py b/opendbc_repo/opendbc/car/volkswagen/tests/test_volkswagen.py index 2ed4d6f732..0898d91e29 100644 --- a/opendbc_repo/opendbc/car/volkswagen/tests/test_volkswagen.py +++ b/opendbc_repo/opendbc/car/volkswagen/tests/test_volkswagen.py @@ -102,6 +102,24 @@ class TestVolkswagenPlatformConfigs(unittest.TestCase): matches = FW_QUERY_CONFIG.match_fw_to_car_fuzzy({(0x757, None): [radar_fw]}, "".join(vin), FW_VERSIONS) self.assertEqual(matches, {expected} if expected is not None else set()) + def test_id4_chassis_year_and_radar_firmware_match(self): + radar_fw = FW_VERSIONS[CAR.VOLKSWAGEN_ID4_MK1][Ecu.fwdRadar, 0x757, None][0] + for wmi in ("1V2", "WVW", "WVG", "XXX"): + for chassis in ("E2", "E8"): + for year in ("M", "N", "P", "R", "S", "L", "T", "0"): + vin = list("00000000000000000") + vin[:3], vin[6:8], vin[9] = wmi, chassis, year + expected = set() + if wmi != "XXX": + if year in ("M", "N", "P"): + expected = {CAR.VOLKSWAGEN_ID4_MK1} + elif chassis == "E8" and year in ("R", "S"): + expected = {CAR.VOLKSWAGEN_ID4_MK2} + for firmware in ({(0x757, None): [radar_fw]}, {}, {(0x757, None): [b"unknown"]}): + with self.subTest(wmi=wmi, chassis=chassis, year=year, firmware=firmware): + matches = FW_QUERY_CONFIG.match_fw_to_car_fuzzy(firmware, "".join(vin), FW_VERSIONS) + self.assertEqual(matches, expected if firmware.get((0x757, None)) == [radar_fw] else set()) + def test_six_meb_interfaces_and_native_controller_frames(self): for car_model in self.MEB_BATCH: gen2 = bool(car_model.config.flags & VolkswagenFlags.MEB_GEN2) diff --git a/opendbc_repo/opendbc/car/volkswagen/values.py b/opendbc_repo/opendbc/car/volkswagen/values.py index cf68603908..a73fa0861b 100644 --- a/opendbc_repo/opendbc/car/volkswagen/values.py +++ b/opendbc_repo/opendbc/car/volkswagen/values.py @@ -406,14 +406,16 @@ class CAR(Platforms): VWCarDocs("Volkswagen ID.4 2021-23", car_parts=CarParts.common([CarHarness.vw_meb]), footnotes=[]), ], VolkswagenCarSpecs(mass=2224, wheelbase=2.77), - chassis_codes={"E2"}, + chassis_codes={"E2", "E8"}, wmis={WMI.VOLKSWAGEN_USA_SUV, WMI.VOLKSWAGEN_EUROPE_CAR, WMI.VOLKSWAGEN_EUROPE_SUV}, + model_years={"M", "N", "P"}, ) VOLKSWAGEN_ID4_MK2 = VolkswagenMEBPlatformConfig( [VWCarDocs("Volkswagen ID.4 2024-25", car_parts=CarParts.common([CarHarness.vw_meb]), footnotes=[])], VolkswagenCarSpecs(mass=2224, wheelbase=2.77), chassis_codes={"E8"}, wmis={WMI.VOLKSWAGEN_USA_SUV, WMI.VOLKSWAGEN_EUROPE_CAR, WMI.VOLKSWAGEN_EUROPE_SUV}, + model_years={"R", "S"}, flags=VolkswagenFlags.MEB_GEN2, ) VOLKSWAGEN_JETTA_MK6 = VolkswagenPQPlatformConfig( diff --git a/prebuilt.json b/prebuilt.json index 873c2d2cb2..4ff2ec13d6 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "db0a522d9d58e3ea380637718072791b793d81436552ea0cc69ee3101aec8615", "schema_version": 1} +{"protected_inventory_sha256": "ae910a8d9fb30ee57869e61d598407cb002d99a4f7ce723aa5bb5c0cd94a561c", "schema_version": 1}