Skip to content

Commit

Permalink
[core] Fix flashing of UF2 parts beginning at zero (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
prokoma authored Dec 16, 2024
1 parent 04093ce commit d237dee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions uf2tool/models/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d237dee

Please sign in to comment.