diff --git a/selfdrive/ui/qt/offroad/developer_panel.cc b/selfdrive/ui/qt/offroad/developer_panel.cc
index 7cc9dab5a6..37f948835d 100644
--- a/selfdrive/ui/qt/offroad/developer_panel.cc
+++ b/selfdrive/ui/qt/offroad/developer_panel.cc
@@ -43,4 +43,7 @@ DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) {
auto madsDisengageLateralOnBrakeToggle = new ParamControl("MadsDisengageLateralOnBrake", tr("MADS: Disengage Lateral on Brake"), "", "");
addItem(madsDisengageLateralOnBrakeToggle);
+
+ auto madsUnifiedEngagementModeToggle = new ParamControl("MadsUnifiedEngagementMode", tr("MADS: Unified Engagement Mode"), "", "");
+ addItem(madsUnifiedEngagementModeToggle);
}
diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts
index 4d647e2693..21f0829146 100644
--- a/selfdrive/ui/translations/main_ar.ts
+++ b/selfdrive/ui/translations/main_ar.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts
index 9d1f75c016..c7a635ea34 100644
--- a/selfdrive/ui/translations/main_de.ts
+++ b/selfdrive/ui/translations/main_de.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts
index e6abfd1014..c64330dcab 100644
--- a/selfdrive/ui/translations/main_es.ts
+++ b/selfdrive/ui/translations/main_es.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts
index 6c4a7e658f..fe58184326 100644
--- a/selfdrive/ui/translations/main_fr.ts
+++ b/selfdrive/ui/translations/main_fr.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts
index f69265d115..a47c9ed324 100644
--- a/selfdrive/ui/translations/main_ja.ts
+++ b/selfdrive/ui/translations/main_ja.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts
index ffa873ba46..7bb63a7d07 100644
--- a/selfdrive/ui/translations/main_ko.ts
+++ b/selfdrive/ui/translations/main_ko.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts
index 846b85126b..dea0b190f1 100644
--- a/selfdrive/ui/translations/main_pt-BR.ts
+++ b/selfdrive/ui/translations/main_pt-BR.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts
index 022de6712d..0427885ae8 100644
--- a/selfdrive/ui/translations/main_th.ts
+++ b/selfdrive/ui/translations/main_th.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts
index ef6353aeb3..d98eaa9c5a 100644
--- a/selfdrive/ui/translations/main_tr.ts
+++ b/selfdrive/ui/translations/main_tr.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts
index 0aceeb561a..0ddcfcad77 100644
--- a/selfdrive/ui/translations/main_zh-CHS.ts
+++ b/selfdrive/ui/translations/main_zh-CHS.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts
index 0db01d0ba5..7e21302626 100644
--- a/selfdrive/ui/translations/main_zh-CHT.ts
+++ b/selfdrive/ui/translations/main_zh-CHT.ts
@@ -135,6 +135,10 @@
Modular Assistive Driving System (MADS)
+
+ MADS: Unified Engagement Mode
+
+
DevicePanel
diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py
index 29dd68a8d2..6fd1c9086f 100644
--- a/sunnypilot/mads/mads.py
+++ b/sunnypilot/mads/mads.py
@@ -36,7 +36,6 @@ class ModifiedAssistDrivingSystem:
return available
def update_events(self, CS: car.CarState):
- # TODO-SP: Handle pcmEnable and buttonEnable conditionally below
self.selfdrive.events.remove(EventName.pcmDisable)
self.selfdrive.events.remove(EventName.buttonCancel)
@@ -61,6 +60,12 @@ class ModifiedAssistDrivingSystem:
if self.state_machine.state == State.paused and self.active:
self.selfdrive.events.add(EventName.silentLkasEnable)
+ if (self.unified_engagement_mode and self.active) or not self.unified_engagement_mode:
+ if self.selfdrive.events.has(EventName.pcmEnable):
+ self.selfdrive.events.remove(EventName.pcmEnable)
+ if self.selfdrive.events.has(EventName.buttonEnable):
+ self.selfdrive.events.remove(EventName.buttonEnable)
+
for be in CS.buttonEvents:
if be.type == ButtonType.cancel:
if self.selfdrive.enabled_prev: