Subaru: Use modern button events

This commit is contained in:
Jason Wen
2024-07-11 23:23:43 -04:00
parent 25fdd735c2
commit 56119eb66e
+4 -6
View File
@@ -118,8 +118,6 @@ class CarInterface(CarInterfaceBase):
ret = self.CS.update(self.cp, self.cp_cam, self.cp_body)
self.sp_update_params()
buttonEvents = []
self.CS.mads_enabled = self.get_sp_cruise_main_state(ret, self.CS)
if ret.cruiseState.available:
@@ -150,19 +148,19 @@ class CarInterface(CarInterfaceBase):
be = car.CarState.ButtonEvent.new_message()
be.pressed = True
be.type = ButtonType.cancel
buttonEvents.append(be)
self.CS.button_events.append(be)
# MADS BUTTON
if self.CS.out.madsEnabled != self.CS.madsEnabled:
if self.mads_event_lock:
buttonEvents.append(create_mads_event(self.mads_event_lock))
self.CS.button_events.append(create_mads_event(self.mads_event_lock))
self.mads_event_lock = False
else:
if not self.mads_event_lock:
buttonEvents.append(create_mads_event(self.mads_event_lock))
self.CS.button_events.append(create_mads_event(self.mads_event_lock))
self.mads_event_lock = True
ret.buttonEvents = buttonEvents
ret.buttonEvents = self.CS.button_events
events = self.create_common_events(ret, c, extra_gears=[GearShifter.sport, GearShifter.low], pcm_enable=False)