From c03d06b408d904f40fb287a01480fc200b90bd1c Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Mon, 7 Sep 2026 09:39:54 -0500 Subject: [PATCH] lfa --- .../opendbc/car/hyundai/carcontroller.py | 5 ++-- .../opendbc/car/hyundai/tests/test_hyundai.py | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/opendbc_repo/opendbc/car/hyundai/carcontroller.py b/opendbc_repo/opendbc/car/hyundai/carcontroller.py index fd484eeab..2c6d47e1d 100644 --- a/opendbc_repo/opendbc/car/hyundai/carcontroller.py +++ b/opendbc_repo/opendbc/car/hyundai/carcontroller.py @@ -852,7 +852,8 @@ class CarController(CarControllerBase): lka_steering = self.CP.flags & HyundaiFlags.CANFD_LKA_STEERING longitudinal_active = bool(self.long_active_ecu and getattr(CC, "longActive", False)) - lka_steering_long = lka_steering and longitudinal_active + lfa_longitudinal_active = longitudinal_active if self.CP.carFingerprint == CAR.GENESIS_GV70_ELECTRIFIED_1ST_GEN else self.CP.openpilotLongitudinalControl + lka_steering_long = lka_steering and lfa_longitudinal_active ccnc_non_hda2 = self.CP.flags & HyundaiFlags.CCNC and not lka_steering use_egmp_dynamic_long_tuning = egmp_dynamic_longitudinal_tuning(self.CP) and self.long_active_ecu and \ CC.actuators.longControlState in (LongCtrlState.starting, LongCtrlState.pid, LongCtrlState.stopping) @@ -891,7 +892,7 @@ class CarController(CarControllerBase): CS.stock_lfa_msg if preserve_stock_lfa_status else None, CS.stock_lkas_msg if preserve_stock_lkas else None, lka_icon=lka_icon, - longitudinal_active=longitudinal_active)) + longitudinal_active=lfa_longitudinal_active)) direct_steering_active = ccnc_angle_long and drive_gear and CC.latActive and self.direct_angle_request_allowed and not CS.angle_steering_fault inactive_steering_angle = float(np.clip(CS.angle_steering_angle, -self.params.ANGLE_LIMITS.STEER_ANGLE_MAX, diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py b/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py index 4de27b6a5..27931c34f 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py @@ -2536,6 +2536,29 @@ class TestHyundaiFingerprint: if controller.packer.dbc.addr_to_msg[addr].name in ("LFA", "LKAS")] assert steering_names == [("LFA", can_bus.ECAN), ("LKAS", can_bus.ACAN)] + def test_ioniq_6_keeps_lfa_status_when_longitudinal_is_inactive(self): + CP = CarParams.new_message() + CP.carFingerprint = CAR.HYUNDAI_IONIQ_6 + CP.flags = int(HyundaiFlags.CANFD | HyundaiFlags.EV | HyundaiFlags.CANFD_LKA_STEERING) + CP.openpilotLongitudinalControl = True + + controller = CarController(DBC[CP.carFingerprint], CP) + controller.frame = 1 + controller.long_active_ecu = False + cc = SimpleNamespace( + enabled=False, latActive=False, longActive=False, + actuators=SimpleNamespace(longControlState=LongCtrlState.off), + leftBlinker=False, rightBlinker=False, hudControl=SimpleNamespace(), + ) + cs = SimpleNamespace( + stock_lfa_msg=None, stock_lkas_msg=None, + out=SimpleNamespace(gearShifter=structs.CarState.GearShifter.park), + ) + + msgs = controller.create_canfd_msgs(0, False, 0.0, 0.0, 0.0, 0.0, False, + cc.hudControl, cs, cc, get_test_toggles(), lka_icon=1, lfa_icon=1) + assert any(addr == 0x12A for addr, _, _ in msgs) + def test_gv70_electrified_longitudinal_uses_hda2_scc_contract(self): CP = CarParams.new_message() CP.carFingerprint = CAR.GENESIS_GV70_ELECTRIFIED_1ST_GEN