From b14e9e58a14e676b299cc6ce97499041eead49d0 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 18 May 2025 10:13:56 -0400 Subject: [PATCH] make sure we don't allow if brake was already being pressed --- sunnypilot/mads/mads.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py index e505fa9a97..7ec38bd877 100644 --- a/sunnypilot/mads/mads.py +++ b/sunnypilot/mads/mads.py @@ -166,7 +166,13 @@ class ModularAssistiveDrivingSystem: if self.steering_mode_on_brake == MadsSteeringModeOnBrake.DISENGAGE: if self.pedal_pressed_non_gas_pressed(CS): - self.events_sp.add(EventNameSP.lkasDisable) + if self.enabled: + self.events_sp.add(EventNameSP.lkasDisable) + else: + # block lkasEnable if being sent, then send pedalPressedAlertOnly event + if self.events_sp.contains(EventNameSP.lkasEnable): + self.events_sp.remove(EventNameSP.lkasEnable) + self.events_sp.add(EventNameSP.pedalPressedAlertOnly) if self.should_silent_lkas_enable(CS): if self.state_machine.state == State.paused: