You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wasn't properly creating checksum on some streams. Here's an example. getChecksum would fail on the "A4" checksum in the Read response. This was on a Dynastream ANTUSB-m.
Write:
A4 02 4D 00 54 BF
Read:
A4 07 54 08 08 00 BA 36 00 DF A4
-wade
The text was updated successfully, but these errors were encountered:
More precisely, I think the author wanted to write:
checksum = (checksum ^ ord(byte)) & 0xFF
for preventing some errors with integer overflow superior to 0xFF, however I think that case seems to be impossible with a range of bytes.
With the current algorithm, if the first operand return 0xFF, the result will be 0, but the expected result should be 0xFF. This is the only value which fail with the used operator %.
0xAB % 0xFF => 0xAB (Good)
0xFF % 0xFF => 0 (failed, expected 0xFF)
with &:
0xAB & 0xFF => 0xAB
0xFF & 0xFF => 0xFF
SamyCookie
added a commit
to SamyCookie/python-ant
that referenced
this issue
Apr 3, 2015
Changed in getChecksum in message.py:
checksum = (checksum ^ ord(byte)) % 0xFF
To:
checksum = (checksum ^ ord(byte))
Wasn't properly creating checksum on some streams. Here's an example. getChecksum would fail on the "A4" checksum in the Read response. This was on a Dynastream ANTUSB-m.
Write:
A4 02 4D 00 54 BF
Read:
A4 07 54 08 08 00 BA 36 00 DF A4
-wade
The text was updated successfully, but these errors were encountered: