Hyundai: fix recent enable button press regression (#35265)

* move back to port

* much better

* use the CS field now

* bump

* fix

* need to switch so it works on ports that don't use it, and makes more sense

* bump

* bump

* update refs

* make sense

* master
pull/35270/head
Shane Smiskol 2 months ago committed by GitHub
parent 33721cf5fa
commit a6a09276e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      opendbc_repo
  2. 15
      selfdrive/car/car_specific.py
  3. 2
      selfdrive/test/process_replay/ref_commit

@ -1 +1 @@
Subproject commit 488e31ccbab507315648061c23308cedc5284cf2
Subproject commit 0af0d464df30daa4c78f5349c958ba584370ef80

@ -1,11 +1,8 @@
from collections import deque
from cereal import car, log
import cereal.messaging as messaging
from opendbc.car import DT_CTRL, structs
from opendbc.car.interfaces import MAX_CTRL_SPEED
from opendbc.car.volkswagen.values import CarControllerParams as VWCarControllerParams
from opendbc.car.hyundai.interface import ENABLE_BUTTONS as HYUNDAI_ENABLE_BUTTONS
from opendbc.car.hyundai.carstate import PREV_BUTTON_SAMPLES as HYUNDAI_PREV_BUTTON_SAMPLES
from openpilot.selfdrive.selfdrived.events import Events
@ -39,8 +36,6 @@ class CarSpecificEvents:
self.no_steer_warning = False
self.silent_steer_warning = True
self.cruise_buttons: deque = deque([], maxlen=HYUNDAI_PREV_BUTTON_SAMPLES)
def update(self, CS: car.CarState, CS_prev: car.CarState, CC: car.CarControl):
if self.CP.brand in ('body', 'mock'):
events = Events()
@ -136,12 +131,8 @@ class CarSpecificEvents:
# events.add(EventName.steerTimeLimit)
elif self.CP.brand == 'hyundai':
# 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, check user engagement intention via buttons
# Main button also can trigger an engagement on these cars
self.cruise_buttons.append(any(ev.type in HYUNDAI_ENABLE_BUTTONS for ev in CS.buttonEvents))
events = self.create_common_events(CS, CS_prev, extra_gears=(GearShifter.sport, GearShifter.manumatic),
pcm_enable=self.CP.pcmCruise, allow_enable=any(self.cruise_buttons), allow_button_cancel=False)
pcm_enable=self.CP.pcmCruise, allow_button_cancel=False)
# low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s)
if CS.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.:
@ -157,7 +148,7 @@ class CarSpecificEvents:
return events
def create_common_events(self, CS: structs.CarState, CS_prev: car.CarState, extra_gears=None, pcm_enable=True,
allow_enable=True, allow_button_cancel=True):
allow_button_cancel=True):
events = Events()
if CS.doorOpen:
@ -236,7 +227,7 @@ class CarSpecificEvents:
# we engage when pcm is active (rising edge)
# enabling can optionally be blocked by the car interface
if pcm_enable:
if CS.cruiseState.enabled and not CS_prev.cruiseState.enabled and allow_enable:
if CS.cruiseState.enabled and not CS_prev.cruiseState.enabled and not CS.blockPcmEnable:
events.add(EventName.pcmEnable)
elif not CS.cruiseState.enabled:
events.add(EventName.pcmDisable)

@ -1 +1 @@
2d23b1ba470927cefa646b95e1c8b7ac0f944f60
746da1900c43a64146bb485b7fc2a836e2005113
Loading…
Cancel
Save