From 01ae025e0a21c65b76275f0cb8fe5389ad8fa788 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 4 Dec 2024 16:15:45 -0800 Subject: [PATCH] Wake screen on experimental mode toggle --- README.md | 2 +- selfdrive/ui/ui.cc | 6 +++++- selfdrive/ui/ui.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5a67d74e876d563..eaf947d57b66986 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ RexPilot is my personal fork of the OpenPilot driver assistance system, designed **Enhancements:** -- Screen stays off in standby mode and will only turn on for critical alerts. +- Screen stays off while driving in standby mode, unless critical alerts happen or experimental mode is toggled. - Integration with Toyota and Lexus instrument clusters: - Left and right lane lines show what the driving model sees - LTA icon and barrier graphics indicate the lateral control status and steering override. diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 9cb67454632720f..f58f285bd105bb2 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -475,6 +475,8 @@ void UIState::updateStatus() { if (scene.started && sm->updated("controlsState")) { auto controls_state = (*sm)["controlsState"].getControlsState(); auto state = controls_state.getState(); + bool experimental_mode = controls_state.getExperimentalMode(); + if (state == cereal::ControlsState::OpenpilotState::PRE_ENABLED || state == cereal::ControlsState::OpenpilotState::OVERRIDING) { status = STATUS_OVERRIDE; } else if (scene.always_on_lateral_active) { @@ -484,8 +486,10 @@ void UIState::updateStatus() { } else { status = scene.enabled ? STATUS_ENGAGED : STATUS_DISENGAGED; } + + scene.wake_up_screen = controls_state.getAlertStatus() != cereal::ControlsState::AlertStatus::NORMAL || previous_experimental_mode != experimental_mode; - scene.wake_up_screen = controls_state.getAlertStatus() != cereal::ControlsState::AlertStatus::NORMAL; + previous_experimental_mode = experimental_mode; } scene.started |= scene.force_onroad; diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 9cccb54f61d090c..5bddb3ab4c88893 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -305,6 +305,7 @@ class UIState : public QObject { UIStatus status; UIScene scene = {}; + bool previous_experimental_mode = false; QString language;