From 951631e1ab4250947711f15157393e8ea2af207d Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 6 Feb 2025 20:02:31 -0600 Subject: [PATCH] Remove brand-specific button logic from car_specific.py (#34540) * yay * moremoremore * clean up * more * don't care * update refs * bump to master --- opendbc_repo | 2 +- selfdrive/car/car_specific.py | 18 ++++++------------ selfdrive/test/process_replay/ref_commit | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/opendbc_repo b/opendbc_repo index 5ca9097bcd..bdc2fe3a9a 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 5ca9097bcd8ecddc7b5fca5e72defe189d0c4ce0 +Subproject commit bdc2fe3a9aa692bcf46c6ab052405564f6d8e379 diff --git a/selfdrive/car/car_specific.py b/selfdrive/car/car_specific.py index 15693b2ae1..2d69d3d590 100644 --- a/selfdrive/car/car_specific.py +++ b/selfdrive/car/car_specific.py @@ -99,13 +99,9 @@ class CarSpecificEvents: events.add(EventName.manualRestart) elif self.CP.brand == 'gm': - # The ECM allows enabling on falling edge of set, but only rising edge of resume events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.sport, GearShifter.low, GearShifter.eco, GearShifter.manumatic], - pcm_enable=self.CP.pcmCruise, enable_buttons=(ButtonType.decelCruise,)) - if not self.CP.pcmCruise: - if any(b.type == ButtonType.accelCruise and b.pressed for b in CS.buttonEvents): - events.add(EventName.buttonEnable) + pcm_enable=self.CP.pcmCruise) # Enabling at a standstill with brake is allowed # TODO: verify 17 Volt can enable for the first time at a stop and allow for all GMs @@ -119,8 +115,7 @@ class CarSpecificEvents: elif self.CP.brand == 'volkswagen': events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.eco, GearShifter.sport, GearShifter.manumatic], - pcm_enable=self.CP.pcmCruise, - enable_buttons=(ButtonType.setCruise, ButtonType.resumeCruise)) + pcm_enable=self.CP.pcmCruise) # Low speed steer alert hysteresis logic if (self.CP.minSteerSpeed - 1e-3) > VWCarControllerParams.DEFAULT_MIN_STEER_SPEED and CS.vEgo < (self.CP.minSteerSpeed + 1.): @@ -162,7 +157,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, enable_buttons=(ButtonType.accelCruise, ButtonType.decelCruise)): + allow_enable=True, allow_button_cancel=True): events = Events() if CS.doorOpen: @@ -206,12 +201,11 @@ class CarSpecificEvents: events.add(EventName.invalidLkasSetting) if CS.lowSpeedAlert: events.add(EventName.belowSteerSpeed) + if CS.buttonEnable: + events.add(EventName.buttonEnable) - # Handle button presses + # Handle cancel button presses for b in CS.buttonEvents: - # Enable OP long on falling edge of enable buttons (defaults to accelCruise and decelCruise, overridable per-port) - if not self.CP.pcmCruise and (b.type in enable_buttons and not b.pressed): - events.add(EventName.buttonEnable) # Disable on rising and falling edge of cancel for both stock and OP long # TODO: only check the cancel button with openpilot longitudinal on all brands to match panda safety if b.type == ButtonType.cancel and (allow_button_cancel or not self.CP.pcmCruise): diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index be67e8d0ff..3b5f5f3466 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -75d173b064b84808485ae0ffd90bd0ecf52e765c \ No newline at end of file +95f1384edc0dc00959b0e804de1aaafc35d2f15f \ No newline at end of file