mazda: ensure no resume if cancelling

pull/24873/head
Shane Smiskol 3 years ago
parent 5771cdecab
commit 6a63bd60f0
  1. 13
      selfdrive/car/mazda/carcontroller.py
  2. 2
      selfdrive/controls/controlsd.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

@ -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

Loading…
Cancel
Save