Skip to content

Commit dad1cf6

Browse files
committed
Update calibration math.
1 parent d0a6cf0 commit dad1cf6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/adxl37x_offset_calibration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
print("Raw z: ", z)
2121

2222
accelerometer.offset = (
23-
int(-(x + 2) / 4),
24-
int(-(y + 2) / 4),
25-
int(-(z - 20 + 2) / 4), # Z should be '20' at 1g (49mg per bit)
23+
round(-x / 4),
24+
round(-y / 4),
25+
round(-(z - 20) / 4), # Z should be '20' at 1g (49mg per bit)
2626
)
2727
print("Calibrated offsets: ", accelerometer.offset)
2828

0 commit comments

Comments
 (0)