Screen brightness control
Added toggle to control the screen brightness.
This commit is contained in:
@@ -352,6 +352,7 @@ void ui_update_frogpilot_params(UIState *s) {
|
||||
scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI");
|
||||
|
||||
scene.rotating_wheel = params.getBool("RotatingWheel");
|
||||
scene.screen_brightness = params.getInt("ScreenBrightness");
|
||||
}
|
||||
|
||||
void UIState::updateStatus() {
|
||||
@@ -493,6 +494,9 @@ void Device::updateBrightness(const UIState &s) {
|
||||
int brightness = brightness_filter.update(clipped_brightness);
|
||||
if (!awake) {
|
||||
brightness = 0;
|
||||
} else if (s.scene.screen_brightness <= 100) {
|
||||
// Bring the screen brightness up to 5% upon screen tap
|
||||
brightness = fmax(5, s.scene.screen_brightness);
|
||||
}
|
||||
|
||||
if (brightness != last_brightness) {
|
||||
@@ -513,7 +517,11 @@ void Device::updateWakefulness(const UIState &s) {
|
||||
emit interactiveTimeout();
|
||||
}
|
||||
|
||||
setAwake(s.scene.ignition || interactive_timeout > 0);
|
||||
if (s.scene.screen_brightness != 0) {
|
||||
setAwake(s.scene.ignition || interactive_timeout > 0);
|
||||
} else {
|
||||
setAwake(interactive_timeout > 0);
|
||||
}
|
||||
}
|
||||
|
||||
UIState *uiState() {
|
||||
|
||||
@@ -236,6 +236,7 @@ typedef struct UIScene {
|
||||
int desired_follow;
|
||||
int obstacle_distance;
|
||||
int obstacle_distance_stock;
|
||||
int screen_brightness;
|
||||
int steering_angle_deg;
|
||||
int stopped_equivalence;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user