Visuals - Screen Management - Standby Mode
Turn the screen off after your screen times out when onroad, but wake it back up when engagement state changes or important alerts are triggered.
This commit is contained in:
parent
5269efbf3d
commit
96e847e051
|
@ -438,6 +438,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) {
|
||||||
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.screen_timeout_onroad = screen_management ? params.getInt("ScreenTimeoutOnroad") : 10;
|
||||||
|
scene.standby_mode = screen_management && params.getBool("StandbyMode");
|
||||||
|
|
||||||
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");
|
||||||
|
@ -454,6 +455,7 @@ void UIState::updateStatus() {
|
||||||
if (scene.started && sm->updated("controlsState")) {
|
if (scene.started && sm->updated("controlsState")) {
|
||||||
auto controls_state = (*sm)["controlsState"].getControlsState();
|
auto controls_state = (*sm)["controlsState"].getControlsState();
|
||||||
auto state = controls_state.getState();
|
auto state = controls_state.getState();
|
||||||
|
auto previous_status = status;
|
||||||
if (state == cereal::ControlsState::OpenpilotState::PRE_ENABLED || state == cereal::ControlsState::OpenpilotState::OVERRIDING) {
|
if (state == cereal::ControlsState::OpenpilotState::PRE_ENABLED || state == cereal::ControlsState::OpenpilotState::OVERRIDING) {
|
||||||
status = STATUS_OVERRIDE;
|
status = STATUS_OVERRIDE;
|
||||||
} else if (scene.always_on_lateral_active) {
|
} else if (scene.always_on_lateral_active) {
|
||||||
|
@ -463,6 +465,8 @@ void UIState::updateStatus() {
|
||||||
} else {
|
} else {
|
||||||
status = scene.enabled ? STATUS_ENGAGED : STATUS_DISENGAGED;
|
status = scene.enabled ? STATUS_ENGAGED : STATUS_DISENGAGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scene.wake_up_screen = controls_state.getAlertStatus() != cereal::ControlsState::AlertStatus::NORMAL || status != previous_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.started |= paramsMemory.getBool("ForceOnroad");
|
scene.started |= paramsMemory.getBool("ForceOnroad");
|
||||||
|
@ -609,6 +613,8 @@ void Device::updateBrightness(const UIState &s) {
|
||||||
int brightness = brightness_filter.update(clipped_brightness);
|
int brightness = brightness_filter.update(clipped_brightness);
|
||||||
if (!awake) {
|
if (!awake) {
|
||||||
brightness = 0;
|
brightness = 0;
|
||||||
|
} else if (s.scene.started && s.scene.standby_mode && !s.scene.wake_up_screen && interactive_timeout == 0) {
|
||||||
|
brightness = 0;
|
||||||
} else if (s.scene.started && s.scene.screen_brightness_onroad != 101) {
|
} else if (s.scene.started && s.scene.screen_brightness_onroad != 101) {
|
||||||
brightness = interactive_timeout > 0 ? fmax(5, s.scene.screen_brightness_onroad) : s.scene.screen_brightness_onroad;
|
brightness = interactive_timeout > 0 ? fmax(5, s.scene.screen_brightness_onroad) : s.scene.screen_brightness_onroad;
|
||||||
} else if (s.scene.screen_brightness != 101) {
|
} else if (s.scene.screen_brightness != 101) {
|
||||||
|
@ -627,8 +633,18 @@ void Device::updateWakefulness(const UIState &s) {
|
||||||
bool ignition_state_changed = 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_on && s.scene.standby_mode) {
|
||||||
|
if (s.scene.wake_up_screen) {
|
||||||
|
resetInteractiveTimeout(s.scene.screen_timeout, s.scene.screen_timeout_onroad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ignition_state_changed) {
|
if (ignition_state_changed) {
|
||||||
resetInteractiveTimeout(s.scene.screen_timeout, s.scene.screen_timeout_onroad);
|
if (ignition_on && s.scene.screen_brightness_onroad == 0 && !s.scene.standby_mode) {
|
||||||
|
resetInteractiveTimeout(0, 0);
|
||||||
|
} else {
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,7 @@ typedef struct UIScene {
|
||||||
bool speed_limit_changed;
|
bool speed_limit_changed;
|
||||||
bool speed_limit_controller;
|
bool speed_limit_controller;
|
||||||
bool speed_limit_overridden;
|
bool speed_limit_overridden;
|
||||||
|
bool standby_mode;
|
||||||
bool standstill;
|
bool standstill;
|
||||||
bool static_pedals_on_ui;
|
bool static_pedals_on_ui;
|
||||||
bool stopped_timer;
|
bool stopped_timer;
|
||||||
|
@ -206,6 +207,7 @@ typedef struct UIScene {
|
||||||
bool use_si;
|
bool use_si;
|
||||||
bool use_vienna_slc_sign;
|
bool use_vienna_slc_sign;
|
||||||
bool vtsc_controlling_curve;
|
bool vtsc_controlling_curve;
|
||||||
|
bool wake_up_screen;
|
||||||
bool wheel_speed;
|
bool wheel_speed;
|
||||||
|
|
||||||
double fps;
|
double fps;
|
||||||
|
|
Loading…
Reference in New Issue