Skip to content

Commit f95e0fa

Browse files
mikewadstentatianaleon
authored andcommitted
xmodem: Handle first-chunk delay when sending firmware into XR bootloader
This change will also apply to XBee RR, XBee 3 BLU and XBee 3 Cellular. https://onedigi.atlassian.net/browse/LCG-631
1 parent d2c8a4a commit f95e0fa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

digi/xbee/util/xmodem.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
_XMODEM_BLOCK_SIZE_1K = 1024
5656
_XMODEM_READ_HEADER_TIMEOUT = 3 # Seconds
5757
_XMODEM_READ_DATA_TIMEOUT = 1 # Seconds.
58+
_XMODEM_READ_DATA_TIMEOUT_EXTENDED = 5 # Seconds.
5859
_XMODEM_READ_RETRIES = 10
5960
_XMODEM_WRITE_RETRIES = 10
6061

@@ -540,7 +541,14 @@ def _send_next_block(self, data):
540541
if not self._write_cb(packet):
541542
retries -= 1
542543
continue
543-
answer = self._read_cb(1, timeout=_XMODEM_READ_DATA_TIMEOUT)
544+
answer = self._read_cb(1, timeout=(
545+
# On XBee 3 Cellular, XBee RR, XBee 3 BLU, and XBee XR,
546+
# the first XModem chunk of a firmware upload to the bootloader
547+
# takes about 4 seconds.
548+
_XMODEM_READ_DATA_TIMEOUT_EXTENDED
549+
if self._transfer_file.chunk_index == 1
550+
else _XMODEM_READ_DATA_TIMEOUT
551+
))
544552
if not answer:
545553
retries -= 1
546554
continue

0 commit comments

Comments
 (0)