From f72c5e027050bc03c107a746da8d98daf911f83e Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Tue, 15 Feb 2022 16:18:54 -0500 Subject: [PATCH] Update calibration math. --- examples/adxl34x_offset_calibration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/adxl34x_offset_calibration.py b/examples/adxl34x_offset_calibration.py index 2e1c356..9f9b351 100644 --- a/examples/adxl34x_offset_calibration.py +++ b/examples/adxl34x_offset_calibration.py @@ -24,9 +24,9 @@ print("Raw z: ", z) accelerometer.offset = ( - int(-(x + 4) / 8), - int(-(y + 4) / 8), - int(-(z - 250 + 4) / 8), # Z should be '250' at 1g (4mg per bit) + round(-x / 8), + round(-y / 8), + round(-(z - 250) / 8), # Z should be '250' at 1g (4mg per bit) ) print("Calibrated offsets: ", accelerometer.offset)