diff --git a/cereal/log.capnp b/cereal/log.capnp index bc025986bb..61db521c90 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -195,6 +195,8 @@ struct OnroadEvent @0xc4fa6047f024e718 { silentBrakeHold @158; silentWrongGear @159; silentReverseGear @160; + silentDoorOpen @161; + silentSeatbeltNotLatched @162; soundsUnavailableDEPRECATED @47; } diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index d1ed584a8e..9ec9254c4e 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -1036,6 +1036,16 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { ET.NO_ENTRY: NoEntryAlert("Reverse Gear"), }, + EventName.silentDoorOpen: { + ET.SOFT_DISABLE: user_soft_disable_alert("Door Open"), + ET.NO_ENTRY: NoEntryAlert("Door Open"), + }, + + EventName.silentSeatbeltNotLatched: { + ET.SOFT_DISABLE: user_soft_disable_alert("Seatbelt Unlatched"), + ET.NO_ENTRY: NoEntryAlert("Seatbelt Unlatched"), + }, + } diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py index 2ce2f50341..1f2e7043b5 100644 --- a/sunnypilot/mads/mads.py +++ b/sunnypilot/mads/mads.py @@ -54,6 +54,12 @@ class ModularAssistiveDrivingSystem: if self.events.has(EventName.brakeHold): self.events.replace(EventName.brakeHold, EventName.silentBrakeHold) transition_paused_state() + if self.events.has(EventName.doorOpen): + self.events.replace(EventName.doorOpen, EventName.silentDoorOpen) + transition_paused_state() + if self.events.has(EventName.seatbeltNotLatched): + self.events.replace(EventName.seatbeltNotLatched, EventName.silentSeatbeltNotLatched) + transition_paused_state() if self.disengage_lateral_on_brake_toggle: if self.events.has(EventName.pedalPressed): diff --git a/sunnypilot/mads/state.py b/sunnypilot/mads/state.py index e561fa9beb..2337277396 100644 --- a/sunnypilot/mads/state.py +++ b/sunnypilot/mads/state.py @@ -9,8 +9,10 @@ EventName = log.OnroadEvent.EventName ACTIVE_STATES = (State.enabled, State.softDisabling, State.overriding) ENABLED_STATES = (State.paused, *ACTIVE_STATES) -GEARS_ALLOW_PAUSED_SILENT = [EventName.silentWrongGear, EventName.silentReverseGear, EventName.silentBrakeHold] -GEARS_ALLOW_PAUSED = [EventName.wrongGear, EventName.reverseGear, EventName.brakeHold, *GEARS_ALLOW_PAUSED_SILENT] +GEARS_ALLOW_PAUSED_SILENT = [EventName.silentWrongGear, EventName.silentReverseGear, EventName.silentBrakeHold, + EventName.silentDoorOpen, EventName.silentSeatbeltNotLatched] +GEARS_ALLOW_PAUSED = [EventName.wrongGear, EventName.reverseGear, EventName.brakeHold, + EventName.doorOpen, EventName.seatbeltNotLatched, *GEARS_ALLOW_PAUSED_SILENT] class StateMachine: