|
|
|
@ -149,7 +149,7 @@ class CarSpecificEvents: |
|
|
|
|
# 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)) |
|
|
|
|
pcm_enable=self.CP.pcmCruise, allow_enable=any(self.cruise_buttons), 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.: |
|
|
|
@ -165,7 +165,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, enable_buttons=(ButtonType.accelCruise, ButtonType.decelCruise)): |
|
|
|
|
allow_enable=True, allow_button_cancel=True, enable_buttons=(ButtonType.accelCruise, ButtonType.decelCruise)): |
|
|
|
|
events = Events() |
|
|
|
|
|
|
|
|
|
if CS.doorOpen: |
|
|
|
@ -216,7 +216,8 @@ class CarSpecificEvents: |
|
|
|
|
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 |
|
|
|
|
if b.type == ButtonType.cancel: |
|
|
|
|
# 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): |
|
|
|
|
events.add(EventName.buttonCancel) |
|
|
|
|
|
|
|
|
|
# Handle permanent and temporary steering faults |
|
|
|
|