79610401

Date: 2025-05-07 11:21:36
Score: 2
Natty:
Report link

I encountered the same problem and am quite confused. Here is a Python version of CRC-8 that produces identical results to the above code( from https://github.com/crsf-wg/crsf/wiki/Python-Parser ). However, both methods fail the packet checksum. However the packet with LINK_STATISTICS is ok. Do you find out the reason?

packet=bytearray([0xc8,0x18,0x16,0xc0,0x3,0x9f,0x2b,0x80,0xf7,0x8b,0x5f,0x94,0xf,0xc0,0x7f,0x48,0x4a,0xf9,0xca,0x7,0x0, 0x0, 0x4c, 0x7c ,0xe2, 0x9]) # here is my packet.

def crc8_dvb_s2(crc, a) -> int:
  crc = crc ^ a
  for ii in range(8):
    if crc & 0x80:
      crc = (crc << 1) ^ 0xD5
    else:
      crc = crc << 1
  return crc & 0xFF

def crc8_data(data) -> int:
    crc = 0
    for a in data:
        crc = crc8_dvb_s2(crc, a)
    return crc

crc8_data(packet[2:-1])
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: GeneralLOR