Commit 63fe7b16 authored by auke.klazema's avatar auke.klazema

extracted device finding to a method

parent 5cc34ee9
......@@ -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))
......
Markdown is supported
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