Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
processer
Commits
bdabdf28
Commit
bdabdf28
authored
Oct 17, 2019
by
Anders Blomdell
Browse files
Improve calibrator error handling
parent
fe853aa5
Changes
2
Hide whitespace changes
Inline
Side-by-side
china_io-2019/python/calibrator.py
View file @
bdabdf28
...
...
@@ -112,9 +112,11 @@ class ChinaIO:
analogIn
=
self
.
io
.
analogIn
()
analogOut
=
self
.
io
.
analogOut
()
if
len
(
analogIn
)
!=
4
:
raise
Exception
(
'Did not find 4 analogIn channels'
)
raise
Exception
(
'Did not find 4 analogIn channels (%d)'
%
(
len
(
analogIn
)))
if
len
(
analogOut
)
!=
2
:
raise
Exception
(
'Did not find 2 analogOut channels'
)
raise
Exception
(
'Did not find 2 analogOut channels (%d)'
(
len
(
analogOut
)))
for
i
,
c
in
analogIn
.
items
():
if
c
.
bits
!=
18
:
raise
Exception
(
'analogIn[%d] is not 18 bit (%d)'
%
(
i
,
c
.
bits
))
...
...
china_io-2019/python/serialio.py
View file @
bdabdf28
...
...
@@ -80,20 +80,25 @@ class SerialIOConfig:
self
.
cond
=
threading
.
Condition
()
pass
def
getConfig
(
self
,
what
):
if
what
in
self
.
config
:
return
self
.
config
[
what
]
return
[]
def
digitalIn
(
self
):
return
self
.
c
onfig
[
DigitalIn
]
return
self
.
getC
onfig
(
DigitalIn
)
def
digitalOut
(
self
):
return
self
.
c
onfig
[
DigitalOut
]
return
self
.
getC
onfig
(
DigitalOut
)
def
analogIn
(
self
):
return
self
.
c
onfig
[
AnalogIn
]
return
self
.
getC
onfig
(
AnalogIn
)
def
analogOut
(
self
):
return
self
.
c
onfig
[
AnalogOut
]
return
self
.
getC
onfig
(
AnalogOut
)
def
counter
(
self
):
return
self
.
c
onfig
[
Counter
]
return
self
.
getC
onfig
(
Counter
)
def
__str__
(
self
):
return
"%s"
%
self
.
config
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment