From d237dee81d8d60641c0a11023589802f886c7d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Prokopi=C4=8D?= Date: Mon, 16 Dec 2024 20:05:26 +0100 Subject: [PATCH] [core] Fix flashing of UF2 parts beginning at zero (#48) --- uf2tool/models/context.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/uf2tool/models/context.py b/uf2tool/models/context.py index f930fea..e8851e7 100644 --- a/uf2tool/models/context.py +++ b/uf2tool/models/context.py @@ -163,12 +163,13 @@ def collect_data(self, scheme: OTAScheme) -> Optional[Dict[int, BytesIO]]: return None # find BytesIO in the dict + did_append = False for io_offs, io_data in out.items(): if io_offs + len(io_data.getvalue()) == offs: io_data.write(data) - offs = 0 + did_append = True break - if offs == 0: + if did_append: continue # create BytesIO at specified offset