Skip to content

Commit ca20e8d

Browse files
committed
backlight: dim the backlight when in screensaver mode
There is really no need to blast light at 100% just for the screensaver. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
1 parent 0ae8af2 commit ca20e8d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ui/screens/screensaver.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ struct Active {
119119
widgets: WidgetContainer,
120120
locator: Arc<Topic<bool>>,
121121
alerts: Arc<Topic<AlertList>>,
122+
brightness: Arc<Topic<f32>>,
122123
}
123124

124125
impl ActivatableScreen for ScreenSaverScreen {
@@ -159,11 +160,16 @@ impl ActivatableScreen for ScreenSaverScreen {
159160

160161
let locator = ui.locator.clone();
161162
let alerts = ui.alerts.clone();
163+
let brightness = ui.res.backlight.brightness.clone();
164+
165+
// Dim to 10% brightness in screensaver mode
166+
brightness.set(0.1);
162167

163168
let active = Active {
164169
widgets,
165170
locator,
166171
alerts,
172+
brightness,
167173
};
168174

169175
Box::new(active)
@@ -177,6 +183,8 @@ impl ActiveScreen for Active {
177183
}
178184

179185
async fn deactivate(mut self: Box<Self>) -> Display {
186+
// Restore full backlight brightness
187+
self.brightness.set(1.0);
180188
self.widgets.destroy().await
181189
}
182190

0 commit comments

Comments
 (0)