diff --git a/selfdrive/ui/qt/window.cc b/selfdrive/ui/qt/window.cc index b6d90d4..4e4bd36 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(uiState()->scene.screen_timeout; + device()->resetInteractiveTimeout(uiState()->scene.screen_timeout, uiState()->scene.screen_timeout_onroad); break; } default: diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 4da6736..111d045 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -417,6 +417,7 @@ void ui_update_frogpilot_params(UIState *s) { 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.screen_timeout_onroad = screen_management ? params.getInt("ScreenTimeoutOnroad") : 10; scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController"); scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset"); @@ -535,11 +536,11 @@ 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 { - timeout = timeout; + timeout = (ignition_on ? timeout_onroad : timeout); } interactive_timeout = timeout * UI_FREQ; } @@ -578,11 +579,11 @@ void Device::updateBrightness(const UIState &s) { } void Device::updateWakefulness(const UIState &s) { - bool ignition_just_turned_off = !s.scene.ignition && ignition_on; + bool ignition_state_changed = s.scene.ignition != ignition_on; ignition_on = s.scene.ignition; - if (ignition_just_turned_off) { - resetInteractiveTimeout(s.scene.screen_timeout); + if (ignition_state_changed) { + resetInteractiveTimeout(s.scene.screen_timeout, s.scene.screen_timeout_onroad); } else if (interactive_timeout > 0 && --interactive_timeout == 0) { emit interactiveTimeout(); } diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 8d402e3..a32e8c5 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -307,6 +307,7 @@ typedef struct UIScene { int screen_brightness; int screen_brightness_onroad; int screen_timeout; + int screen_timeout_onroad; int steering_angle_deg; int stopped_equivalence; int wheel_icon; @@ -394,7 +395,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); };