From e1cd56ab164f740f24ffa6eade259bf010e71463 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 4 May 2024 01:12:37 -0500 Subject: [PATCH] wip --- selfdrive/car/hyundai/carcontroller.py | 5 +++++ selfdrive/car/hyundai/carstate.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 661c7c3..05927b3 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -137,6 +137,11 @@ class CarController(CarControllerBase): set_speed_in_units, hud_control)) self.accel_last = accel else: + # Clearpilot + # If cruise control was enabled or idle on start, force cancel + if CS.fix_main_enabled_cancel_main: + CS.fix_main_enabled_cancel_main = False + CC.cruiseControl.cancel = True # button presses can_sends.extend(self.create_button_messages(CC, CS, use_clu11=False)) else: diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index d2a7e16..723e633 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -61,6 +61,7 @@ class CarState(CarStateBase): # Clearpilot variables self.fix_main_enabled_check = True self.fix_main_enabled_executed = False + self.fix_main_enabled_cancel_main = False def calculate_speed_limit(self, cp, cp_cam): if self.CP.carFingerprint in CANFD_CAR: @@ -279,8 +280,7 @@ class CarState(CarStateBase): if self.fix_main_enabled_check: self.fix_main_enabled_check = False if ret.cruiseState.speed > 1 and self.main_enabled == False: - self.main_enabled = True - self.fix_main_enabled_executed = True + self.fix_main_enabled_cancel_main = True 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