mirror of https://github.com/m-labs/artiq.git
devices/lda: break off main function
This commit is contained in:
parent
eb42cf2bb4
commit
87fdad97ca
|
@ -5,8 +5,7 @@ import argparse
|
||||||
from artiq.management.pc_rpc import Client
|
from artiq.management.pc_rpc import Client
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-s', '--server', default="::1",
|
parser.add_argument('-s', '--server', default="::1",
|
||||||
help="The IP address or hostname of the controller")
|
help="The IP address or hostname of the controller")
|
||||||
|
@ -25,3 +24,6 @@ if __name__ == "__main__":
|
||||||
remote.set_attenuation(args.attenuation)
|
remote.set_attenuation(args.attenuation)
|
||||||
finally:
|
finally:
|
||||||
remote.close_rpc()
|
remote.close_rpc()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
|
@ -165,8 +165,7 @@ class Lda:
|
||||||
"""
|
"""
|
||||||
self.set(0x8d, bytes(chr(int(round(attenuation*4))), 'ascii'))
|
self.set(0x8d, bytes(chr(int(round(attenuation*4))), 'ascii'))
|
||||||
|
|
||||||
|
def main():
|
||||||
if __name__ == "__main__":
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-d', '--device', default="LDA-102",
|
parser.add_argument('-d', '--device', default="LDA-102",
|
||||||
choices=["LDA-102", "LDA-602", "sim"])
|
choices=["LDA-102", "LDA-602", "sim"])
|
||||||
|
@ -185,3 +184,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
simple_server_loop(lda, "lda",
|
simple_server_loop(lda, "lda",
|
||||||
args.bind, args.port)
|
args.bind, args.port)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in New Issue