From 0fb76d6ef75f7eb4f788032e92c5b1a2e89d541a Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 6 Sep 2023 03:20:18 -0700 Subject: [PATCH] lfa block one place --- selfdrive/car/hyundai/carstate.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 0c26deff00..ce9efd3b75 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -53,6 +53,10 @@ class CarState(CarStateBase): self.params = CarControllerParams(CP) def update(self, cp, cp_cam): + # HDA2 CAN FD and hybrid CAN FD both use common messages to block stock LFA + if self.CP.flags & HyundaiFlags.CANFD_HDA2: + self.hda2_lfa_block_msg = self.get_hda2_lfa_block_msg(cp_cam, self.CP) + if self.CP.carFingerprint in CANFD_CAR: return self.update_canfd(cp, cp_cam) @@ -157,8 +161,6 @@ class CarState(CarStateBase): # save the entire LKAS11 and CLU11 self.lkas11 = copy.copy(cp_cam.vl["LKAS11"]) self.clu11 = copy.copy(cp.vl["CLU11"]) - if self.CP.flags & HyundaiFlags.CAN_CANFD and self.CP.flags & HyundaiFlags.CANFD_HDA2: - self.hda2_lfa_block_msg = self.get_hda2_lfa_block_msg(cp_cam, self.CP) self.steer_state = cp.vl["MDPS12"]["CF_Mdps_ToiActive"] # 0 NOT ACTIVE, 1 ACTIVE self.prev_cruise_buttons = self.cruise_buttons[-1] self.cruise_buttons.extend(cp.vl_all["CLU11"]["CF_Clu_CruiseSwState"]) @@ -235,9 +237,6 @@ class CarState(CarStateBase): self.buttons_counter = cp.vl[self.cruise_btns_msg_canfd]["COUNTER"] ret.accFaulted = cp.vl["TCS"]["ACCEnable"] != 0 # 0 ACC CONTROL ENABLED, 1-3 ACC CONTROL DISABLED - if self.CP.flags & HyundaiFlags.CANFD_HDA2: - self.hda2_lfa_block_msg = self.get_hda2_lfa_block_msg(cp_cam, self.CP) - return ret def get_can_parser(self, CP):