From 2ebb2b33cd382ea4ed29cd00e4e961a4574b3dd3 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 14 Dec 2024 11:59:12 -0500 Subject: [PATCH] fix not allowed engaged bug --- sunnypilot/mads/mads.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py index 66b3b4b5a2..b7422af90b 100644 --- a/sunnypilot/mads/mads.py +++ b/sunnypilot/mads/mads.py @@ -93,12 +93,6 @@ class ModularAssistiveDrivingSystem: if self.events.has(EventName.parkBrake): self.events.replace(EventName.parkBrake, EventName.silentParkBrake) transition_paused_state() - if self.events.has(EventName.wrongCarMode): - self.events.replace(EventName.wrongCarMode, EventName.wrongCarModeNoEntry) - transition_paused_state() - if self.events.has(EventName.wrongCruiseMode): - self.events.replace(EventName.wrongCruiseMode, EventName.wrongCruiseModeNoEntry) - transition_paused_state() if self.disengage_lateral_on_brake_toggle: if CS.brakePressed: @@ -130,6 +124,8 @@ class ModularAssistiveDrivingSystem: self.events.add(EventName.lkasDisable) else: self.events.add(EventName.lkasEnable) + if be.type not in (ButtonType.accelCruise, ButtonType.resumeCruise, ButtonType.decelCruise, ButtonType.setCruise): + self.events.remove(EventName.wrongCruiseMode) if not CS.cruiseState.available: self.events.remove(EventName.buttonEnable) @@ -139,6 +135,7 @@ class ModularAssistiveDrivingSystem: self.events.remove(EventName.pcmDisable) self.events.remove(EventName.buttonCancel) self.events.remove(EventName.pedalPressed) + self.events.remove(EventName.wrongCarMode) if self.mismatch_counter >= 200: self.events.add(EventName.controlsMismatchLateral)