DAQ: added a check to see if curp or target_pos is Nonem as they are set to None when abr crashes

This commit is contained in:
2025-11-11 11:34:34 +01:00
parent 3f0e6873ea
commit 3ba6009b7b
+5 -1
View File
@@ -246,7 +246,11 @@ class NonStandard(object):
else:
speed = self.get_speed()
curp = self.position
timeout = self.__timeout_margin + (abs(curp - self.__target_pos) / speed)
if curp is None or self.__target_pos is None or speed is None:
timeout = self.__timeout_margin
raise RuntimeWarning("can't calculate timeout, ABR may be disconnected")
else:
timeout = self.__timeout_margin + (abs(curp - self.__target_pos) / speed)
return timeout
def wait(self):