Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calcElkCS(s):
- """
- Calculates checksum for sending commands to the ELKM1.
- Sums the ASCII character values mod256 and takes
- the lower byte of the two's complement of that value.
- """
- s = ('%02X' % (len(s) + 2)) + s
- cs = '%2X' % (-(sum(ord(c) for c in s) % 256) & 0xFF)
- return s+cs
Advertisement
Add Comment
Please, Sign In to add comment