M17 - Do not include Data Type Byte in PKT CRC;

This commit is contained in:
lwvmobile
2024-03-12 17:48:58 -04:00
parent 114d8d7dfc
commit 296775d231

View File

@@ -2527,7 +2527,7 @@ void encodeM17PKT(dsd_opts * opts, dsd_state * state)
if (m17_p1_packed[x] == 0) break; //stop at the termination byte if (m17_p1_packed[x] == 0) break; //stop at the termination byte
x++; x++;
} }
crc_cmp = crc16m17(m17_p1_packed, x); crc_cmp = crc16m17(m17_p1_packed+1, x-1);
//debug dump CRC (when pad is literally zero) //debug dump CRC (when pad is literally zero)
fprintf (stderr, " X: %d; LAST: %02X; TERM: %02X; CRC: %04X", x, m17_p1_packed[x-1], m17_p1_packed[x], crc_cmp); fprintf (stderr, " X: %d; LAST: %02X; TERM: %02X; CRC: %04X", x, m17_p1_packed[x-1], m17_p1_packed[x], crc_cmp);
@@ -2823,7 +2823,7 @@ void processM17PKT(dsd_opts * opts, dsd_state * state)
if (eot) if (eot)
{ {
//do a CRC check //do a CRC check
uint16_t crc_cmp = crc16m17(state->m17_pkt, total); uint16_t crc_cmp = crc16m17(state->m17_pkt+1, total-1);
uint16_t crc_ext = (state->m17_pkt[end-2] << 8) + state->m17_pkt[end-1]; uint16_t crc_ext = (state->m17_pkt[end-2] << 8) + state->m17_pkt[end-1];
if (crc_cmp == crc_ext) if (crc_cmp == crc_ext)