Skip to content

Commit

Permalink
Fix unnecessary accelerometer wakeup after dpms on
Browse files Browse the repository at this point in the history
This fixes an issue where the accelerometer would always start polling
after the screen was woken up, regardless of the orientation lock's
state.

It also removes a `println` statement left over from the last
accelerometer polling patch.
  • Loading branch information
chrisduerr committed Jan 9, 2024
1 parent 1bf9cca commit 21ad6ff
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion src/catacomb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ impl Catacomb {
// Pause accelerometer checks during sleep.
if sleep {
trace_error(self.event_loop.disable(&self.accelerometer_token));
} else {
} else if !self.windows.orientation_locked() {
trace_error(self.event_loop.enable(&self.accelerometer_token));
}

Expand Down
1 change: 0 additions & 1 deletion src/orientation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ impl AccelerometerSource for SensorAccelerometer {
{
loop_handle
.insert_source(Timer::immediate(), move |_, _, catacomb| {
println!("POLLING ACCELEROMETER");
let fallback = self.last.unwrap_or(Orientation::Portrait);
let orientation = self.orientation().unwrap_or(fallback);
if Some(orientation) != self.last {
Expand Down

0 comments on commit 21ad6ff

Please sign in to comment.