|
|
|
@ -42,19 +42,19 @@ class CarSpecificEvents: |
|
|
|
|
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.carName in ('body', 'mock'): |
|
|
|
|
if self.CP.brand in ('body', 'mock'): |
|
|
|
|
events = Events() |
|
|
|
|
|
|
|
|
|
elif self.CP.carName in ('subaru', 'mazda'): |
|
|
|
|
elif self.CP.brand in ('subaru', 'mazda'): |
|
|
|
|
events = self.create_common_events(CS, CS_prev) |
|
|
|
|
|
|
|
|
|
elif self.CP.carName == 'ford': |
|
|
|
|
elif self.CP.brand == 'ford': |
|
|
|
|
events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.manumatic]) |
|
|
|
|
|
|
|
|
|
elif self.CP.carName == 'nissan': |
|
|
|
|
elif self.CP.brand == 'nissan': |
|
|
|
|
events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.brake]) |
|
|
|
|
|
|
|
|
|
elif self.CP.carName == 'chrysler': |
|
|
|
|
elif self.CP.brand == 'chrysler': |
|
|
|
|
events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.low]) |
|
|
|
|
|
|
|
|
|
# Low speed steer alert hysteresis logic |
|
|
|
@ -65,7 +65,7 @@ class CarSpecificEvents: |
|
|
|
|
if self.low_speed_alert: |
|
|
|
|
events.add(EventName.belowSteerSpeed) |
|
|
|
|
|
|
|
|
|
elif self.CP.carName == 'honda': |
|
|
|
|
elif self.CP.brand == 'honda': |
|
|
|
|
events = self.create_common_events(CS, CS_prev, pcm_enable=False) |
|
|
|
|
|
|
|
|
|
if self.CP.pcmCruise and CS.vEgo < self.CP.minEnableSpeed: |
|
|
|
@ -86,7 +86,7 @@ class CarSpecificEvents: |
|
|
|
|
if self.CP.minEnableSpeed > 0 and CS.vEgo < 0.001: |
|
|
|
|
events.add(EventName.manualRestart) |
|
|
|
|
|
|
|
|
|
elif self.CP.carName == 'toyota': |
|
|
|
|
elif self.CP.brand == 'toyota': |
|
|
|
|
events = self.create_common_events(CS, CS_prev) |
|
|
|
|
|
|
|
|
|
if self.CP.openpilotLongitudinalControl: |
|
|
|
@ -101,7 +101,7 @@ class CarSpecificEvents: |
|
|
|
|
# while in standstill, send a user alert |
|
|
|
|
events.add(EventName.manualRestart) |
|
|
|
|
|
|
|
|
|
elif self.CP.carName == 'gm': |
|
|
|
|
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], |
|
|
|
@ -120,7 +120,7 @@ class CarSpecificEvents: |
|
|
|
|
if CS.vEgo < self.CP.minSteerSpeed: |
|
|
|
|
events.add(EventName.belowSteerSpeed) |
|
|
|
|
|
|
|
|
|
elif self.CP.carName == 'volkswagen': |
|
|
|
|
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)) |
|
|
|
@ -143,7 +143,7 @@ class CarSpecificEvents: |
|
|
|
|
# if CC.eps_timer_soft_disable_alert: # type: ignore[attr-defined] |
|
|
|
|
# events.add(EventName.steerTimeLimit) |
|
|
|
|
|
|
|
|
|
elif self.CP.carName == 'hyundai': |
|
|
|
|
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 |
|
|
|
@ -160,7 +160,7 @@ class CarSpecificEvents: |
|
|
|
|
events.add(EventName.belowSteerSpeed) |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
raise ValueError(f"Unsupported car: {self.CP.carName}") |
|
|
|
|
raise ValueError(f"Unsupported car: {self.CP.brand}") |
|
|
|
|
|
|
|
|
|
return events |
|
|
|
|
|
|
|
|
|