增加操控端遥控功能,未测试

This commit is contained in:
2026-04-11 22:04:59 +08:00
parent 2b072c2b2c
commit 73a3bd5bbf
10 changed files with 464 additions and 15 deletions

View File

@@ -685,7 +685,40 @@ typedef union _UnComputerOutput
} UnComputerOutput;
/* 16通道遥控器数据结构体 - CMD_ID 0x0F */
#pragma pack(push, 1)
typedef struct {
uint16_t STX; // 帧起始标志固定为0x6655低字节在前实际存储为0x55 0x66
uint8_t CTRL; // 控制位bit0-need_ack(是否需要ack) bit1-ack_pack(是否为ack包) bit2-7-预留
uint16_t Data_len; // 数据域字节长度低字节在前此处固定为3216个通道×2字节
uint16_t SEQ; // 帧序列(0~65535),低字节在前
uint8_t CMD_ID; // 命令ID此处固定为0x0F
// 以下为DATA域对应偏移8开始长度=Data_len=32
int16_t CH1; // 通道1数据默认范围1050~1950
int16_t CH2; // 通道2数据默认范围1050~1950
int16_t CH3; // 通道3数据默认范围1050~1950
int16_t CH4; // 通道4数据默认范围1050~1950
int16_t CH5; // 通道5数据默认范围1050~1950
int16_t CH6; // 通道6数据默认范围1050~1950
int16_t CH7; // 通道7数据默认范围1050~1950
int16_t CH8; // 通道8数据默认范围1050~1950
int16_t CH9; // 通道9数据默认范围1050~1950
int16_t CH10; // 通道10数据默认范围1050~1950
int16_t CH11; // 通道11数据默认范围1050~1950
int16_t CH12; // 通道12数据默认范围1050~1950
int16_t CH13; // 通道13数据默认范围1050~1950
int16_t CH14; // 通道14数据默认范围1050~1950
int16_t CH15; // 通道15数据默认范围1050~1950
int16_t CH16; // 通道16数据默认范围1050~1950
uint16_t CRC16; // 整个数据包的CRC16校验低字节在前
} RemoteControl16ChFrame;
#pragma pack(pop)
/* 16通道遥控器数据完整通信帧联合体 - CMD_ID 0x0F */
typedef union {
RemoteControl16ChFrame frame; // 按结构体访问各字段
uint8_t data[41]; // 按字节数组访问总长度2+1+2+2+1+32+2 = 41字节
} RemoteControl16ChUnion;
// 车辆信息,输出给上位机
typedef struct _StrVehicleInfoOutput
@@ -950,7 +983,7 @@ extern UnGatherOutput un_gather_output;//采集模块输出
//串口
extern UnRemoteControlInput un_remote_control_input; //遥控器输入
extern UnRemoteControlInput un_remote_control_input_can ;//遥控器CAN输入
//IO口
extern UnSwSample un_sw_sample;
@@ -959,6 +992,8 @@ extern UnRequestFrame un_request_frame; //请求帧
extern UnComputerOutput un_computer_output; //输出给自主计算机
extern RemoteControl16ChUnion remote_control_16ch_output ;//16通道遥控器输出
//输出给上位机
extern UnVehicleInfoOutput un_vehicle_Info_output; // 车辆信息,输出给上位机
extern UnMotorStatusOutput un_motor_status_output; // 电机状态信息,输出给上位机