From 40a23df6be352e62faf8821e44e5ea0913e0bfab Mon Sep 17 00:00:00 2001 From: Dom <168790843+firestar5683@users.noreply.github.com> Date: Mon, 26 Oct 2026 16:23:24 -0500 Subject: [PATCH] Align damping qualification fixtures and preserve MISRA parameter immutability --- .../opendbc/safety/modes/hyundai_canfd.h | 3 ++- .../opendbc/safety/tests/test_hkg_mode_parity.py | 5 +++-- .../selfdrive/pandad/tests/test_aol_protocol.cc | 2 +- .../aol/tests/test_gv70_two_panda_long.py | 16 ++++++++++------ openpilot/starpilot/tests/test_ev6_startup.py | 3 ++- openpilot/starpilot/tests/test_gv70_startup.py | 2 +- prebuilt.json | 2 +- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/opendbc_repo/opendbc/safety/modes/hyundai_canfd.h b/opendbc_repo/opendbc/safety/modes/hyundai_canfd.h index 324eea6b18..a10112e14f 100644 --- a/opendbc_repo/opendbc/safety/modes/hyundai_canfd.h +++ b/opendbc_repo/opendbc/safety/modes/hyundai_canfd.h @@ -1273,7 +1273,8 @@ static bool hyundai_canfd_angle_aol_capacity(safety_config *ret) { return bounded; } -static safety_config hyundai_canfd_init_validated(uint16_t param) { +static safety_config hyundai_canfd_init_validated(uint16_t supplied_param) { + uint16_t param = supplied_param; const uint16_t HYUNDAI_PARAM_LONGITUDINAL = 4U; const uint16_t HYUNDAI_PARAM_CANFD_LKA_STEER_MSG_ALT = 128; const uint16_t HYUNDAI_PARAM_CANFD_ALT_BUTTONS = 32; diff --git a/opendbc_repo/opendbc/safety/tests/test_hkg_mode_parity.py b/opendbc_repo/opendbc/safety/tests/test_hkg_mode_parity.py index ab5319d395..fb4f9a87c3 100644 --- a/opendbc_repo/opendbc/safety/tests/test_hkg_mode_parity.py +++ b/opendbc_repo/opendbc/safety/tests/test_hkg_mode_parity.py @@ -119,7 +119,7 @@ def test_gv70_long_profile_admits_independent_aol(): from opendbc.car.hyundai.tests.test_gv70_longitudinal import params as gv70_params from openpilot.starpilot.car.hyundai.aol import policy_for cp = gv70_params() - assert cp.openpilotLongitudinalControl and cp.safetyConfigs[0].safetyParam == 0x15 + assert cp.openpilotLongitudinalControl and cp.safetyConfigs[0].safetyParam == 0x2015 policy = policy_for(cp) assert policy.intent_supported and policy.runtime_supported and policy.explicit_latch @@ -181,7 +181,8 @@ def test_gv70_long_aol_rejects_unsupported_profile(defect): cp.safetyConfigs[0].safetyParam |= policy.safety_param_addition cp.alternativeExperience |= policy.alternative_experience_addition assert qualified_long(cp, marked_only=True) - assert native_accepts_cp(cp, int(cp.safetyConfigs[0].safetyModel.raw), 0x815) + assert cp.safetyConfigs[0].safetyParam == 0x2815 + assert native_accepts_cp(cp, int(cp.safetyConfigs[0].safetyModel.raw), 0x2815) if defect == 'pcm': cp.pcmCruise = True elif defect == 'long': diff --git a/openpilot/selfdrive/pandad/tests/test_aol_protocol.cc b/openpilot/selfdrive/pandad/tests/test_aol_protocol.cc index ff488b16fb..7d1d73d077 100644 --- a/openpilot/selfdrive/pandad/tests/test_aol_protocol.cc +++ b/openpilot/selfdrive/pandad/tests/test_aol_protocol.cc @@ -498,7 +498,7 @@ int main() { 0x7090U, 0x7092U, 0x7208U, 0x720AU, 0x7228U, 0x722AU, 0x7809U, 0x7829U, }; for (uint32_t word = 0U; word <= 0xFFFFU; ++word) { - bool expected = word == 0x0815U || word == 0x0895U || word == 0x8815U || word == 0x8895U || word == 0x5491U || word == 0x5C91U || word == 0x5C95U || word == 0x5495U; + bool expected = word == 0x2815U || word == 0x2895U || word == 0x0815U || word == 0x0895U || word == 0x8815U || word == 0x8895U || word == 0x5491U || word == 0x5C91U || word == 0x5C95U || word == 0x5495U; for (uint16_t stock_word : stock_canfd_words) { expected = expected || word == stock_word; } diff --git a/openpilot/starpilot/aol/tests/test_gv70_two_panda_long.py b/openpilot/starpilot/aol/tests/test_gv70_two_panda_long.py index c687f2b95f..613493effc 100644 --- a/openpilot/starpilot/aol/tests/test_gv70_two_panda_long.py +++ b/openpilot/starpilot/aol/tests/test_gv70_two_panda_long.py @@ -18,7 +18,7 @@ def test_selected_gv70_long_owner_preserves_factory_configuration(pandas): cp.safetyConfigs[-1].safetyParam |= policy.safety_param_addition cp.alternativeExperience |= policy.alternative_experience_addition assert qualified_long(cp, marked_only=True) and config_index(cp) == pandas - 1 - assert native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x815) + assert native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x2815) assert not native_accepts_cp(cp, int(structs.CarParams.SafetyModel.noOutput), 0) assert not native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x895) marked = cp.to_dict() @@ -28,14 +28,18 @@ def test_selected_gv70_long_owner_preserves_factory_configuration(pandas): assert marked['alternativeExperience'] == 32 -@pytest.mark.parametrize('fault', ['aux_word', 'aux_model', 'order', 'extra_slot', 'owner_model', 'owner_word', +@pytest.mark.parametrize('fault', ['missing_damping', 'aux_word', 'aux_model', 'order', 'extra_slot', 'owner_model', 'owner_word', 'experience', 'foreign_identity', 'angle', 'alt_lka', 'alt_buttons', 'camera', 'ccnc', 'hybrid', 'passive', 'dashcam', 'not_car', 'pcm', 'missing_long', 'steer_type']) def test_two_panda_gv70_long_refuses_unqualified_configuration(fault): cp, _, _ = factory(CAR.GENESIS_GV70_ELECTRIFIED_1ST_GEN) - cp.safetyConfigs[-1].safetyParam = 0x815 + cp.safetyConfigs[-1].safetyParam = 0x2815 cp.alternativeExperience = 32 - if fault == 'aux_word': + assert qualified_long(cp, marked_only=True) + assert native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x2815) + if fault == 'missing_damping': + cp.safetyConfigs[-1].safetyParam = 0x815 + elif fault == 'aux_word': cp.safetyConfigs[0].safetyParam = 1 elif fault == 'aux_model': cp.safetyConfigs[0].safetyModel = 'silent' @@ -46,7 +50,7 @@ def test_two_panda_gv70_long_refuses_unqualified_configuration(fault): elif fault == 'owner_model': cp.safetyConfigs[-1].safetyModel = 'hyundai' elif fault == 'owner_word': - cp.safetyConfigs[-1].safetyParam = 0x895 + cp.safetyConfigs[-1].safetyParam = 0x2895 elif fault == 'experience': cp.alternativeExperience = 0 elif fault == 'foreign_identity': @@ -68,4 +72,4 @@ def test_two_panda_gv70_long_refuses_unqualified_configuration(fault): elif fault == 'steer_type': cp.steerControlType = 'angle' assert not qualified_long(cp, marked_only=True) - assert not native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x815) + assert not native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x2815) diff --git a/openpilot/starpilot/tests/test_ev6_startup.py b/openpilot/starpilot/tests/test_ev6_startup.py index 2cbd7e1e6e..d91c03c614 100644 --- a/openpilot/starpilot/tests/test_ev6_startup.py +++ b/openpilot/starpilot/tests/test_ev6_startup.py @@ -112,7 +112,8 @@ class TestEV6Startup(unittest.TestCase): admission_results and admission_results[0]): self.assertIs(holder.owner.outcome, Outcome.SENT_UNCONFIRMED) self.assertTrue(ci.CP.openpilotLongitudinalControl) - self.assertEqual(ci.CP.safetyConfigs[-1].safetyParam, 0x15) + self.assertEqual(ci.CP.safetyConfigs[-1].safetyParam, + 0x2015 if car == CAR.GENESIS_GV70_ELECTRIFIED_1ST_GEN else 0x15) return ci, holder, requests def test_sent_prepublication_binds_immutable_template_and_suppressed_protocol(self): diff --git a/openpilot/starpilot/tests/test_gv70_startup.py b/openpilot/starpilot/tests/test_gv70_startup.py index 6331f3b828..f384f2ee02 100644 --- a/openpilot/starpilot/tests/test_gv70_startup.py +++ b/openpilot/starpilot/tests/test_gv70_startup.py @@ -27,7 +27,7 @@ class TestGV70Startup(unittest.TestCase): self.assertIs(holder.owner.outcome, Outcome.SENT_UNCONFIRMED) self.assertIsInstance(ci.CC.adrv_template, GV70Template) self.assertNotIsInstance(ci.CC.adrv_template, EV6Template) - self.assertEqual(ci.CP.safetyConfigs[-1].safetyParam, 0x15) + self.assertEqual(ci.CP.safetyConfigs[-1].safetyParam, 0x2015) self.assertIn(b'\x28\x83\x01', requests) self.assertNotIn(b'\x28\x03\x01', requests) ci.CP.safetyConfigs[-1].safetyParam ^= 4 diff --git a/prebuilt.json b/prebuilt.json index 6e7044f6a0..46b0bb1f46 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "88ebc71e4fd19cdea51fe362738b6641edb5dc03c4f9b4e9f14671c4deff470b", "schema_version": 1} +{"protected_inventory_sha256": "e6f127f6aa4406e96340a814e491f5889c01f4e66213492134703996758d0a87", "schema_version": 1}