Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
processer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Blomdell
processer
Commits
bdabdf28
Commit
bdabdf28
authored
5 years ago
by
Anders Blomdell
Browse files
Options
Downloads
Patches
Plain Diff
Improve calibrator error handling
parent
fe853aa5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
china_io-2019/python/calibrator.py
+4
-2
4 additions, 2 deletions
china_io-2019/python/calibrator.py
china_io-2019/python/serialio.py
+10
-5
10 additions, 5 deletions
china_io-2019/python/serialio.py
with
14 additions
and
7 deletions
china_io-2019/python/calibrator.py
+
4
−
2
View file @
bdabdf28
...
@@ -112,9 +112,11 @@ class ChinaIO:
...
@@ -112,9 +112,11 @@ class ChinaIO:
analogIn
=
self
.
io
.
analogIn
()
analogIn
=
self
.
io
.
analogIn
()
analogOut
=
self
.
io
.
analogOut
()
analogOut
=
self
.
io
.
analogOut
()
if
len
(
analogIn
)
!=
4
:
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
:
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
():
for
i
,
c
in
analogIn
.
items
():
if
c
.
bits
!=
18
:
if
c
.
bits
!=
18
:
raise
Exception
(
'
analogIn[%d] is not 18 bit (%d)
'
%
(
i
,
c
.
bits
))
raise
Exception
(
'
analogIn[%d] is not 18 bit (%d)
'
%
(
i
,
c
.
bits
))
...
...
This diff is collapsed.
Click to expand it.
china_io-2019/python/serialio.py
+
10
−
5
View file @
bdabdf28
...
@@ -80,20 +80,25 @@ class SerialIOConfig:
...
@@ -80,20 +80,25 @@ class SerialIOConfig:
self
.
cond
=
threading
.
Condition
()
self
.
cond
=
threading
.
Condition
()
pass
pass
def
getConfig
(
self
,
what
):
if
what
in
self
.
config
:
return
self
.
config
[
what
]
return
[]
def
digitalIn
(
self
):
def
digitalIn
(
self
):
return
self
.
c
onfig
[
DigitalIn
]
return
self
.
getC
onfig
(
DigitalIn
)
def
digitalOut
(
self
):
def
digitalOut
(
self
):
return
self
.
c
onfig
[
DigitalOut
]
return
self
.
getC
onfig
(
DigitalOut
)
def
analogIn
(
self
):
def
analogIn
(
self
):
return
self
.
c
onfig
[
AnalogIn
]
return
self
.
getC
onfig
(
AnalogIn
)
def
analogOut
(
self
):
def
analogOut
(
self
):
return
self
.
c
onfig
[
AnalogOut
]
return
self
.
getC
onfig
(
AnalogOut
)
def
counter
(
self
):
def
counter
(
self
):
return
self
.
c
onfig
[
Counter
]
return
self
.
getC
onfig
(
Counter
)
def
__str__
(
self
):
def
__str__
(
self
):
return
"
%s
"
%
self
.
config
return
"
%s
"
%
self
.
config
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment