diff --git a/updata/prottcp.py b/updata/prottcp.py index 260c753..a01c51f 100644 --- a/updata/prottcp.py +++ b/updata/prottcp.py @@ -10,7 +10,17 @@ from PyQt5.QtCore import * - +def crc8(data:bytearray): + crc=0 + for j in range(len(data)): + crc^=data[j] + for i in range(8): + if((crc&0x01)!=0): + crc>>=1 + crc^=0x8c + else: + crc>>=1 + return crc