mirror of https://github.com/m-labs/artiq.git
Controller cleanups
This commit is contained in:
parent
b45ad9d1a3
commit
2651050c83
|
@ -26,6 +26,10 @@ class Ldasim:
|
||||||
def get_att_step_size(self):
|
def get_att_step_size(self):
|
||||||
return self._att_step_size
|
return self._att_step_size
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""Close the device."""
|
||||||
|
pass
|
||||||
|
|
||||||
def get_attenuation(self):
|
def get_attenuation(self):
|
||||||
"""Reads last attenuation value set to the simulated device.
|
"""Reads last attenuation value set to the simulated device.
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,10 @@ class Tcube:
|
||||||
self.port.flush()
|
self.port.flush()
|
||||||
logger.debug("baud rate set to 115200")
|
logger.debug("baud rate set to 115200")
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""Close the device."""
|
||||||
|
self.port.close()
|
||||||
|
|
||||||
def send(self, msg):
|
def send(self, msg):
|
||||||
msg.send(self.port)
|
msg.send(self.port)
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,11 @@ def main():
|
||||||
lda = Ldasim()
|
lda = Ldasim()
|
||||||
else:
|
else:
|
||||||
lda = Lda(args.serial, args.product)
|
lda = Lda(args.serial, args.product)
|
||||||
|
try:
|
||||||
simple_server_loop({"lda": lda},
|
simple_server_loop({"lda": lda},
|
||||||
args.bind, args.port)
|
args.bind, args.port)
|
||||||
|
finally:
|
||||||
|
lda.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -37,7 +37,10 @@ def main():
|
||||||
elif args.product == "TPZ001":
|
elif args.product == "TPZ001":
|
||||||
dev = Tpz(args.device)
|
dev = Tpz(args.device)
|
||||||
|
|
||||||
|
try:
|
||||||
simple_server_loop({args.product.lower(): dev}, args.bind, args.port)
|
simple_server_loop({args.product.lower(): dev}, args.bind, args.port)
|
||||||
|
finally:
|
||||||
|
dev.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue