compass calibrate modify
@@ -551,7 +551,8 @@ class Compass:
def calibrate(self):
if self.is_calibrate() is False:
- print('The calibration need to shaking in the air (e.g. 8 or 0) and waiting for a moment')
+ # print('The calibration need to shaking in the air (e.g. 8 or 0) and waiting for a moment')
+ print('First write 8 or 0 in the air with the board about 30 seconds, and then try to rotate the board in different direnctions several times.')
matrix.display.set_pixel(int(7), int(3), 1)
matrix.display.blink_rate(2)
l1=0
@@ -585,33 +586,33 @@ class Compass:
l7=l7 + 1
if x < 0 and y < 0 and a >= 12:
l8=l8 + 1
- if l1 >= 3:
+ if l1 >= 2:
matrix.display.set_pixel(int(7), int(0), 1)
matrix.display.set_pixel(int(8), int(0), 1)
matrix.display.set_pixel(int(9), int(1), 1)
- if l2 >= 3:
+ if l2 >= 2:
matrix.display.set_pixel(int(10), int(2), 1)
matrix.display.set_pixel(int(10), int(3), 1)
- if l3 >= 3:
+ if l3 >= 2:
matrix.display.set_pixel(int(10), int(4), 1)
matrix.display.set_pixel(int(10), int(5), 1)
- if l4 >= 3:
+ if l4 >= 2:
matrix.display.set_pixel(int(9), int(6), 1)
matrix.display.set_pixel(int(8), int(7), 1)
- if l5 >= 3:
+ if l5 >= 2:
matrix.display.set_pixel(int(7), int(7), 1)
matrix.display.set_pixel(int(6), int(7), 1)
- if l6 >= 3:
+ if l6 >= 2:
matrix.display.set_pixel(int(5), int(6), 1)
matrix.display.set_pixel(int(4), int(5), 1)
- if l7 >= 3:
+ if l7 >= 2:
matrix.display.set_pixel(int(4), int(4), 1)
matrix.display.set_pixel(int(4), int(3), 1)
- if l8 >= 3:
+ if l8 >= 2:
matrix.display.set_pixel(int(4), int(2), 1)
matrix.display.set_pixel(int(5), int(1), 1)
matrix.display.set_pixel(int(6), int(0), 1)
- if l1>=3 and l2>=3 and l3>=3 and l4>=3 and l5>=3 and l6>=3 and l7>=3 and l8>=3:
+ if l1>=2 and l2>=2 and l3>=2 and l4>=2 and l5>=2 and l6>=2 and l7>=2 and l8>=2:
break
else:
self.sensor.ak8963.calibrate()
