diff --git a/selfdrive/car/mazda/carcontroller.py b/selfdrive/car/mazda/carcontroller.py index 2c4a8ffa4c..3f3fc24b93 100644 --- a/selfdrive/car/mazda/carcontroller.py +++ b/selfdrive/car/mazda/carcontroller.py @@ -27,12 +27,6 @@ class CarController(): CS.out.steeringTorque, CarControllerParams) self.steer_rate_limited = new_steer != apply_steer - if c.enabled: - if c.cruiseControl.resume and frame % 5 == 0: - # Mazda Stop and Go requires a RES button (or gas) press if the car stops more than 3 seconds - # Send Resume button at when planner wants car to move - can_sends.append(mazdacan.create_button_cmd(self.packer, self.CP.carFingerprint, CS.crz_btns_counter, Buttons.RESUME)) - if c.cruiseControl.cancel: # If brake is pressed, let us wait >70ms before trying to disable crz to avoid # a race condition with the stock system, where the second cancel from openpilot @@ -43,7 +37,12 @@ class CarController(): # Cancel Stock ACC if it's enabled while OP is disengaged # Send at a rate of 10hz until we sync with stock ACC state can_sends.append(mazdacan.create_button_cmd(self.packer, self.CP.carFingerprint, CS.crz_btns_counter, Buttons.CANCEL)) - else: + elif c.cruiseControl.resume and frame % 5 == 0: + # Mazda Stop and Go requires a RES button (or gas) press if the car stops more than 3 seconds + # Send Resume button at when planner wants car to move + can_sends.append(mazdacan.create_button_cmd(self.packer, self.CP.carFingerprint, CS.crz_btns_counter, Buttons.RESUME)) + + if not c.cruiseControl.cancel: self.brake_counter = 0 self.apply_steer_last = apply_steer diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 36e6d4fb6b..594af47814 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -646,7 +646,7 @@ class Controls: CC.cruiseControl.cancel = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise) if self.joystick_mode and self.sm.rcv_frame['testJoystick'] > 0 and self.sm['testJoystick'].buttons[0]: CC.cruiseControl.cancel = True - if len(speeds := self.sm['longitudinalPlan'].speeds) > 1: + if len(speeds := self.sm['longitudinalPlan'].speeds): CC.cruiseControl.resume = self.enabled and CS.cruiseState.standstill and speeds[-1] > self.CP.vEgoStarting hudControl = CC.hudControl