From a6a09276e94da4b526de4f7604b1a6b448842426 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Sun, 18 May 2025 00:52:02 -0700 Subject: [PATCH] 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 --- opendbc_repo | 2 +- selfdrive/car/car_specific.py | 15 +++------------ selfdrive/test/process_replay/ref_commit | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/opendbc_repo b/opendbc_repo index 488e31ccba..0af0d464df 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 488e31ccbab507315648061c23308cedc5284cf2 +Subproject commit 0af0d464df30daa4c78f5349c958ba584370ef80 diff --git a/selfdrive/car/car_specific.py b/selfdrive/car/car_specific.py index 355ab1a7c8..67d1010d75 100644 --- a/selfdrive/car/car_specific.py +++ b/selfdrive/car/car_specific.py @@ -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) diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 8e8a88db2c..f67c4540c6 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -2d23b1ba470927cefa646b95e1c8b7ac0f944f60 \ No newline at end of file +746da1900c43a64146bb485b7fc2a836e2005113 \ No newline at end of file