Tools/HIL: disable XON/XOFF, consistent timeouts, proper input buffer clear

This commit is contained in:
Daniel Agar
2021-12-31 18:55:59 -05:00
parent 03371f8522
commit 247b975675
5 changed files with 12 additions and 15 deletions
+2 -3
View File
@@ -38,7 +38,7 @@ def print_line(line):
def do_nsh_cmd(port, baudrate, cmd):
ser = serial.Serial(port, baudrate, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=0.2, xonxoff=True, rtscts=False, dsrdtr=False)
ser = serial.Serial(port, baudrate, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)
timeout_start = time.monotonic()
timeout = 30 # 30 seconds
@@ -46,7 +46,6 @@ def do_nsh_cmd(port, baudrate, cmd):
# wait for nsh prompt
while True:
ser.write("\n".encode("ascii"))
ser.flush()
serial_line = ser.readline().decode("ascii", errors='ignore')
@@ -61,7 +60,7 @@ def do_nsh_cmd(port, baudrate, cmd):
sys.exit(1)
# clear
ser.readlines()
ser.reset_input_buffer()
# run command
timeout_start = time.monotonic()