We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a971515 commit b297751Copy full SHA for b297751
1 file changed
pd.py
@@ -110,8 +110,11 @@ def handle_bits(self, results):
110
received_crc = int(reduce(lambda a, b: (a << 1) | b, bits[12:]))
111
112
value_tocrc = int(reduce(lambda a, b: (a << 1) | b, bits[:12]))
113
-
114
- calculated_crc = int((~(value_tocrc ^ (value_tocrc >> 4) ^ (value_tocrc >> 8)))&0x0F)
+
+ if self.bidirectional:
115
+ calculated_crc = int((~(value_tocrc ^ (value_tocrc >> 4) ^ (value_tocrc >> 8)))&0x0F)
116
+ else:
117
+ calculated_crc = int(((value_tocrc ^ (value_tocrc >> 4) ^ (value_tocrc >> 8)))&0x0F)
118
119
if received_crc == calculated_crc:
120
crc_ok = True
0 commit comments