Skip to content

Commit

Permalink
Merge pull request #1 from Sobuno/patch-1
Browse files Browse the repository at this point in the history
Check the calculated CRC8 for OS2
  • Loading branch information
atbrask authored Jul 10, 2017
2 parents edc3c0e + 68fb841 commit 214d9dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Backend/RPIWeather/OOK433MHzReceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def decodeOS2(self, data):
crcbytes = [(crcnibbles[i]<<4) | crcnibbles[i+1] for i in range(0, len(crcnibbles), 2)]
CRC = self.calcCRC8(crcbytes, 0x07, 0x9a)
providedCRC = (data[15]<<4) | data[14]
if checksum != providedChecksum:
if CRC != providedCRC:
raise Exception("OS2 error: Bad CRC8! Got 0x{0:02X} but calculated 0x{1:02X}".format(providedCRC, CRC))

# ID and channel
Expand Down

0 comments on commit 214d9dc

Please sign in to comment.