Skip to content

Commit 552e3f9

Browse files
committed
Fixed formatting
1 parent dd95a65 commit 552e3f9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/calibrate.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
##
1616

1717
import time
18-
import math
1918
import board
2019
import busio
2120
import adafruit_lsm9ds1
2221

22+
2323
def map_range(x, in_min, in_max, out_min, out_max):
2424
"""
2525
Maps a number from one range to another.
@@ -32,6 +32,7 @@ def map_range(x, in_min, in_max, out_min, out_max):
3232

3333
return min(max(mapped, out_max), out_min)
3434

35+
3536
def calibrate():
3637
"""
3738
Calibrates a magnometer or gyroscope
@@ -67,7 +68,7 @@ def calibrate():
6768
zavg += gz
6869
countavg += 1
6970

70-
if (time.monotonic() - lastDisplayTime >= 3):
71+
if time.monotonic() - lastDisplayTime >= 3:
7172
print("Uncalibrated:", x, y, z)
7273
cal_x = map_range(x, MAG_MIN[0], MAG_MAX[0], -1, 1)
7374
cal_y = map_range(y, MAG_MIN[1], MAG_MAX[1], -1, 1)
@@ -78,4 +79,4 @@ def calibrate():
7879
print("Uncalibrated gyro: ", (gx, gy, gz))
7980
print("Gyro: ", (xavg / countavg, yavg / countavg, zavg / countavg))
8081

81-
lastDisplayTime = time.monotonic()
82+
lastDisplayTime = time.monotonic()

0 commit comments

Comments
 (0)