diff --git a/cereal/log.capnp b/cereal/log.capnp index 2687d83e1d..62af5a2bfc 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -135,6 +135,7 @@ struct OnroadEvent @0xc4fa6047f024e718 { silentLkasEnable @98; silentBrakeHold @99; silentWrongGear @100; + silentReverseGear @101; soundsUnavailableDEPRECATED @47; } diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index fbeae3eacf..c47ee838df 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -1015,7 +1015,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { }, EventName.silentWrongGear: { - ET.SOFT_DISABLE: Alert( + ET.USER_DISABLE: Alert( "Gear not D", "openpilot Unavailable", AlertStatus.normal, AlertSize.mid, @@ -1027,6 +1027,20 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 3.), }, + EventName.silentReverseGear: { + ET.PERMANENT: Alert( + "Reverse\nGear", + "", + AlertStatus.normal, AlertSize.full, + Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .2, creation_delay=0.5), + ET.USER_DISABLE: Alert( + "Reverse\nGear", + "", + AlertStatus.normal, AlertSize.full, + Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .2, creation_delay=0.5), + ET.NO_ENTRY: NoEntryAlert("Reverse Gear"), + }, + } diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py index 40a54d674d..e8f508263d 100644 --- a/sunnypilot/mads/mads.py +++ b/sunnypilot/mads/mads.py @@ -31,14 +31,15 @@ class ModifiedAssistDrivingSystem: self.unified_engagement_mode = mads_params.read_param("MadsUnifiedEngagementMode", self.selfdrive.params) def update_events(self, CS: car.CarState): - if self.selfdrive.enabled_prev: - if self.selfdrive.events.has(EventName.wrongGear) and CS.vEgo < 5: - self.selfdrive.events.add(EventName.silentWrongGear) - self.selfdrive.events.remove(EventName.wrongGear) - - else: + if not self.selfdrive.enabled: self.selfdrive.events.remove(EventName.wrongCruiseMode) self.selfdrive.events.remove(EventName.wrongCarMode) + if self.selfdrive.events.has(EventName.wrongGear) and not self.selfdrive.events.has(EventName.reverseGear): + self.selfdrive.events.remove(EventName.wrongGear) + self.selfdrive.events.add(EventName.silentWrongGear) + if self.selfdrive.events.has(EventName.reverseGear) and CS.vEgo < 5: + self.selfdrive.events.remove(EventName.reverseGear) + self.selfdrive.events.add(EventName.silentReverseGear) if self.disengage_lateral_on_brake_toggle: if self.selfdrive.events.has(EventName.brakeHold): diff --git a/sunnypilot/mads/state.py b/sunnypilot/mads/state.py index 625f116bb4..490e4a480e 100644 --- a/sunnypilot/mads/state.py +++ b/sunnypilot/mads/state.py @@ -31,7 +31,8 @@ class StateMachine: if self.state != State.disabled: # user and immediate disable always have priority in a non-disabled state if events.contains(ET.USER_DISABLE): - if events.has(EventName.silentPedalPressed) or events.has(EventName.silentBrakeHold): + if events.has(EventName.silentPedalPressed) or events.has(EventName.silentBrakeHold) or \ + events.has(EventName.silentWrongGear) or events.has(EventName.silentReverseGear): self.state = State.paused else: self.state = State.disabled