refactor(protocol): 移除上行帧 seq 字段,精简协议开销

BLE 链路层已有重传保序机制,应用层 seq 冗余且从未被接收端消费,
移除后 CoP 帧 18→17 字节、Encoder 帧 14→13 字节。
This commit is contained in:
2026-05-12 15:58:46 +08:00
parent cb758045f8
commit b72ea5334f
3 changed files with 20 additions and 27 deletions
+4 -6
View File
@@ -42,15 +42,14 @@
/* 总重低于此值时 CoP 无意义(除零保护),单位 kg */
#define COP_MIN_FORCE_THRESHOLD 0.5f
/* ─── 上行: CoP 帧 (18 bytes, 50 Hz) ───
/* ─── 上行: CoP 帧 (17 bytes, 50 Hz) ───
*
* [AA 55 01 seq flags cop_x(4) cop_y(4) force(4) crc]
* [AA 55 01 flags cop_x(4) cop_y(4) force(4) crc]
*/
struct cop_frame_t {
uint8_t sync0; /* = PROTO_SYNC0 */
uint8_t sync1; /* = PROTO_SYNC1 */
uint8_t type; /* = PROTO_TYPE_COP */
uint8_t seq; /* 包序号 0-255 滚动,用于丢包检测 */
uint8_t flags; /* bit0: force_valid */
float cop_x; /* 压力中心 X (mm),板面坐标系 */
float cop_y; /* 压力中心 Y (mm),板面坐标系 */
@@ -63,15 +62,14 @@ union cop_pkt_t {
uint8_t bytes[sizeof(struct cop_frame_t)];
};
/* ─── 上行: 电机编码器帧 (14 bytes, 预留) ───
/* ─── 上行: 电机编码器帧 (13 bytes, 预留) ───
*
* [AA 55 02 seq flags cable_length(4) velocity(4) crc]
* [AA 55 02 flags cable_length(4) velocity(4) crc]
*/
struct encoder_frame_t {
uint8_t sync0; /* = PROTO_SYNC0 */
uint8_t sync1; /* = PROTO_SYNC1 */
uint8_t type; /* = PROTO_TYPE_ENCODER */
uint8_t seq; /* 包序号 */
uint8_t flags; /* 预留,填 0 */
float cable_length; /* 拉索长度 (mm) */
float velocity; /* 拉索速度 (mm/s) */