fix none type crashes

This commit is contained in:
Prohurtz 2023-06-24 12:17:35 -05:00
parent d7b0136dff
commit 96372a7aa7

View File

@ -12,6 +12,8 @@ class EyeId(IntEnum):
class cal():
def cal_osc(self, cx, cy):
if cx == None or cy == None:
return 0, 0
if cx == 0:
cx = 1
if cy == 0:
@ -62,7 +64,7 @@ class cal():
out_y = 0.5
if self.config.calib_XMAX != None and self.config.calib_XOFF != None:
calib_diff_x_MAX = self.config.calib_XMAX - self.config.calib_XOFF
if calib_diff_x_MAX == 0:
calib_diff_x_MAX = 1
@ -122,3 +124,6 @@ class cal():
except:
pass
return out_x, out_y
else:
print("[INFO] Please Calibrate Eyes")
return 0, 0