mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 18:27:05 +08:00
Tools/HIL: disable XON/XOFF, consistent timeouts, proper input buffer clear
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user