Commit 5cc34ee9 authored by auke.klazema's avatar auke.klazema
Browse files

extracted device initialisation to a method

parent 35e34df8
...@@ -32,13 +32,8 @@ class PrologixGpibUsb(PortDevice): ...@@ -32,13 +32,8 @@ class PrologixGpibUsb(PortDevice):
self._find_available_port(maxDeviceNum, port, portFormat, timeout, verbose) self._find_available_port(maxDeviceNum, port, portFormat, timeout, verbose)
self._serialPort.write("++savecfg 0" + chr(10)) self._initialize_prologix_gpi()
self._serialPort.write("++auto 0" + chr(10))
self._serialPort.write("++eoi 1" + chr(10))
self._serialPort.write("++eos 2" + chr(10))
self._serialPort.write("++eot_enable 0" + chr(10))
self._serialPort.write("++eot_char 0" + chr(10))
self._serialPort.write("++read_tmo_ms 500" + chr(10))
if findDevices: if findDevices:
self._devices = [] self._devices = []
for self._hpib_address in range(0, 31): for self._hpib_address in range(0, 31):
...@@ -53,6 +48,15 @@ class PrologixGpibUsb(PortDevice): ...@@ -53,6 +48,15 @@ class PrologixGpibUsb(PortDevice):
self._devices = "Not scanned." self._devices = "Not scanned."
self._hpib_address = -1 self._hpib_address = -1
def _initialize_prologix_gpi(self):
self._serialPort.write("++savecfg 0" + chr(10))
self._serialPort.write("++auto 0" + chr(10))
self._serialPort.write("++eoi 1" + chr(10))
self._serialPort.write("++eos 2" + chr(10))
self._serialPort.write("++eot_enable 0" + chr(10))
self._serialPort.write("++eot_char 0" + chr(10))
self._serialPort.write("++read_tmo_ms 500" + chr(10))
def _find_available_port(self, maxDeviceNum, port, portFormat, timeout, verbose): def _find_available_port(self, maxDeviceNum, port, portFormat, timeout, verbose):
while int(self._rematch.group(2)) < maxDeviceNum: while int(self._rematch.group(2)) < maxDeviceNum:
if verbose: if verbose:
......
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