Ignore 0 readings
@@ -126,8 +126,9 @@ while True:
calibrate(True)
x, y, _ = compass.magnetic
- y = y * -1 # negation of y & z becasue the board is mounted upside-down
+ y = y * -1
+ if x != 0.0 and y != 0.0:
normalized_x = normalize(x - corrections[0], mins[0], maxes[0])
normalized_y = normalize(y - corrections[1], mins[1], maxes[1])
