From b310398dd23f7921fa6ca16bcedc4ef356f532e4 Mon Sep 17 00:00:00 2001 From: Greg Hogan Date: Tue, 12 Jan 2021 11:50:08 -0800 Subject: [PATCH] hyundai: support for controlling cruise speed via HDA (#19635) old-commit-hash: f205f97be0599f6ae025860e80e4c626690bf186 --- opendbc | 2 +- selfdrive/car/hyundai/carcontroller.py | 4 ++-- selfdrive/car/hyundai/carstate.py | 2 +- selfdrive/car/hyundai/hyundaican.py | 20 +++++--------------- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/opendbc b/opendbc index b54a68d140..4e8914f0c2 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit b54a68d14075a64a4c70a677518bfff2d7cfa3be +Subproject commit 4e8914f0c22eb4a7754e80b229b2eeec3ac22ec6 diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index dc14bfb342..4c1dba1099 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -1,7 +1,7 @@ from cereal import car from common.realtime import DT_CTRL from selfdrive.car import apply_std_steer_torque_limits -from selfdrive.car.hyundai.hyundaican import create_lkas11, create_clu11, create_lfa_mfa +from selfdrive.car.hyundai.hyundaican import create_lkas11, create_clu11, create_lfahda_mfc from selfdrive.car.hyundai.values import Buttons, CarControllerParams, CAR from opendbc.can.packer import CANPacker @@ -82,6 +82,6 @@ class CarController(): # 20 Hz LFA MFA message if frame % 5 == 0 and self.car_fingerprint in [CAR.SONATA, CAR.PALISADE, CAR.IONIQ, CAR.KIA_NIRO_EV, CAR.IONIQ_EV_2020]: - can_sends.append(create_lfa_mfa(self.packer, frame, enabled)) + can_sends.append(create_lfahda_mfc(self.packer, enabled)) return can_sends diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index b799a13fe3..4768e6670c 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -294,7 +294,7 @@ class CarState(CarStateBase): ("CF_Lkas_FcwCollisionWarning", "LKAS11", 0), ("CF_Lkas_FusionState", "LKAS11", 0), ("CF_Lkas_FcwOpt_USM", "LKAS11", 0), - ("CF_Lkas_LdwsOpt_USM", "LKAS11", 0) + ("CF_Lkas_LdwsOpt_USM", "LKAS11", 0), ] checks = [ diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 9f064edff1..0f52322827 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -67,21 +67,11 @@ def create_clu11(packer, frame, clu11, button): return packer.make_can_msg("CLU11", 0, values) -def create_lfa_mfa(packer, frame, enabled): +def create_lfahda_mfc(packer, enabled, hda_set_speed=0): values = { - "ACTIVE": enabled, + "LFA_Icon_State": 2 if enabled else 0, + "HDA_Active": 1 if hda_set_speed else 0, + "HDA_Icon_State": 2 if hda_set_speed else 0, + "HDA_VSetReq": hda_set_speed, } - - # ACTIVE 1 = Green steering wheel icon - - # LFA_USM 2 & 3 = LFA cancelled, fast loud beeping - # LFA_USM 0 & 1 = No mesage - - # LFA_SysWarning 1 = "Switching to HDA", short beep - # LFA_SysWarning 2 = "Switching to Smart Cruise control", short beep - # LFA_SysWarning 3 = LFA error - - # ACTIVE2: nothing - # HDA_USM: nothing - return packer.make_can_msg("LFAHDA_MFC", 0, values)