From 9bf6fdaf411e9a54229c87f5914231fa70291a3a Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 18 Dec 2024 10:21:23 -0500 Subject: [PATCH] fix mads button not allowed --- sunnypilot/mads/mads.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py index 58f4f9b70c..454af30633 100644 --- a/sunnypilot/mads/mads.py +++ b/sunnypilot/mads/mads.py @@ -37,6 +37,7 @@ ButtonType = car.CarState.ButtonEvent.Type EventName = log.OnroadEvent.EventName SafetyModel = car.CarParams.SafetyModel +SET_SPEED_BUTTONS = (ButtonType.accelCruise, ButtonType.resumeCruise, ButtonType.decelCruise, ButtonType.setCruise) IGNORED_SAFETY_MODES = (SafetyModel.silent, SafetyModel.noOutput) @@ -138,8 +139,6 @@ 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.wrongCarMode) if not CS.cruiseState.available: self.events.remove(EventName.buttonEnable) @@ -150,6 +149,8 @@ class ModularAssistiveDrivingSystem: self.events.remove(EventName.buttonCancel) self.events.remove(EventName.pedalPressed) self.events.remove(EventName.wrongCruiseMode) + if not any(be.type in SET_SPEED_BUTTONS for be in CS.buttonEvents): + self.events.remove(EventName.wrongCarMode) self.update_controls_mismatch(sm)