Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
auke.klazema
HPIB
Commits
63fe7b16
Commit
63fe7b16
authored
Feb 16, 2018
by
auke.klazema
Browse files
extracted device finding to a method
parent
5cc34ee9
Changes
1
Hide whitespace changes
Inline
Side-by-side
hpib.py
View file @
63fe7b16
...
...
@@ -35,19 +35,22 @@ class PrologixGpibUsb(PortDevice):
self
.
_initialize_prologix_gpi
()
if
findDevices
:
self
.
_devices
=
[]
for
self
.
_hpib_address
in
range
(
0
,
31
):
commandStr
=
"++addr "
+
str
(
self
.
_hpib_address
)
+
chr
(
10
)
+
\
"*idn?"
+
chr
(
10
)
+
\
"++read"
+
chr
(
10
)
self
.
_serialPort
.
write
(
commandStr
)
returnStr
=
self
.
_serialPort
.
readline
()
if
returnStr
!=
""
:
self
.
_devices
+=
[
self
.
_hpib_address
,
returnStr
]
self
.
_find_devices
()
else
:
self
.
_devices
=
"Not scanned."
self
.
_hpib_address
=
-
1
def
_find_devices
(
self
):
self
.
_devices
=
[]
for
self
.
_hpib_address
in
range
(
0
,
31
):
commandStr
=
"++addr "
+
str
(
self
.
_hpib_address
)
+
chr
(
10
)
+
\
"*idn?"
+
chr
(
10
)
+
\
"++read"
+
chr
(
10
)
self
.
_serialPort
.
write
(
commandStr
)
returnStr
=
self
.
_serialPort
.
readline
()
if
returnStr
!=
""
:
self
.
_devices
+=
[
self
.
_hpib_address
,
returnStr
]
def
_initialize_prologix_gpi
(
self
):
self
.
_serialPort
.
write
(
"++savecfg 0"
+
chr
(
10
))
self
.
_serialPort
.
write
(
"++auto 0"
+
chr
(
10
))
...
...
Write
Preview
Markdown
is supported
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