Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b45ad9d1a33f
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 91336f974d09
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 23, 2015

  1. Controller cleanups

    fallen authored and sbourdeauducq committed Mar 23, 2015
    Copy the full SHA
    2651050 View commit details
  2. Copy the full SHA
    91336f9 View commit details
Showing with 18 additions and 4 deletions.
  1. +4 −0 artiq/devices/lda/driver.py
  2. +4 −0 artiq/devices/thorlabs_tcube/driver.py
  3. +6 −3 artiq/frontend/lda_controller.py
  4. +4 −1 artiq/frontend/thorlabs_tcube_controller.py
4 changes: 4 additions & 0 deletions artiq/devices/lda/driver.py
Original file line number Diff line number Diff line change
@@ -26,6 +26,10 @@ def get_att_max(self):
def get_att_step_size(self):
return self._att_step_size

def close(self):
"""Close the device."""
pass

def get_attenuation(self):
"""Reads last attenuation value set to the simulated device.
4 changes: 4 additions & 0 deletions artiq/devices/thorlabs_tcube/driver.py
Original file line number Diff line number Diff line change
@@ -211,6 +211,10 @@ def __init__(self, serial_dev):
self.port.flush()
logger.debug("baud rate set to 115200")

def close(self):
"""Close the device."""
self.port.close()

def send(self, msg):
msg.send(self.port)

9 changes: 6 additions & 3 deletions artiq/frontend/lda_controller.py
Original file line number Diff line number Diff line change
@@ -26,9 +26,12 @@ def main():
if args.device is None:
lda = Ldasim()
else:
lda = Lda(args.serial, args.product)
simple_server_loop({"lda": lda},
args.bind, args.port)
lda = Lda(args.device, args.product)
try:
simple_server_loop({"lda": lda},
args.bind, args.port)
finally:
lda.close()

if __name__ == "__main__":
main()
5 changes: 4 additions & 1 deletion artiq/frontend/thorlabs_tcube_controller.py
Original file line number Diff line number Diff line change
@@ -37,7 +37,10 @@ def main():
elif args.product == "TPZ001":
dev = Tpz(args.device)

simple_server_loop({args.product.lower(): dev}, args.bind, args.port)
try:
simple_server_loop({args.product.lower(): dev}, args.bind, args.port)
finally:
dev.close()

if __name__ == "__main__":
main()