Commit 784d98df authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Try to make more thread safe, unset event after consuming

parent 4895a0d1
......@@ -78,13 +78,14 @@ class PrologixGpibUsb(PortDevice):
self._serialPort.write(commandString)
def _initialize_prologix_gpi(self):
self._write_serial("++savecfg 0" + chr(10))
self._write_serial("++auto 0" + chr(10))
self._write_serial("++eoi 1" + chr(10))
self._write_serial("++eos 2" + chr(10))
self._write_serial("++eot_enable 0" + chr(10))
self._write_serial("++eot_char 0" + chr(10))
self._write_serial("++read_tmo_ms 500" + chr(10))
with self._lock:
self._write_serial("++savecfg 0" + chr(10))
self._write_serial("++auto 0" + chr(10))
self._write_serial("++eoi 1" + chr(10))
self._write_serial("++eos 2" + chr(10))
self._write_serial("++eot_enable 0" + chr(10))
self._write_serial("++eot_char 0" + chr(10))
self._write_serial("++read_tmo_ms 500" + chr(10))
def _find_devices(self):
self._devices = []
......@@ -92,8 +93,9 @@ class PrologixGpibUsb(PortDevice):
commandStr = "++addr " + str(address) + chr(10) + \
"*idn?" + chr(10) + \
"++read" + chr(10)
self._write_serial(commandStr)
returnStr = self._serialPort.readline()
with self._lock:
self._write_serial(commandStr)
returnStr = self._serialPort.readline()
if returnStr != "":
self._devices += [address, returnStr]
......
......@@ -41,7 +41,7 @@ def track_doppler(dt, lo,
tracking_frequency=freq_hi,
doppler_function=doppler_frequency,
exit_event=None,
timeout=0.5):
timeout=0.3):
"""Sets the Local Oscillator to a frequency to correct for Doppler shift. When exit event is
set, return the LO frequency to 1GHz.
......@@ -69,3 +69,4 @@ def track_doppler(dt, lo,
lo.frequency = dfreq
exit_event.wait(timeout=timeout)
lo.frequency = 1*u.GHz
exit_event.unset()
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