From e5b985f122c75ffc92ccba6e88927f4e713d9d79 Mon Sep 17 00:00:00 2001 From: James <91348155+FrogAi@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:00:00 -0700 Subject: [PATCH] Screen Timeout --- selfdrive/ui/qt/window.cc | 2 +- selfdrive/ui/ui.cc | 7 ++++--- selfdrive/ui/ui.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/qt/window.cc b/selfdrive/ui/qt/window.cc index 2afac783..9cf7d219 100644 --- a/selfdrive/ui/qt/window.cc +++ b/selfdrive/ui/qt/window.cc @@ -93,7 +93,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) { case QEvent::MouseMove: { // ignore events when device is awakened by resetInteractiveTimeout ignore = !device()->isAwake(); - device()->resetInteractiveTimeout(); + device()->resetInteractiveTimeout(frogpilot_toggles.value("screen_timeout").toInt(), frogpilot_toggles.value("screen_timeout_onroad").toInt()); break; } default: diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 18707d88..599bb514 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -160,7 +160,7 @@ void UIState::update() { QJsonObject &frogpilot_toggles = frogpilot_scene.frogpilot_toggles; if (frogpilot_scene.downloading_update || frogpilot_scene.frogpilot_panel_active) { - device()->resetInteractiveTimeout(); + device()->resetInteractiveTimeout(frogpilot_toggles.value("screen_timeout").toInt(), frogpilot_toggles.value("screen_timeout_onroad").toInt()); } fs->update(); @@ -187,11 +187,12 @@ void Device::setAwake(bool on) { } } -void Device::resetInteractiveTimeout(int timeout) { +void Device::resetInteractiveTimeout(int timeout, int timeout_onroad) { if (timeout == -1) { timeout = (ignition_on ? 10 : 30); } else { // FrogPilot variables + timeout = (ignition_on ? timeout_onroad : timeout); } interactive_timeout = timeout * UI_FREQ; } @@ -242,7 +243,7 @@ void Device::updateWakefulness(const UIState &s, const FrogPilotUIState &fs) { ignition_on = s.scene.ignition; if (ignition_just_turned_off) { - resetInteractiveTimeout(); + resetInteractiveTimeout(frogpilot_toggles.value("screen_timeout").toInt(), frogpilot_toggles.value("screen_timeout_onroad").toInt()); } else if (ignition_on && frogpilot_toggles.value("screen_brightness_onroad").toInt() == 0) { resetInteractiveTimeout(0, 0); } else if (interactive_timeout > 0 && --interactive_timeout == 0) { diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index eadd87d7..a4880809 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -136,7 +136,7 @@ signals: void interactiveTimeout(); public slots: - void resetInteractiveTimeout(int timeout = -1); + void resetInteractiveTimeout(int timeout = -1, int timeout_onroad = -1); void update(const UIState &s, const FrogPilotUIState &fs); };