try cancel

This commit is contained in:
firestar5683
2026-03-24 22:52:57 -05:00
parent 99c5294647
commit 22b4aabece
+4 -14
View File
@@ -20,13 +20,6 @@ CAMERA_CANCEL_DELAY_FRAMES = 10
MIN_STEER_MSG_INTERVAL_MS = 15
def get_stock_cc_active_for_cancel(CP, CS):
stock_cc_active = CS.out.cruiseState.enabled or CS.pcm_acc_status != AccState.OFF
if CP.carFingerprint == CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL:
return CS.out.cruiseState.enabled
return stock_cc_active
class CarController(CarControllerBase):
def __init__(self, dbc_names, CP):
super().__init__(dbc_names, CP)
@@ -540,14 +533,11 @@ class CarController(CarControllerBase):
if self.CP.networkLocation == NetworkLocation.gateway and self.frame % keepalive_step == 0:
can_sends += gmcan.create_adas_keepalive(CanBus.POWERTRAIN)
# - CC_LONG: cancel stock CC if OP is not active
stock_cc_active = get_stock_cc_active_for_cancel(self.CP, CS)
pedal_cancel = bool(self.CP.flags & GMFlags.PEDAL_LONG.value)
if self.CP.carFingerprint == CAR.CHEVROLET_MALIBU_HYBRID_CC:
pedal_cancel = pedal_cancel and CC.longActive
pedal_cancel = bool(self.CP.flags & GMFlags.PEDAL_LONG.value) and CS.out.cruiseState.enabled
cc_long_cancel = ((self.CP.flags & GMFlags.CC_LONG.value) and
self.prev_op_enabled and not CC.enabled and CS.out.cruiseState.enabled)
if ((pedal_cancel and stock_cc_active) or
(((self.CP.flags & GMFlags.CC_LONG.value) and not CC.enabled) and stock_cc_active)):
if pedal_cancel or cc_long_cancel:
if self.CP.carFingerprint == CAR.CHEVROLET_MALIBU_HYBRID_CC:
malibu_cancel_requested = True
elif (self.frame - self.last_button_frame) * DT_CTRL > 0.04: