Skip to content

Commit

Permalink
Delay before first sample to let setup finish.
Browse files Browse the repository at this point in the history
The sensors all read 0 until one period of the sample rate has passed
after setup, so don't bother reading until then.
  • Loading branch information
jameysharp committed May 28, 2016
1 parent 38f22a5 commit f65f85e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ fn main() {

setup(&mut bus).unwrap();

while let Ok(sample) = read_sample(&mut bus) {
let delay = Duration::from_millis(200);
while let Ok(sample) = { sleep(delay); read_sample(&mut bus) } {
println!("{:?}", sample);
sleep(Duration::from_millis(200));
}
}

0 comments on commit f65f85e

Please sign in to comment.