From 2581a72422f2861c499d54c6b3a2df9bd259c9e8 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 28 Mar 2026 18:09:14 +0100 Subject: [PATCH] transport: Fix NACK received on fragmented packet. Signed-off-by: iabdalkader --- src/openmv/transport.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openmv/transport.py b/src/openmv/transport.py index 91e5a7e..c0121f5 100644 --- a/src/openmv/transport.py +++ b/src/openmv/transport.py @@ -227,13 +227,6 @@ def recv_packet(self, poll_events=False): start_time = time.time() continue # Continue collecting fragments - # Either last fragment or non-fragmented packet - if fragments: - # This is the last fragment - combine all - fragments.extend(packet['payload']) - packet['payload'] = bytes(fragments) - packet['length'] = len(fragments) - # Handle NAK flags if packet['flags'] & Flags.NAK: # Raise specific exception for all NAK statuses except BUSY @@ -248,6 +241,13 @@ def recv_packet(self, poll_events=False): raise OMVException(f"Command failed with status: {Status(status).name}") return False + # Either last fragment or non-fragmented packet + if fragments: + # This is the last fragment - combine all + fragments.extend(packet['payload']) + packet['payload'] = bytes(fragments) + packet['length'] = len(fragments) + # Return payload or True for ACK return True if not packet['length'] else bytes(packet['payload'])