From 01a843e0acbe74d566a7eee9fe0f12f227ae81ed Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 9 Jun 2026 02:15:42 -0400 Subject: [PATCH] ui: reset Enforce Torque Control and NNLC if both are enabled (#1863) * ui: reset Enforce Torque Control and NNLC if both are enabled * block --- selfdrive/ui/sunnypilot/layouts/settings/steering.py | 5 +++++ selfdrive/ui/sunnypilot/ui_state.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/selfdrive/ui/sunnypilot/layouts/settings/steering.py b/selfdrive/ui/sunnypilot/layouts/settings/steering.py index e31ee1891..a5cd62648 100644 --- a/selfdrive/ui/sunnypilot/layouts/settings/steering.py +++ b/selfdrive/ui/sunnypilot/layouts/settings/steering.py @@ -134,6 +134,11 @@ class SteeringLayout(Widget): enforce_torque_enabled = self._torque_control_toggle.action_item.get_state() nnlc_enabled = self._nnlc_toggle.action_item.get_state() + if enforce_torque_enabled and nnlc_enabled: + self._torque_control_toggle.action_item.set_state(False) + self._nnlc_toggle.action_item.set_state(False) + enforce_torque_enabled = False + nnlc_enabled = False self._nnlc_toggle.action_item.set_enabled(ui_state.is_offroad() and torque_allowed and not enforce_torque_enabled) self._torque_control_toggle.action_item.set_enabled(ui_state.is_offroad() and torque_allowed and not nnlc_enabled) self._torque_customization_button.action_item.set_enabled(self._torque_control_toggle.action_item.get_state()) diff --git a/selfdrive/ui/sunnypilot/ui_state.py b/selfdrive/ui/sunnypilot/ui_state.py index 8cd37583f..1c21c35c6 100644 --- a/selfdrive/ui/sunnypilot/ui_state.py +++ b/selfdrive/ui/sunnypilot/ui_state.py @@ -179,6 +179,10 @@ class UIStateSP: CP = self.CP if CP is not None: + if self.params.get_bool("EnforceTorqueControl") and self.params.get_bool("NeuralNetworkLateralControl"): + self.params.put_bool("EnforceTorqueControl", False, block=True) + self.params.put_bool("NeuralNetworkLateralControl", False, block=True) + # Angle steering: no torque-based lateral controls if CP.steerControlType == car.CarParams.SteerControlType.angle: self.params.remove("EnforceTorqueControl")