From ff62737ac408637ac4a61552a0c98afd4b3b48e3 Mon Sep 17 00:00:00 2001 From: Dom <168790843+firestar5683@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:43:51 -0500 Subject: [PATCH] Align GM interface fixtures with registered identities and Gen2 Drive --- .../car/gm/tests/test_bolt_pedal_slew.py | 20 ++++++++++++++----- .../car/gm/tests/test_gm_auto_identity.py | 8 +++++++- opendbc_repo/opendbc/car/tests/test_docs.py | 3 ++- prebuilt.json | 2 +- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/opendbc_repo/opendbc/car/gm/tests/test_bolt_pedal_slew.py b/opendbc_repo/opendbc/car/gm/tests/test_bolt_pedal_slew.py index 14a144346c..4a239a868c 100644 --- a/opendbc_repo/opendbc/car/gm/tests/test_bolt_pedal_slew.py +++ b/opendbc_repo/opendbc/car/gm/tests/test_bolt_pedal_slew.py @@ -4,7 +4,7 @@ from types import SimpleNamespace from opendbc.car import structs from opendbc.car.gm.carcontroller import CarController, bolt_pedal_fraction, bolt_pedal_slew from opendbc.car.gm.tests.test_bolt_pedal import params -from opendbc.car.gm.values import DBC, PEDAL_BOLT_CAR +from opendbc.car.gm.values import CAR, DBC, PEDAL_BOLT_CAR def linear(x, xs, ys): @@ -111,6 +111,7 @@ class TestBoltPedalSlew(unittest.TestCase): for speed in (6., 6.0001, 8., 12., 25.): with self.subTest(candidate=candidate, alpha=alpha, speed=speed): cp = params(candidate, True, True, alpha) + gen2_cc_drive = candidate == CAR.CHEVROLET_BOLT_CC_2022_2023 and cp.safetyConfigs[0].safetyParam == 0x19D controller = CarController(DBC[candidate], cp) cc = structs.CarControl() cc.enabled = True @@ -170,12 +171,17 @@ class TestBoltPedalSlew(unittest.TestCase): state.cruiseState.enabled = override == 'stock_acc' previous = controller.pedal_steady messages = update() - if override == 'drive' and candidate.name == 'CHEVROLET_BOLT_ACC_2022_2023_PEDAL': + admitted_drive = override == 'drive' and (gen2_cc_drive or candidate == CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL) + if admitted_drive: expected_drive = pedal_step(positive_target(cc.as_reader().actuators.accel, speed), previous, cc.as_reader().actuators.accel, speed) self.assertAlmostEqual(controller.pedal_steady, expected_drive, places=10) self.assertEqual(next(m[1] for m in messages if m[0] == 0x200), pedal_wire(expected_drive, tick)) - self.assertFalse(any(m[0] in (0x1F5, 0xBD) for m in messages)) + if gen2_cc_drive: + self.assertEqual([(m[1], m[2]) for m in messages if m[0] == 0x1F5], [(bytes.fromhex('0c0c000400000100'), 0)]) + self.assertEqual([(m[1], m[2]) for m in messages if m[0] == 0xBD], [(bytes(7), 0)]) + else: + self.assertFalse(any(m[0] in (0x1F5, 0xBD) for m in messages)) else: self.assertEqual(controller.pedal_steady, 0., override) self.assertEqual(next(m[1][:4] for m in messages if m[0] == 0x200), b'\x00' * 4) @@ -188,8 +194,12 @@ class TestBoltPedalSlew(unittest.TestCase): state.brakePressed = False state.cruiseState.enabled = False cc.actuators.accel = .35 - update() - self.assertAlmostEqual(controller.pedal_steady, positive_target(cc.as_reader().actuators.accel, speed), places=10) + target = positive_target(cc.as_reader().actuators.accel, speed) + expected_recovery = (pedal_step(target, controller.pedal_steady, cc.as_reader().actuators.accel, speed) + if admitted_drive else target) + messages = update() + self.assertAlmostEqual(controller.pedal_steady, expected_recovery, places=10) + self.assertEqual(next(m[1] for m in messages if m[0] == 0x200), pedal_wire(expected_recovery, tick)) if __name__ == '__main__': diff --git a/opendbc_repo/opendbc/car/gm/tests/test_gm_auto_identity.py b/opendbc_repo/opendbc/car/gm/tests/test_gm_auto_identity.py index c5b213956f..69bf082c67 100644 --- a/opendbc_repo/opendbc/car/gm/tests/test_gm_auto_identity.py +++ b/opendbc_repo/opendbc/car/gm/tests/test_gm_auto_identity.py @@ -165,9 +165,15 @@ class TestGMAutoIdentity(unittest.TestCase): def test_ambiguous_and_manual_identities_remain_unadvertised(self): for name in ('CHEVROLET_BOLT_ACC_2022_2023', 'CHEVROLET_BOLT_ACC_2022_2023_PEDAL', - 'CHEVROLET_BOLT_CC_2022_2023', 'CHEVROLET_TRAX'): + 'CHEVROLET_BOLT_CC_2022_2023'): self.assertNotIn('gm.' + name, self.inventory) + def test_registered_trax_still_requires_identity_beyond_can(self): + variants = self.inventory['gm.CHEVROLET_TRAX'] + self.assertEqual(len(variants), 1) + self.assertEqual(set(self.candidates(variants[0].items())), + {'gm.CHEVROLET_TRAX', 'gm.CHEVROLET_EQUINOX', 'gm.CHEVROLET_SILVERADO'}) + if __name__ == '__main__': unittest.main() diff --git a/opendbc_repo/opendbc/car/tests/test_docs.py b/opendbc_repo/opendbc/car/tests/test_docs.py index cdf5b1df4a..ebceac8eab 100644 --- a/opendbc_repo/opendbc/car/tests/test_docs.py +++ b/opendbc_repo/opendbc/car/tests/test_docs.py @@ -101,7 +101,8 @@ class TestCarDocs(unittest.TestCase): if isinstance(doc, GMCommunityCarDocs): self.assertEqual(doc.support_type, SupportType.COMMUNITY) self.assertFalse(doc.merged) - expected_harness = (CarHarness.custom if "ASCM Harness" in doc.name or "(CC)" in doc.name else + expected_harness = (CarHarness.gm if platform == GM.CHEVROLET_BOLT_ACC_2022_2023 else + CarHarness.custom if "ASCM Harness" in doc.name or "(CC)" in doc.name else CarHarness.gmsdgm if "SDGM Harness" in doc.name else CarHarness.gm if "Camera Harness" in doc.name else CarHarness.obd_ii) self.assertIn(expected_harness, doc.car_parts.parts) diff --git a/prebuilt.json b/prebuilt.json index d2af4e24ba..5bc0a53aed 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "86d751c8e06e09bd36f30694fcca31f06823de732027e443fe92a56a699c88ed", "schema_version": 1} +{"protected_inventory_sha256": "7b00d3f8766a5fdcffd5e98ac639dc711e5cab6601c20817a88209a9248d80ce", "schema_version": 1}