Skip to content

Commit

Permalink
consider pause/resume button
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Apr 8, 2022
1 parent 72cd320 commit 3a00d84
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions selfdrive/car/hyundai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

ButtonType = car.CarState.ButtonEvent.Type
EventName = car.CarEvent.EventName
ENABLE_BUTTONS = (Buttons.RES_ACCEL, Buttons.SET_DECEL)
ENABLE_BUTTONS = (Buttons.RES_ACCEL, Buttons.SET_DECEL, Buttons.CANCEL)


class CarInterface(CarInterfaceBase):
Expand Down Expand Up @@ -299,11 +299,9 @@ def update(self, c, can_strings):
ret.canValid = self.cp.can_valid and self.cp_cam.can_valid
ret.steeringRateLimited = self.CC.steer_rate_limited if self.CC is not None else False

# On some newer model years, the CANCEL button acts as a pause/resume button based on the enabled state
# To avoid accidentally re-engaging when we cancel, only allow engagement on specific user button presses
# On some newer model years, the CANCEL button acts as a pause/resume button based on the PCM state
# To avoid re-engaging when openpilot cancels, only enable on specific user button presses
user_enabled = any([btn in ENABLE_BUTTONS for btn in self.CS.cruise_buttons])
# TODO: make sure this logic is correct
# user_enabled |= Buttons.CANCEL in self.CS.cruise_buttons and not self.CS.out.cruiseState.enabled

events = self.create_common_events(ret, pcm_enable=self.CS.CP.pcmCruise, user_enabled=user_enabled)

Expand Down

0 comments on commit 3a00d84

Please sign in to comment.