Skip to content

Commit efe7158

Browse files
author
Nathan Seidle
committed
Fixing loader bug when users is printing lots of text
User's sketch may be hammering on serial port as we wait for bootload command. Ignore unknowns up to 10 times.
1 parent 93d4fb2 commit efe7158

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

tools/artemis/artemis_uart_loader.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,16 @@ def main():
9797

9898
response = ser.read()
9999

100-
if(ord(response) == BL_COMMAND_ANNOUNCE):
101-
# Respond with 'AOK'
102-
# values = bytearray([6])
103-
ser.write(BL_COMMAND_AOK.to_bytes(1, byteorder='big'))
100+
if(ord(response) == BL_COMMAND_ANNOUNCE):
101+
# Respond with 'AOK'
102+
# values = bytearray([6])
103+
ser.write(BL_COMMAND_AOK.to_bytes(1, byteorder='big'))
104104

105-
verboseprint("Bootload response received")
106-
else:
107-
print("Unkown response: " + str(ord(response)) +
108-
". Perhaps you have the wrong port?")
109-
exit()
105+
verboseprint("Bootload response received")
106+
break
107+
else:
108+
verboseprint("Unkown response: " + str(ord(response)))
109+
response = ''
110110

111111
# Send upload baud rate
112112
baud_in_bytes = args.baud.to_bytes(4, byteorder='big')
@@ -198,6 +198,9 @@ def main():
198198

199199
if end > totalLen:
200200
end = totalLen
201+
else:
202+
print("Unknown BL response")
203+
exit()
201204

202205
exit()
203206

-1.12 KB
Binary file not shown.

0 commit comments

Comments
 (0)