forked from Archive/PX4-Autopilot
Tools/HIL/monitor_firmware_upload.py - fail if there's an ERROR during startup
This commit is contained in:
parent
70831a8e2c
commit
2864735c44
|
@ -40,16 +40,21 @@ def monitor_firmware_upload(port, baudrate):
|
|||
timeout_start = time.time()
|
||||
timeout_newline = time.time()
|
||||
|
||||
return_code = 0
|
||||
|
||||
while True:
|
||||
serial_line = ser.readline().decode("ascii", errors='ignore')
|
||||
|
||||
if len(serial_line) > 0:
|
||||
if "ERROR" in serial_line:
|
||||
return_code = -1
|
||||
|
||||
print_line(serial_line)
|
||||
|
||||
if "NuttShell (NSH)" in serial_line:
|
||||
sys.exit(0)
|
||||
sys.exit(return_code)
|
||||
elif "nsh>" in serial_line:
|
||||
sys.exit(0)
|
||||
sys.exit(return_code)
|
||||
|
||||
if time.time() > timeout_start + timeout:
|
||||
print("Error, timeout")
|
||||
|
|
Loading…
Reference in New Issue