From 80ebb433650c29fad15becc68145fe700ad7cea9 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 14 Nov 2024 16:59:56 -0500 Subject: [PATCH] simply checks --- cereal/custom.capnp | 1 - selfdrive/controls/controlsd.py | 2 +- selfdrive/selfdrived/selfdrived.py | 3 +-- sunnypilot/mads/mads.py | 10 ---------- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/cereal/custom.capnp b/cereal/custom.capnp index a38738679b..ddb09e34ff 100644 --- a/cereal/custom.capnp +++ b/cereal/custom.capnp @@ -16,7 +16,6 @@ struct SelfdriveStateSP @0x81c2f05a394cf4af { enabled @1 :Bool; active @2 :Bool; available @3 :Bool; - on @4 :Bool; enum ModifiedAssistDrivingSystemState { disabled @0; diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 98251080f7..df017303ce 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -95,7 +95,7 @@ class Controls: ss_sp = self.sm['selfdriveStateSP'] CC.madsActive = ss_sp.mads.available and ss_sp.mads.active - _lat_active = ss_sp.mads.available and ss_sp.mads.enabled if ss_sp.mads.on else self.sm['selfdriveState'].active + _lat_active = ss_sp.mads.enabled if ss_sp.mads.available else self.sm['selfdriveState'].active CC.latActive = _lat_active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and not standstill CC.longActive = CC.enabled and not any(e.overrideLongitudinal for e in self.sm['onroadEvents']) and self.CP.openpilotLongitudinalControl diff --git a/selfdrive/selfdrived/selfdrived.py b/selfdrive/selfdrived/selfdrived.py index ecbac4acd1..43ede9235d 100755 --- a/selfdrive/selfdrived/selfdrived.py +++ b/selfdrive/selfdrived/selfdrived.py @@ -465,8 +465,7 @@ class SelfdriveD: mads.state = self.mads.state_machine.state mads.enabled = self.mads.enabled mads.active = self.mads.active - mads.available = self.mads.available - mads.on = self.mads.enabled_toggle + mads.available = self.mads.enabled_toggle self.pm.send('selfdriveStateSP', ss_sp_msg) diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py index e1ae7b7bf4..eed0cfc058 100644 --- a/sunnypilot/mads/mads.py +++ b/sunnypilot/mads/mads.py @@ -26,14 +26,6 @@ class ModifiedAssistDrivingSystem: self.disengage_lateral_on_brake_toggle = mads_params.read_param("MadsDisengageLateralOnBrake", self.selfdrive.params) self.unified_engagement_mode = mads_params.read_param("MadsUnifiedEngagementMode", self.selfdrive.params) - def update_availability(self, CS: car.CarState) -> None: - if self.main_enabled_toggle: - self.available = CS.cruiseState.available - - if self.selfdrive.CP.carName == "hyundai": - if any(be.type == ButtonType.lkas and be.pressed for be in CS.buttonEvents): - self.available = True - def update_events(self, CS: car.CarState): self.selfdrive.events.remove(EventName.pcmDisable) self.selfdrive.events.remove(EventName.buttonCancel) @@ -93,8 +85,6 @@ class ModifiedAssistDrivingSystem: if not self.enabled_toggle: return - self.update_availability(CS) - self.update_events(CS) if not self.selfdrive.CP.passive and self.selfdrive.initialized: