From e59fa4930aee259dbacfff4706fa5ffb6ebb2b8c Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Mon, 23 Nov 2026 22:42:06 -0600 Subject: [PATCH] Keep second-Panda Hyundai HDA2 on stock cruise at startup --- opendbc_repo/opendbc/car/hyundai/interface.py | 4 +++- .../hyundai/tests/test_torque_ev_startup.py | 24 ++++++++++++++++++- prebuilt.json | 2 +- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/opendbc_repo/opendbc/car/hyundai/interface.py b/opendbc_repo/opendbc/car/hyundai/interface.py index 8f9cd1c033..768659f2af 100644 --- a/opendbc_repo/opendbc/car/hyundai/interface.py +++ b/opendbc_repo/opendbc/car/hyundai/interface.py @@ -304,11 +304,13 @@ class CarInterface(CarInterfaceBase): ret.radarUnavailable = not stinger_2022_radar_available(fingerprint) else: ret.radarUnavailable = radar_start not in fingerprint[1] or Bus.radar not in DBC[ret.carFingerprint] - from opendbc.car.hyundai.torque_ev_startup import topology_owned as torque_ev_topology + from opendbc.car.hyundai.torque_ev_startup import CARS as torque_ev_cars, topology_owned as torque_ev_topology if torque_ev_topology(ret): # The prepared owner alone promotes the saved developer choice before CI construction. ret.alphaLongitudinalAvailable = not is_release alpha_long = False + elif candidate in torque_ev_cars and ret.flags & HyundaiFlags.CANFD_LKA_STEER_MSG and CAN.offset != 0: + ret.alphaLongitudinalAvailable = False from opendbc.car.hyundai.legacy_long_aol import CARS as legacy_long_cars 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 diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_torque_ev_startup.py b/opendbc_repo/opendbc/car/hyundai/tests/test_torque_ev_startup.py index b93131bde3..95dfe39800 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_torque_ev_startup.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_torque_ev_startup.py @@ -5,7 +5,7 @@ from types import SimpleNamespace from unittest.mock import patch import pytest -from opendbc.car import gen_empty_fingerprint, make_tester_present_msg +from opendbc.car import gen_empty_fingerprint, make_tester_present_msg, structs from opendbc.car.hyundai.interface import CarInterface from opendbc.car.hyundai.values import CAR, HyundaiFlags from opendbc.car.hyundai.ecu_startup import Outcome @@ -196,6 +196,28 @@ def test_unowned_topologies_preserve_factory_output(car, variant, alpha): assert not required(actual) +@pytest.mark.parametrize("alt", [False, True]) +def test_second_panda_hda2_starts_with_factory_cruise(alt): + from openpilot.starpilot.vehicle_startup import VehicleStartupOwner + from opendbc.car.hyundai.values import HyundaiSafetyFlags + + fp = gen_empty_fingerprint() + fp[6].update({0x110: 32, 0x362: 32} if alt else {0x50: 16, 0x2A4: 24}) + fp[5].update({0x1CF: 8, 0x35: 32, 0xA0: 24, 0xEA: 24, 0x1A0: 32}) + fw = [structs.CarParams.CarFw.new_message(ecu=structs.CarParams.Ecu.adas)] + cp = CarInterface.get_params(CAR.HYUNDAI_IONIQ_5, fp, fw, True, False, False) + stock = CarInterface.get_params(CAR.HYUNDAI_IONIQ_5, fp, fw, False, False, False) + sent = [] + startup = VehicleStartupOwner() + cp = startup.prepare(cp, CarInterface, (list, sent.extend), requested=True, admission=lambda: True) + startup.configure(CarInterface(cp)) + assert cp.to_dict() == stock.to_dict() + assert len(cp.safetyConfigs) == 2 + assert cp.pcmCruise and not cp.openpilotLongitudinalControl and not cp.alphaLongitudinalAvailable + assert not any(config.safetyParam & HyundaiSafetyFlags.LONG for config in cp.safetyConfigs) + assert sent == [] + + @pytest.mark.parametrize("reply,accepted", [(None, True), (b"\x68\x03", True), (b"\x7f\x28\x22", False), (b"\x68\x01", False)]) def test_real_isotp_decoder_classifies_suppressed_command(stock, reply, accepted): import time diff --git a/prebuilt.json b/prebuilt.json index 5fcc20ab50..9d2545c89c 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "5602b0f7f4a8059ffb07dbce31e32c7ea776c96a6868dc1072d1ad669097ac05", "schema_version": 1} +{"protected_inventory_sha256": "12bb56bff6e9d6c2cebc5969cf048722d31a1c61aaae853a57bf5bf6b5131545", "schema_version": 1}