feat(gml670x4): 所有协议帧添加 CRC-8/MAXIM 校验

使用 Zephyr crc8() 对帧头之后的载荷计算 CRC,上行发送前填充、
下行接收时校验不通过则丢弃并告警。同步更新协议文档。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 14:38:28 +08:00
parent 0d2fd30b3a
commit dc525ea4e7
6 changed files with 61 additions and 29 deletions
+1
View File
@@ -163,6 +163,7 @@ static void sensor_thread_fn(void *p1, void *p2, void *p3) {
pkt.frame.cop_x = cop_x;
pkt.frame.cop_y = cop_y;
pkt.frame.force = force;
pkt.frame.crc = crc8(pkt.bytes + 2, sizeof(pkt.bytes) - 3, 0x31, 0x00, true);
/* 发送 */
ble_transport_send(pkt.bytes, sizeof(pkt.bytes));