Skip to content

Commit

Permalink
brightness: consume prediction values even if they are not used
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz committed Jan 1, 2025
1 parent 102c472 commit 8648d9b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/brightness/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ impl Controller {
fn step(&mut self) {
match self.brightness.get() {
Ok(new_brightness) => {
let predicted_value = self.prediction_rx.try_iter().last();

// 1. check if user wants to learn a new value - this overrides any ongoing activity
if Some(new_brightness) != self.current {
return self.update_current(new_brightness);
}

// 2. check if predictor wants to set a new value
if let Some(desired) = self.prediction_rx.try_iter().last() {
if let Some(desired) = predicted_value {
self.update_target(desired);
}

Expand Down

0 comments on commit 8648d9b

Please sign in to comment.