From 9c28583171ba3336f3c93d6e9d567263dda79ac5 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 3 Jun 2025 00:28:55 -0400 Subject: [PATCH] ui: include MADS enabled state to `engaged` check (#976) * ui: include MADS enabled state to `engaged` check * let's bump it up --- selfdrive/ui/sunnypilot/ui.h | 5 +++++ selfdrive/ui/ui.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/sunnypilot/ui.h b/selfdrive/ui/sunnypilot/ui.h index 08e1d37b0f..a94dfca3b3 100644 --- a/selfdrive/ui/sunnypilot/ui.h +++ b/selfdrive/ui/sunnypilot/ui.h @@ -20,6 +20,11 @@ class UIStateSP : public UIState { public: UIStateSP(QObject *parent = 0); void updateStatus() override; + inline bool engaged() const override { + return scene.started && ( + (*sm)["selfdriveState"].getSelfdriveState().getEnabled() || (*sm)["selfdriveStateSP"].getSelfdriveStateSP().getMads().getEnabled() + ); + } void setSunnylinkRoles(const std::vector &roles); void setSunnylinkDeviceUsers(const std::vector &users); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 6ef4f8e6d9..4ead8aecb9 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -72,7 +72,7 @@ class UIState : public QObject { public: UIState(QObject* parent = 0); virtual void updateStatus(); - inline bool engaged() const { + virtual inline bool engaged() const { return scene.started && (*sm)["selfdriveState"].getSelfdriveState().getEnabled(); }