Skip to content

Commit b9484a6

Browse files
cars: remove duplicated cancel logic (commaai#23956)
1 parent a958213 commit b9484a6

File tree

4 files changed

+2
-11
lines changed

4 files changed

+2
-11
lines changed

selfdrive/car/mazda/carcontroller.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def update(self, c, CS, frame):
3232
# TODO: improve the resume trigger logic by looking at actual radar data
3333
can_sends.append(mazdacan.create_button_cmd(self.packer, CS.CP.carFingerprint, CS.crz_btns_counter, Buttons.RESUME))
3434

35-
if c.cruiseControl.cancel or (CS.out.cruiseState.enabled and not c.enabled):
35+
if c.cruiseControl.cancel:
3636
# If brake is pressed, let us wait >70ms before trying to disable crz to avoid
3737
# a race condition with the stock system, where the second cancel from openpilot
3838
# will disable the crz 'main on'. crz ctrl msg runs at 50hz. 70ms allows us to

selfdrive/car/nissan/carcontroller.py

-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def update(self, c, enabled, CS, frame, actuators, cruise_cancel, hud_alert,
2424
can_sends = []
2525

2626
### STEER ###
27-
acc_active = CS.out.cruiseState.enabled
2827
lkas_hud_msg = CS.lkas_hud_msg
2928
lkas_hud_info_msg = CS.lkas_hud_info_msg
3029
apply_angle = actuators.steeringAngleDeg
@@ -58,10 +57,6 @@ def update(self, c, enabled, CS, frame, actuators, cruise_cancel, hud_alert,
5857

5958
self.last_angle = apply_angle
6059

61-
if not enabled and acc_active:
62-
# send acc cancel cmd if drive is disabled but pcm is still on, or if the system can't be activated
63-
cruise_cancel = 1
64-
6560
if self.CP.carFingerprint in (CAR.ROGUE, CAR.XTRAIL, CAR.ALTIMA) and cruise_cancel:
6661
can_sends.append(nissancan.create_acc_cancel_cmd(self.packer, self.car_fingerprint, CS.cruise_throttle_msg, frame))
6762

selfdrive/car/tesla/carcontroller.py

-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ def update(self, c, enabled, CS, frame, actuators, cruise_cancel):
5050
if hands_on_fault:
5151
cruise_cancel = True
5252

53-
# Cancel when openpilot is not enabled anymore
54-
if not enabled and bool(CS.out.cruiseState.enabled):
55-
cruise_cancel = True
56-
5753
if ((frame % 10) == 0 and cruise_cancel):
5854
# Spam every possible counter value, otherwise it might not be accepted
5955
for counter in range(16):

selfdrive/car/volkswagen/carcontroller.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def update(self, c, enabled, CS, frame, ext_bus, actuators, visual_alert, left_l
8888

8989
if CS.CP.pcmCruise:
9090
if frame > self.graMsgStartFramePrev + P.GRA_VBP_STEP:
91-
if not enabled and CS.out.cruiseState.enabled:
91+
if c.cruiseControl.cancel:
9292
# Cancel ACC if it's engaged with OP disengaged.
9393
self.graButtonStatesToSend = BUTTON_STATES.copy()
9494
self.graButtonStatesToSend["cancel"] = True

0 commit comments

Comments
 (0)