Prevented infinite loop
This commit is contained in:
@@ -7,6 +7,7 @@ from frappy.core import Readable, Parameter, FloatRange, HasIO, StringIO, Proper
|
||||
class TSSOP16_IO(StringIO):
|
||||
end_of_line = '\r'
|
||||
wait_before = 0.0 #3.0
|
||||
timeout=3.0
|
||||
identification = [ ('*IDN?', r'0x48,ACM1219,.*') ]
|
||||
|
||||
class TSSOP16(HasIO, Readable):
|
||||
@@ -16,7 +17,7 @@ class TSSOP16(HasIO, Readable):
|
||||
value = Parameter('value', FloatRange(unit='pF'), readonly=True)
|
||||
pollinterval = Parameter(default=0.1)
|
||||
|
||||
def read_value(self):
|
||||
def read_off_cvt(self, recursive_layer=0):
|
||||
try:
|
||||
l = self.communicate('readCVT')
|
||||
vals = l.split(',')
|
||||
@@ -24,8 +25,16 @@ class TSSOP16(HasIO, Readable):
|
||||
#print(vals)
|
||||
return vals[0]
|
||||
except:
|
||||
return self.read_off_cvt()
|
||||
traceback.print_exc()
|
||||
self.io.closeConnection()
|
||||
self.io.connectStart()
|
||||
time.sleep(3.0)
|
||||
return self.read_value()
|
||||
if(recursive_layer > 10):
|
||||
return -1
|
||||
else:
|
||||
return self.read_off_cvt(recursive_layer+1)
|
||||
|
||||
def read_value(self):
|
||||
res = self.read_off_cvt()
|
||||
return res
|
||||
Reference in New Issue
Block a user