diff --git a/selfdrive/ui/qt/window.cc b/selfdrive/ui/qt/window.cc index 985021a5f..b6d90d47d 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(uiState()->scene.screen_timeout; break; } default: diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index cbd5a167d..db2da0fd9 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -432,6 +432,7 @@ void ui_update_frogpilot_params(UIState *s) { scene.screen_brightness = screen_management ? params.getInt("ScreenBrightness") : 101; scene.screen_brightness_onroad = screen_management ? params.getInt("ScreenBrightnessOnroad") : 101; scene.screen_recorder = screen_management && params.getBool("ScreenRecorder"); + scene.screen_timeout = screen_management ? params.getInt("ScreenTimeout") : 30; scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController"); scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset"); @@ -568,6 +569,8 @@ void Device::setAwake(bool on) { void Device::resetInteractiveTimeout(int timeout) { if (timeout == -1) { timeout = (ignition_on ? 10 : 30); + } else { + timeout = timeout; } interactive_timeout = timeout * UI_FREQ; } @@ -610,7 +613,7 @@ void Device::updateWakefulness(const UIState &s) { ignition_on = s.scene.ignition; if (ignition_just_turned_off) { - resetInteractiveTimeout(); + resetInteractiveTimeout(s.scene.screen_timeout); } else if (interactive_timeout > 0 && --interactive_timeout == 0) { emit interactiveTimeout(); } diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 64901afb9..9b2dd87cc 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -249,6 +249,7 @@ typedef struct UIScene { int obstacle_distance_stock; int screen_brightness; int screen_brightness_onroad; + int screen_timeout; int started_timer; int steering_angle_deg; int stopped_equivalence;