Skip to content

Commit 6b40a7e

Browse files
When the board is in application-mode, send a RESET command and retry discovery
1 parent 2b89be2 commit 6b40a7e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

bootloader/.idea/workspace.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

host-software/xbot-boot.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,19 @@ def discover_boards(timeout, interface_ip=None):
123123
data, address = rx_sock.recvfrom(1024)
124124
# Ignore messages from ourselves
125125
message = data.decode().strip()
126-
if message == 'DISCOVER_REQUEST':
126+
if message == 'DISCOVER_REQUEST' or message == 'RESET':
127127
continue
128-
print(f"Received advertisement from {address[0]}: {data.decode().strip()}")
128+
info = data.decode().strip()
129+
print(f"Received advertisement from {address[0]}: {info}")
130+
# Reset the board, if in application mode
131+
if info.endswith("application-mode"):
132+
# only resend on timeout
133+
print("Board in application mode, sending RESET to board")
134+
tx_sock.sendto(b'RESET', (address[0], BROADCAST_PORT))
135+
try_number = 0
136+
sent = False
137+
continue
138+
129139
# Return the IP of the first board that responds
130140
return address[0]
131141
except socket.timeout:

0 commit comments

Comments
 (0)