From 22b4aabeceeb71a9d53bc8d477a0cb92922cc6ae Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Tue, 24 Mar 2026 22:52:57 -0500 Subject: [PATCH] try cancel --- opendbc_repo/opendbc/car/gm/carcontroller.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/opendbc_repo/opendbc/car/gm/carcontroller.py b/opendbc_repo/opendbc/car/gm/carcontroller.py index e7442648..dcf59404 100644 --- a/opendbc_repo/opendbc/car/gm/carcontroller.py +++ b/opendbc_repo/opendbc/car/gm/carcontroller.py @@ -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: