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(): class cal():
def cal_osc(self, cx, cy): def cal_osc(self, cx, cy):
if cx == None or cy == None:
return 0, 0
if cx == 0: if cx == 0:
cx = 1 cx = 1
if cy == 0: if cy == 0:
@ -62,7 +64,7 @@ class cal():
out_y = 0.5 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 calib_diff_x_MAX = self.config.calib_XMAX - self.config.calib_XOFF
if calib_diff_x_MAX == 0: if calib_diff_x_MAX == 0:
calib_diff_x_MAX = 1 calib_diff_x_MAX = 1
@ -122,3 +124,6 @@ class cal():
except: except:
pass pass
return out_x, out_y return out_x, out_y
else:
print("[INFO] Please Calibrate Eyes")
return 0, 0