Commit bdabdf28 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Improve calibrator error handling

parent fe853aa5
......@@ -112,9 +112,11 @@ class ChinaIO:
analogIn =
analogOut =
if len(analogIn) != 4:
raise Exception('Did not find 4 analogIn channels')
raise Exception('Did not find 4 analogIn channels (%d)' %
if len(analogOut) != 2:
raise Exception('Did not find 2 analogOut channels')
raise Exception('Did not find 2 analogOut channels (%d)'
for i,c in analogIn.items():
if c.bits != 18:
raise Exception('analogIn[%d] is not 18 bit (%d)' % (i, c.bits))
......@@ -80,20 +80,25 @@ class SerialIOConfig:
self.cond = threading.Condition()
def getConfig(self, what):
if what in self.config:
return self.config[what]
return []
def digitalIn(self):
return self.config[DigitalIn]
return self.getConfig(DigitalIn)
def digitalOut(self):
return self.config[DigitalOut]
return self.getConfig(DigitalOut)
def analogIn(self):
return self.config[AnalogIn]
return self.getConfig(AnalogIn)
def analogOut(self):
return self.config[AnalogOut]
return self.getConfig(AnalogOut)
def counter(self):
return self.config[Counter]
return self.getConfig(Counter)
def __str__(self):
return "%s" % self.config
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment