diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc index 57b38c8f91..65a696d814 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc @@ -27,13 +27,12 @@ SunnypilotPanel::SunnypilotPanel(SettingsWindowSP *parent) : QFrame(parent) { madsToggle->setConfirmation(true, false); list->addItem(madsToggle); - SubPanelButton *madsSettingsButton = new SubPanelButton(tr("Customize MADS")); + madsSettingsButton = new SubPanelButton(tr("Customize MADS")); madsSettingsButton->setObjectName("mads_btn"); connect(madsSettingsButton, &QPushButton::clicked, [=]() { sunnypilotScroller->setLastScrollPosition(); main_layout->setCurrentWidget(madsWidget); }); - madsSettingsButton->setEnabled(madsToggle->isToggled()); QObject::connect(madsToggle, &ToggleControl::toggleFlipped, madsSettingsButton, &SubPanelButton::setEnabled); madsWidget = new MadsSettings(this); @@ -86,5 +85,7 @@ void SunnypilotPanel::updateToggles(bool _offroad) { toggle->setEnabled(_offroad); } + madsSettingsButton->setEnabled(madsToggle->isToggled()); + offroad = _offroad; } diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h index 231eddf1ee..8077522473 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h @@ -35,5 +35,6 @@ private: bool offroad; ParamControl *madsToggle; + SubPanelButton *madsSettingsButton; MadsSettings *madsWidget = nullptr; };