Visuals - Screen Management - Screen Timeout

Customize how long it takes for your screen to turn off.
This commit is contained in:
FrogAi 2024-05-11 15:53:46 -07:00
parent b503a0236c
commit f6aaedd9c9
3 changed files with 6 additions and 2 deletions

View File

@ -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:

View File

@ -436,6 +436,7 @@ void ui_update_frogpilot_params(UIState *s, Params &params) {
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");
@ -582,6 +583,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;
}
@ -624,7 +627,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();
}

View File

@ -251,6 +251,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;