Skip to content

Commit 06a73b2

Browse files
committed
Auto merge of #56 - cldershem:patch-6, r=japaric
Updates code to match docs. Code didn't match docs. `FACTOR` changed to `SENSITIVITY`. Also a small typo fix.
2 parents 683dd11 + c025218 commit 06a73b2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/16-punch-o-meter/gravity-is-up.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ the Earth with an acceleration of `1 g` but from its point of view the board is
6565
actually moving upwards (away from the center of the Earth) with an acceleration
6666
of `1 g`. And that's why the proper acceleration is pointing up. This also means
6767
that if the board was in free fall, the accelerometer would report a "proper"
68-
acceleration of zero. Please, don't try that home.
68+
acceleration of zero. Please, don't try that at home.
6969

7070
Yes, physics is hard. Let's move on.

src/16-punch-o-meter/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ use pg::{delay, lsm303dlhc};
1212
#[no_mangle]
1313
pub fn main() -> ! {
1414
loop {
15-
const FACTOR: f32 = 8. / ((1 << 15) as f32);
15+
const SENSITIVITY: f32 = 8. / ((1 << 15) as f32);
1616

1717
let I16x3 { x, y, z } = lsm303dlhc::acceleration();
1818

19-
let x = f32::from(x) * FACTOR;
20-
let y = f32::from(y) * FACTOR;
21-
let z = f32::from(z) * FACTOR;
19+
let x = f32::from(x) * SENSITIVITY;
20+
let y = f32::from(y) * SENSITIVITY;
21+
let z = f32::from(z) * SENSITIVITY;
2222

2323
iprintln!("{:?}", (x, y, z));
2424

0 commit comments

Comments
 (0)