devices/lda: break off main function

This commit is contained in:
Sebastien Bourdeauducq 2014-12-10 12:01:31 +08:00
parent eb42cf2bb4
commit 87fdad97ca
2 changed files with 8 additions and 4 deletions

View File

@ -5,8 +5,7 @@ import argparse
from artiq.management.pc_rpc import Client
if __name__ == "__main__":
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--server', default="::1",
help="The IP address or hostname of the controller")
@ -25,3 +24,6 @@ if __name__ == "__main__":
remote.set_attenuation(args.attenuation)
finally:
remote.close_rpc()
if __name__ == "__main__":
main()

View File

@ -165,8 +165,7 @@ class Lda:
"""
self.set(0x8d, bytes(chr(int(round(attenuation*4))), 'ascii'))
if __name__ == "__main__":
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--device', default="LDA-102",
choices=["LDA-102", "LDA-602", "sim"])
@ -185,3 +184,6 @@ if __name__ == "__main__":
simple_server_loop(lda, "lda",
args.bind, args.port)
if __name__ == "__main__":
main()