Skip to content

Commit 9d017b5

Browse files
authored
Merge pull request #23 from openmv/fragmented_nack
transport: Fix NACK received on fragmented packet.
2 parents a4bc095 + 2581a72 commit 9d017b5

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/openmv/transport.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,6 @@ def recv_packet(self, poll_events=False):
227227
start_time = time.time()
228228
continue # Continue collecting fragments
229229

230-
# Either last fragment or non-fragmented packet
231-
if fragments:
232-
# This is the last fragment - combine all
233-
fragments.extend(packet['payload'])
234-
packet['payload'] = bytes(fragments)
235-
packet['length'] = len(fragments)
236-
237230
# Handle NAK flags
238231
if packet['flags'] & Flags.NAK:
239232
# Raise specific exception for all NAK statuses except BUSY
@@ -248,6 +241,13 @@ def recv_packet(self, poll_events=False):
248241
raise OMVException(f"Command failed with status: {Status(status).name}")
249242
return False
250243

244+
# Either last fragment or non-fragmented packet
245+
if fragments:
246+
# This is the last fragment - combine all
247+
fragments.extend(packet['payload'])
248+
packet['payload'] = bytes(fragments)
249+
packet['length'] = len(fragments)
250+
251251
# Return payload or True for ACK
252252
return True if not packet['length'] else bytes(packet['payload'])
253253

0 commit comments

Comments
 (0)