Visuals - Screen Management - Screen Timeout (Onroad)
Customize how long it takes for your screen to turn off when onroad.
This commit is contained in:
parent
fb11cc7ff4
commit
de232c4bab
@ -93,7 +93,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
|
|||||||
case QEvent::MouseMove: {
|
case QEvent::MouseMove: {
|
||||||
// ignore events when device is awakened by resetInteractiveTimeout
|
// ignore events when device is awakened by resetInteractiveTimeout
|
||||||
ignore = !device()->isAwake();
|
ignore = !device()->isAwake();
|
||||||
device()->resetInteractiveTimeout(uiState()->scene.screen_timeout;
|
device()->resetInteractiveTimeout(uiState()->scene.screen_timeout, uiState()->scene.screen_timeout_onroad);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -417,6 +417,7 @@ void ui_update_frogpilot_params(UIState *s) {
|
|||||||
scene.screen_brightness_onroad = screen_management ? params.getInt("ScreenBrightnessOnroad") : 101;
|
scene.screen_brightness_onroad = screen_management ? params.getInt("ScreenBrightnessOnroad") : 101;
|
||||||
scene.screen_recorder = screen_management && params.getBool("ScreenRecorder");
|
scene.screen_recorder = screen_management && params.getBool("ScreenRecorder");
|
||||||
scene.screen_timeout = screen_management ? params.getInt("ScreenTimeout") : 30;
|
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.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController");
|
||||||
scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset");
|
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) {
|
if (timeout == -1) {
|
||||||
timeout = (ignition_on ? 10 : 30);
|
timeout = (ignition_on ? 10 : 30);
|
||||||
} else {
|
} else {
|
||||||
timeout = timeout;
|
timeout = (ignition_on ? timeout_onroad : timeout);
|
||||||
}
|
}
|
||||||
interactive_timeout = timeout * UI_FREQ;
|
interactive_timeout = timeout * UI_FREQ;
|
||||||
}
|
}
|
||||||
@ -578,11 +579,11 @@ void Device::updateBrightness(const UIState &s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Device::updateWakefulness(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;
|
ignition_on = s.scene.ignition;
|
||||||
|
|
||||||
if (ignition_just_turned_off) {
|
if (ignition_state_changed) {
|
||||||
resetInteractiveTimeout(s.scene.screen_timeout);
|
resetInteractiveTimeout(s.scene.screen_timeout, s.scene.screen_timeout_onroad);
|
||||||
} else if (interactive_timeout > 0 && --interactive_timeout == 0) {
|
} else if (interactive_timeout > 0 && --interactive_timeout == 0) {
|
||||||
emit interactiveTimeout();
|
emit interactiveTimeout();
|
||||||
}
|
}
|
||||||
|
@ -307,6 +307,7 @@ typedef struct UIScene {
|
|||||||
int screen_brightness;
|
int screen_brightness;
|
||||||
int screen_brightness_onroad;
|
int screen_brightness_onroad;
|
||||||
int screen_timeout;
|
int screen_timeout;
|
||||||
|
int screen_timeout_onroad;
|
||||||
int steering_angle_deg;
|
int steering_angle_deg;
|
||||||
int stopped_equivalence;
|
int stopped_equivalence;
|
||||||
int wheel_icon;
|
int wheel_icon;
|
||||||
@ -394,7 +395,7 @@ signals:
|
|||||||
void interactiveTimeout();
|
void interactiveTimeout();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void resetInteractiveTimeout(int timeout = -1);
|
void resetInteractiveTimeout(int timeout = -1, int timeout_onroad = -1);
|
||||||
void update(const UIState &s);
|
void update(const UIState &s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user