This commit is contained in:
Your Name
2024-05-04 01:12:37 -05:00
parent f33e442096
commit e1cd56ab16
2 changed files with 7 additions and 2 deletions

View File

@@ -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:

View File

@@ -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