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)
|
# compute and write checksum (with DOS line ending for compatibility/safety)
|
||||||
file.write("{:02X}\r\n"
|
file.write("{:02X}\r\n"
|
||||||
.format(((sum(data, # sum data ...
|
.format((((sum(data, # sum data ...
|
||||||
record_length # ... and other ...
|
record_length # ... and other ...
|
||||||
+ sum(split16(offset)) # ... fields ...
|
+ sum(split16(offset)) # ... fields ...
|
||||||
+ record_type) # ... on line
|
+ record_type) # ... on line
|
||||||
& 0xff) # low 8 bits
|
& 0xff) # low 8 bits
|
||||||
^ 0xff) # two's ...
|
^ 0xff) # two's ...
|
||||||
+ 1)) # ... complement
|
+ 1) # ... complement
|
||||||
|
& 0xff)) # low 8 bits
|
||||||
|
|
||||||
|
|
||||||
def intel_hex(file, bytes_, start_address=0x0):
|
def intel_hex(file, bytes_, start_address=0x0):
|
||||||
|
|||||||
Reference in New Issue
Block a user