Tools/HIL/monitor_firmware_upload.py - fail if there's an ERROR during startup

This commit is contained in:
Daniel Agar 2021-08-16 21:51:47 -04:00
parent 70831a8e2c
commit 2864735c44
1 changed files with 7 additions and 2 deletions

View File

@ -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")