Skip to content

Commit

Permalink
Fix checksum computation in python_logo_converter (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox authored and Ralim committed Oct 16, 2018
1 parent 40907a3 commit 15f365d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Bootup Logo/python_logo_converter/img2ts100.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ def intel_hex_line(file, record_type, offset, data):

# compute and write checksum (with DOS line ending for compatibility/safety)
file.write("{:02X}\r\n"
.format(((sum(data, # sum data ...
record_length # ... and other ...
+ sum(split16(offset)) # ... fields ...
+ record_type) # ... on line
& 0xff) # low 8 bits
^ 0xff) # two's ...
+ 1)) # ... complement
.format((((sum(data, # sum data ...
record_length # ... and other ...
+ sum(split16(offset)) # ... fields ...
+ record_type) # ... on line
& 0xff) # low 8 bits
^ 0xff) # two's ...
+ 1) # ... complement
& 0xff)) # low 8 bits


def intel_hex(file, bytes_, start_address=0x0):
Expand Down

0 comments on commit 15f365d

Please sign in to comment.