Skip to content

Commit

Permalink
Refactor power saving. Refresh screen only when leaving power saving
Browse files Browse the repository at this point in the history
  • Loading branch information
zargony committed Aug 27, 2024
1 parent 908071b commit e4df676
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions firmware/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,19 @@ impl<'a, I2C: I2c, IRQ: Wait<Error = Infallible>> Ui<'a, I2C, IRQ> {
{
// Id card read
Ok(Either::First(res)) => res?,
// Key pressed, leave power saving
Ok(Either::Second(_key)) => {
// Key pressed while saving power, leave power saving
Ok(Either::Second(_key)) if saving_power => {
saving_power = false;
continue;
}
// On idle timeout, enter power saving
// Idle timeout, enter power saving
Err(TimeoutError) if !saving_power => {
self.power_save().await?;
saving_power = true;
continue;
}
Err(TimeoutError) => continue,
// Otherwise, do nothing
_ => continue,
};
info!("UI: Detected NFC card: {}", uid);
let _ = self.buzzer.short_confirmation().await;
Expand Down

0 comments on commit e4df676

Please sign in to comment.