update
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include <pthread.h> // 引入 pthread 库
|
||||
|
||||
// 宏定义
|
||||
#define USE_FEC
|
||||
// #define USE_FEC
|
||||
#ifdef USE_FEC
|
||||
#define FEC_SIZE 32 // 前向纠错冗余数据大小
|
||||
#else
|
||||
@@ -202,6 +202,8 @@ static PyObject *serial_send(PyObject *self, PyObject *args) {
|
||||
// 拷贝该帧对应数据段
|
||||
memcpy(send_buffer + HEADER_SIZE, data + offset, data_len);
|
||||
|
||||
printf("Received frame: seq=%d, len=%d\r\n", frame_counter, data_len);
|
||||
|
||||
// 计算 CRC32 校验和
|
||||
uint32_t crc = calculate_crc32(send_buffer, HEADER_SIZE + DATA_SIZE + FEC_SIZE);
|
||||
memcpy(send_buffer + HEADER_SIZE + DATA_SIZE + FEC_SIZE, &crc, CHECKSUM_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user