Fix checksum computation in python_logo_converter (#371)
This commit is contained in:
committed by
Ben V. Brown
parent
40907a384e
commit
15f365d2bd
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user