sw: update console, now can send actual data

This commit is contained in:
Phil
2026-04-17 14:44:27 +03:00
parent f54883a9e7
commit 83c714cd6f

View File

@ -49,8 +49,36 @@ def format_ctrl_data(pulse_width: int, pulse_period: int,
return output
def verify_args(args):
"""check args are non zero and in bound, request from user if needed"""
if args.pulse_width == 0:
args.pulse_width = int(input("pulse_width: "))
if args.pulse_period == 0:
args.pulse_period = int(input("pulse_period: "))
if args.pulse_num == 0:
args.pulse_num = int(input("pulse_num: "))
if args.pulse_height == 0:
args.pulse_height = int(input("pulse_height: "))
def run(args, sock):
pass
dest = (args.ip, args.send_port)
# reset
sock.sendto(0x0f00.to_bytes(2), dest)
# config data
sock.sendto(format_ctrl_data(args.pulse_width,
args.pulse_period,
args.pulse_height,
args.pulse_num,
dac_bits=args.dac_bits), dest)
sock.sendto(0xf000.to_bytes(2), dest)
print("Sent start!")
def main():
@ -85,6 +113,7 @@ def main():
if args.debug:
run_debug(args, sock)
else:
verify_args(args)
run(args, sock)
sock.close()