diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index c3d061de782c1a..bbb658ff74e29a 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -25,6 +25,7 @@ def __init__(self, CP): self.pt_lka_steering_cmd_counter = 0 self.cam_lka_steering_cmd_counter = 0 self.buttons_counter = 0 + self.cruise_resume_allowed = False def update(self, pt_cp, cam_cp, loopback_cp): ret = car.CarState.new_message() @@ -107,6 +108,7 @@ def update(self, pt_cp, cam_cp, loopback_cp): pt_cp.vl["EBCMFrictionBrakeStatus"]["FrictionBrakeUnavailable"] == 1) ret.cruiseState.enabled = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] != AccState.OFF + self.cruise_resume_allowed = self.cruise_resume_allowed or ret.cruiseState.enabled ret.cruiseState.standstill = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.STANDSTILL if self.CP.networkLocation == NetworkLocation.fwdCamera: ret.cruiseState.speed = cam_cp.vl["ASCMActiveCruiseControlStatus"]["ACCSpeedSetpoint"] * CV.KPH_TO_MS diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 05caa28510290c..38e3c831db52d3 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -285,7 +285,7 @@ def _update(self, c): pcm_enable=self.CP.pcmCruise, enable_buttons=(ButtonType.decelCruise,)) if not self.CP.pcmCruise: if any(b.type == ButtonType.accelCruise and b.pressed for b in ret.buttonEvents): - events.add(EventName.buttonEnable) + events.add(EventName.buttonEnable if self.CS.cruise_resume_allowed else EventName.resumeBlocked) # Enabling at a standstill with brake is allowed # TODO: verify 17 Volt can enable for the first time at a stop and allow for all GMs diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index cf978ada32bd84..f4e4843405d2e7 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -45,7 +45,6 @@ LaneChangeState = log.LaneChangeState LaneChangeDirection = log.LaneChangeDirection EventName = car.CarEvent.EventName -ButtonType = car.CarState.ButtonEvent.Type SafetyModel = car.CarParams.SafetyModel IGNORED_SAFETY_MODES = (SafetyModel.silent, SafetyModel.noOutput) @@ -228,11 +227,6 @@ def update_events(self, CS): if self.CP.passive: return - # Block resume if cruise never previously enabled - resume_pressed = any(be.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for be in CS.buttonEvents) - if not self.CP.pcmCruise and not self.v_cruise_helper.v_cruise_initialized and resume_pressed: - self.events.add(EventName.resumeBlocked) - # Disable on rising edge of accelerator or brake. Also disable on brake when speed > 0 if (CS.gasPressed and not self.CS_prev.gasPressed and self.disengage_on_accelerator) or \ (CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)) or \