From 8a5dfc571ea25e29c4117aaf7d497e2e19ff5c81 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 7 Sep 2020 04:13:10 -0700 Subject: [PATCH] Always keep display on with ignition (#2138) * keep display on with ignition * fix typo Co-authored-by: Willem Melching old-commit-hash: e386133c4b8bc2c27de2291257d6441d930b00a7 --- selfdrive/ui/android_ui.cc | 2 +- selfdrive/ui/ui.cc | 4 +++- selfdrive/ui/ui.hpp | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/android_ui.cc b/selfdrive/ui/android_ui.cc index 261dee6f03..dd9fff93c9 100644 --- a/selfdrive/ui/android_ui.cc +++ b/selfdrive/ui/android_ui.cc @@ -222,7 +222,7 @@ int main(int argc, char* argv[]) { } // manage wakefulness - if (s->started) { + if (s->started || s->ignition) { set_awake(s, true); } diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 6da9bf3bbb..59dec1b742 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -199,7 +199,9 @@ void update_sockets(UIState *s) { } } if (sm.updated("health")) { - scene.hwType = sm["health"].getHealth().getHwType(); + auto health = sm["health"].getHealth(); + scene.hwType = health.getHwType(); + s->ignition = health.getIgnitionLine() || health.getIgnitionCan(); } else if ((s->sm->frame - s->sm->rcv_frame("health")) > 5*UI_FREQ) { scene.hwType = cereal::HealthData::HwType::UNKNOWN; } diff --git a/selfdrive/ui/ui.hpp b/selfdrive/ui/ui.hpp index 68edcfa92d..6c1c1b4ab9 100644 --- a/selfdrive/ui/ui.hpp +++ b/selfdrive/ui/ui.hpp @@ -200,6 +200,7 @@ typedef struct UIState { std::atomic light_sensor; bool started; + bool ignition; bool is_metric; bool longitudinal_control; uint64_t last_athena_ping;