From fb1639f53899ae349dc452abe7387188fcdb8478 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sat, 20 Dec 2025 23:56:06 -0600 Subject: [PATCH] Revert "Update carcontroller.py" This reverts commit 7479aa327b1a70f130adbbfb701db26a9dff6802. --- opendbc_repo/opendbc/car/gm/carcontroller.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/opendbc_repo/opendbc/car/gm/carcontroller.py b/opendbc_repo/opendbc/car/gm/carcontroller.py index 98a99e1a7..9c5a7655f 100644 --- a/opendbc_repo/opendbc/car/gm/carcontroller.py +++ b/opendbc_repo/opendbc/car/gm/carcontroller.py @@ -6,6 +6,7 @@ from opendbc.car.gm import gmcan from opendbc.car.common.conversions import Conversions as CV from opendbc.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons from opendbc.car.interfaces import CarControllerBase +from opendbc.sunnypilot.car.gm.values_ext import GMFlagsSP from opendbc.sunnypilot.car.gm.icbm import IntelligentCruiseButtonManagementInterface VisualAlert = structs.CarControl.HUDControl.VisualAlert @@ -38,6 +39,7 @@ class CarController(CarControllerBase, IntelligentCruiseButtonManagementInterfac self.packer_obj = CANPacker(DBC[self.CP.carFingerprint][Bus.radar]) self.packer_ch = CANPacker(DBC[self.CP.carFingerprint][Bus.chassis]) + GasInterceptorCarController.__init__(self, CP, CP_SP) IntelligentCruiseButtonManagementInterface.__init__(self, CP, CP_SP) def update(self, CC, CC_SP, CS, now_nanos): @@ -111,9 +113,14 @@ class CarController(CarControllerBase, IntelligentCruiseButtonManagementInterfac at_full_stop = at_full_stop and stopping friction_brake_bus = CanBus.POWERTRAIN + pedal_interceptor_active = self.CP.enableGasInterceptorDEPRECATED and (self.CP_SP.flags & GMFlagsSP.NON_ACC) + if pedal_interceptor_active: + self.apply_brake = 0 + # GasRegenCmdActive needs to reflect whether openpilot is actually commanding longitudinal torque gas_regen_active = CC.longActive and CC.enabled - can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, gas_regen_active, at_full_stop)) + if not pedal_interceptor_active: + can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, gas_regen_active, at_full_stop)) can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, friction_brake_bus, self.apply_brake, idx, CC.enabled, near_stop, at_full_stop, self.CP)) @@ -168,5 +175,8 @@ class CarController(CarControllerBase, IntelligentCruiseButtonManagementInterfac new_actuators.gas = self.apply_gas new_actuators.brake = self.apply_brake + # sunnypilot gas interceptor / NON_ACC extensions + self.extend_with_interceptor(CC, CS, new_actuators, can_sends) + self.frame += 1 return new_actuators, can_sends