forked from M-Labs/artiq
1
0
Fork 0

controllers: enforce the usage of either --simulation or --device

This commit is contained in:
Yann Sionneau 2015-06-29 19:21:32 +02:00
parent 515aa96819
commit a73776bd72
4 changed files with 21 additions and 0 deletions

View File

@ -31,6 +31,11 @@ def main():
args = get_argparser().parse_args()
init_logger(args)
if not args.simulation and args.device is None:
raise ValueError("You need to specify either --simulation or "
"-d/--device argument. Use --help for more "
"information.")
dev = Novatech409B(args.device if not args.simulation else None)
try:
simple_server_loop(

View File

@ -27,6 +27,12 @@ def main():
args = get_argparser().parse_args()
init_logger(args)
port = None
if not args.simulation and args.device is None:
raise ValueError("You need to specify either --simulation or "
"-d/--device argument. Use --help for more "
"information.")
if args.simulation:
port = open(args.dump, "wb")
dev = Pdq2(url=args.device, dev=port)

View File

@ -25,6 +25,11 @@ def main():
args = get_argparser().parse_args()
init_logger(args)
if not args.simulation and args.channels is None:
raise ValueError("You need to specify either --simulation or "
"-C/--channels argument. Use --help for more "
"information.")
if args.simulation:
daq = DAQmxSim()
else:

View File

@ -26,6 +26,11 @@ def main():
args = get_argparser().parse_args()
init_logger(args)
if not args.simulation and args.device is None:
raise ValueError("You need to specify either --simulation or "
"-d/--device argument. Use --help for more "
"information.")
if args.simulation:
if args.product == "TDC001":
dev = TdcSim()