Send ACC cancel only if we are sure cruise is enabled

Otherwise we run the risk of disabling main cruise

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
pull/988/head
Jafar Al-Gharaibeh 5 years ago committed by Adeeb Shihadeh
parent 334d28fa98
commit a953362ffc
  1. 6
      selfdrive/car/mazda/carcontroller.py
  2. 3
      selfdrive/car/mazda/interface.py

@ -9,7 +9,7 @@ class CarController():
self.packer = CANPacker(dbc_name)
self.steer_rate_limited = False
def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd):
def update(self, enabled, CS, frame, actuators):
""" Controls thread """
can_sends = []
@ -31,8 +31,8 @@ class CarController():
else:
apply_steer = 0
self.steer_rate_limited = False
if pcm_cancel_cmd and frame % 10 == 0:
# Cancel Stock ACC if it's engaged with OP disengaged
if CS.out.cruiseState.enabled and frame % 10 == 0:
# Cancel Stock ACC if it's enabled while OP is disengaged
# Match stock message rate which is sent at 10hz
can_sends.append(mazdacan.create_button_cmd(self.packer, CS.CP.carFingerprint, Buttons.CANCEL))

@ -89,7 +89,6 @@ class CarInterface(CarInterfaceBase):
return self.CS.out
def apply(self, c):
can_sends = self.CC.update(c.enabled, self.CS, self.frame, c.actuators,
c.cruiseControl.cancel)
can_sends = self.CC.update(c.enabled, self.CS, self.frame, c.actuators)
self.frame += 1
return can_sends

Loading…
Cancel
Save