Skip to content

Commit c025218

Browse files
authored
Changes code to match documentation.
Code didn't match the tutorial page. `SENSITIVITY` seemed clearer than `FACTOR`, but it could go the other way also.
1 parent fd267c0 commit c025218

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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)