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