simplified message handling, switch from XOR checksum to CRC8 with polynomial 0x97.

0x97 allows for detection of all 1-3 bit errors in a message of up to
119 bytes
(see https://www.faa.gov/aircraft/air_cert/design_approvals/air_software/media/TC-14-49.pdf)
This commit is contained in:
Martin Preuss
2023-04-07 23:22:40 +02:00
parent 4e1f08b567
commit 7eb462173c
33 changed files with 281 additions and 367 deletions

View File

@@ -21,8 +21,8 @@
comReceivePacketHandleBuffer:
rcall COM_BufferAlloc
brcs comReceivePacketHandleBuffer_haveBuffer
ldi xl, LOW(comStatsNoBuffer)
ldi xh, HIGH(comStatsNoBuffer)
ldi xl, LOW(comStatsRecvNoBuffer)
ldi xh, HIGH(comStatsRecvNoBuffer)
rjmp comReceivePacketHandleBuffer_errorWithCounter
comReceivePacketHandleBuffer_haveBuffer:
@@ -72,7 +72,7 @@ comReceivePacketHandleBuffer_notforme:
; OUT:
; - CFLAG: set if okay, clear otherwise
; - R16: error code if CFLAG cleared
; MODIFIED REGISTERS: r16, r17, r18, X (r20, r21, r22)
; MODIFIED REGISTERS: r16, r17, r18, X (r19, r20, r21, r22)
comReceivePacketToXandCheck:
push xh
@@ -81,7 +81,7 @@ comReceivePacketToXandCheck:
pop xl
pop xh
brcc comReceivePacketToXandCheck_error
rcall cproCheckMessageInBuffer ; (R16, R17, R18, X)
rcall cproCheckMessageInBuffer ; (R16, R17, R18, R19, R20, X)
ldi r16, COM_ERR_CHECKSUM
brcc comReceivePacketToXandCheck_error
sec