From 26bd22000b28819b858afe6fdd0bfcb0273a3459 Mon Sep 17 00:00:00 2001 From: shmily744 <1527550984@qq.com> Date: Mon, 13 May 2024 01:27:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=BE=E5=A6=99=E7=94=B5=E6=9C=BA=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E4=BD=BF=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/cmd/robot_cmd.c | 31 +- application/gimbal/gimbal.c | 8 +- modules/motor/DMmotor/DM4310.c | 9 +- modules/motor/DMmotor/DM4310.h | 2 +- modules/referee/referee_protocol.h | 482 ++++++++++++++--------------- 5 files changed, 268 insertions(+), 264 deletions(-) diff --git a/application/cmd/robot_cmd.c b/application/cmd/robot_cmd.c index ce02b92..d902dba 100644 --- a/application/cmd/robot_cmd.c +++ b/application/cmd/robot_cmd.c @@ -16,7 +16,7 @@ #include "bsp_log.h" // 私有宏,自动将编码器转换成角度值 -#define YAW_ALIGN_ANGLE 132.0f //(YAW_CHASSIS_ALIGN_ECD * ECD_ANGLE_COEF_DJI) // 对齐时的角度,0-360 +#define YAW_ALIGN_ANGLE 245.0f //(YAW_CHASSIS_ALIGN_ECD * ECD_ANGLE_COEF_DJI) // 对齐时的角度,0-360 #define PTICH_HORIZON_ANGLE (PITCH_HORIZON_ECD * ECD_ANGLE_COEF_DJI) // pitch水平时电机的角度,0-360 #define PITCH_SCAN -10.0f //扫描阶段PITCH固定角度 @@ -266,7 +266,7 @@ static void RemoteControlSet() { static uint8_t sentry_state; static void AutoControlSet() { - chassis_cmd_send.chassis_mode = CHASSIS_FOLLOW_GIMBAL_YAW; + chassis_cmd_send.chassis_mode = CHASSIS_ROTATE; chassis_cmd_send.vx = vision_recv_data->nav_vx; chassis_cmd_send.vy = vision_recv_data->nav_vy; @@ -383,7 +383,7 @@ uint8_t sentry_behave(); /* 机器人核心控制任务,200Hz频率运行(必须高于视觉发送频率) */ static uint8_t is_died; //死亡标志位 -static uint8_t enable_count; + void RobotCMDTask() { // 从其他应用获取回传数据 #ifdef ONE_BOARD @@ -398,10 +398,10 @@ void RobotCMDTask() { // 根据gimbal的反馈值计算云台和底盘正方向的夹角,不需要传参,通过static私有变量完成 CalcOffsetAngle(); - //gimbal_cmd_send.enable_motor = 0; - if(referee_data->GameRobotState.current_HP <= 4 ){ - is_died = 1; - } + //云台离线重新发送电机使能命令 +// if(referee_data->GameRobotState.power_management_gimbal_output == 0){ +// is_died = 1; +// } // if(is_died == 1 && referee_data->GameRobotState.current_HP > 4 ){ // is_died = 0; // DWT_Delay(0.08); @@ -416,13 +416,13 @@ void RobotCMDTask() { // enable_count = 0; // } - if(is_died == 1 && referee_data->GameRobotState.current_HP > 4 ){ - is_died = 0; - gimbal_cmd_send.enable_motor = 500; - } - if(gimbal_cmd_send.enable_motor >0){ - gimbal_cmd_send.enable_motor--; - } +// if(is_died == 1 && referee_data->GameRobotState.power_management_gimbal_output ){ +// is_died = 0; +// gimbal_cmd_send.enable_motor = 00; +// } +// if(gimbal_cmd_send.enable_motor >0 && referee_data->GameRobotState.power_management_gimbal_output){ +// gimbal_cmd_send.enable_motor--; +// } // 根据遥控器左侧开关,确定当前使用的控制模式为遥控器调试还是键鼠 static control_mode_e last_gimbal_mode = 0; @@ -510,8 +510,7 @@ uint8_t sentry_behave() { } else if (referee_data->GameState.game_progress == 5) behave_flag = 4; - if (referee_data->GameRobotState.current_HP < 200 && referee_data->GameState.stage_remain_time >= 60 && - recover_cnt <= 1) { + if (referee_data->GameRobotState.current_HP < 200 && referee_data->GameState.stage_remain_time >= 60 ) { behave_flag = 9; } diff --git a/application/gimbal/gimbal.c b/application/gimbal/gimbal.c index 446e106..989f555 100644 --- a/application/gimbal/gimbal.c +++ b/application/gimbal/gimbal.c @@ -176,10 +176,10 @@ void GimbalTask() // 后续增加未收到数据的处理 SubGetMessage(gimbal_sub, &gimbal_cmd_recv); SubGetMessage(chassis_sub, &chassis_cmd_recv); - if(gimbal_cmd_recv.enable_motor > 0){ - LOGINFO("enabling DMmoter"); - DMMotorSetMode(DM_CMD_MOTOR_MODE, big_yaw_motor); - } +// if(gimbal_cmd_recv.enable_motor > 0){ +// LOGINFO("enabling DMmoter"); +// DMMotorSetMode(DM_CMD_MOTOR_MODE, big_yaw_motor); +// } //gimbal_cmd_recv.big_yaw = 0; diff --git a/modules/motor/DMmotor/DM4310.c b/modules/motor/DMmotor/DM4310.c index 3e9424e..32ec6ff 100644 --- a/modules/motor/DMmotor/DM4310.c +++ b/modules/motor/DMmotor/DM4310.c @@ -39,11 +39,16 @@ static void DMMotorDecode(CANInstance *motor_can) DMMotorInstance *motor = (DMMotorInstance *)motor_can->id; DM_Motor_Measure_s *measure = &(motor->measure); // 将can实例中保存的id转换成电机实例的指针 - DaemonReload(motor->motor_daemon); + //DaemonReload(motor->motor_daemon); measure->last_position = measure->position; + //0 失能 1 使能 8 超压 9 欠压 A 过流 B MOS过压 C 电机线圈过温 D 通信丢失 E 过载 + tmp = (uint8_t)(rxbuff[0]>>4); + measure->state = tmp; - measure->state = 0; + if(measure->state){ + DaemonReload(motor->motor_daemon); + } tmp = (uint16_t)((rxbuff[1] << 8) | rxbuff[2]); measure->position = uint_to_float(tmp, DM_P_MIN, DM_P_MAX, 16); diff --git a/modules/motor/DMmotor/DM4310.h b/modules/motor/DMmotor/DM4310.h index 8050ad3..2cd9fb3 100644 --- a/modules/motor/DMmotor/DM4310.h +++ b/modules/motor/DMmotor/DM4310.h @@ -19,7 +19,7 @@ typedef struct { uint8_t id; - uint8_t state; + uint8_t state; // float velocity; //速度 float last_position; //上次位置 float position; //位置 diff --git a/modules/referee/referee_protocol.h b/modules/referee/referee_protocol.h index 496bf52..a885f36 100644 --- a/modules/referee/referee_protocol.h +++ b/modules/referee/referee_protocol.h @@ -25,142 +25,137 @@ /****************************通信协议格式****************************/ /* 通信协议格式偏移,枚举类型,代替#define声明 */ -typedef enum -{ - FRAME_HEADER_Offset = 0, - CMD_ID_Offset = 5, - DATA_Offset = 7, +typedef enum { + FRAME_HEADER_Offset = 0, + CMD_ID_Offset = 5, + DATA_Offset = 7, } JudgeFrameOffset_e; /* 通信协议长度 */ -typedef enum -{ - LEN_HEADER = 5, // 帧头长 - LEN_CMDID = 2, // 命令码长度 - LEN_TAIL = 2, // 帧尾CRC16 +typedef enum { + LEN_HEADER = 5, // 帧头长 + LEN_CMDID = 2, // 命令码长度 + LEN_TAIL = 2, // 帧尾CRC16 - LEN_CRC8 = 4, // 帧头CRC8校验长度=帧头+数据长+包序号 + LEN_CRC8 = 4, // 帧头CRC8校验长度=帧头+数据长+包序号 } JudgeFrameLength_e; /****************************帧头****************************/ /****************************帧头****************************/ /* 帧头偏移 */ -typedef enum -{ - SOF = 0, // 起始位 - DATA_LENGTH = 1, // 帧内数据长度,根据这个来获取数据长度 - SEQ = 3, // 包序号 - CRC8 = 4 // CRC8 +typedef enum { + SOF = 0, // 起始位 + DATA_LENGTH = 1, // 帧内数据长度,根据这个来获取数据长度 + SEQ = 3, // 包序号 + CRC8 = 4 // CRC8 } FrameHeaderOffset_e; /* 帧头定义 */ -typedef struct -{ - uint8_t SOF; - uint16_t DataLength; - uint8_t Seq; - uint8_t CRC8; +typedef struct { + uint8_t SOF; + uint16_t DataLength; + uint8_t Seq; + uint8_t CRC8; } xFrameHeader; /****************************cmd_id命令码说明****************************/ /****************************cmd_id命令码说明****************************/ - +// V1.6.1 裁判系统串口协议 /* 命令码ID,用来判断接收的是什么数据 */ -typedef enum -{ - ID_game_state = 0x0001, // 比赛状态数据 - ID_game_result = 0x0002, // 比赛结果数据 - ID_game_robot_survivors = 0x0003, // 比赛机器人血量数据 - ID_event_data = 0x0101, // 场地事件数据 - ID_supply_projectile_action = 0x0102, // 场地补给站动作标识数据 - ID_supply_projectile_booking = 0x0103, // 场地补给站预约子弹数据 - ID_game_robot_state = 0x0201, // 机器人状态数据 - ID_power_heat_data = 0x0202, // 实时功率热量数据 - ID_game_robot_pos = 0x0203, // 机器人位置数据 - ID_buff_musk = 0x0204, // 机器人增益数据 - ID_aerial_robot_energy = 0x0205, // 空中机器人能量状态数据 - ID_robot_hurt = 0x0206, // 伤害状态数据 - ID_shoot_data = 0x0207, // 实时射击数据 - ID_student_interactive = 0x0301, // 机器人间交互数据 +typedef enum { + ID_game_state = 0x0001, // 比赛状态数据 + ID_game_result = 0x0002, // 比赛结果数据 + ID_game_robot_survivors = 0x0003, // 比赛机器人血量数据 + ID_event_data = 0x0101, // 场地事件数据 + ID_supply_projectile_action = 0x0102, // 场地补给站动作标识数据 + ID_supply_projectile_booking = 0x0103, // 场地补给站预约子弹数据 + ID_game_robot_state = 0x0201, // 机器人状态数据 + ID_power_heat_data = 0x0202, // 实时功率热量数据 + ID_game_robot_pos = 0x0203, // 机器人位置数据 + ID_buff_musk = 0x0204, // 机器人增益数据 + ID_aerial_robot_energy = 0x0205, // 空中机器人能量状态数据 + ID_robot_hurt = 0x0206, // 伤害状态数据 + ID_shoot_data = 0x0207, // 实时射击数据 + ID_sentry_info = 0x020D, // 哨兵兑换发弹量、血量信息 + ID_student_interactive = 0x0301, // 机器人间交互数据 + ID_custom_robot = 0x302, // 自定义控制器数据(图传链路) + ID_map_command = 0x0303, // 选手端小地图交互数据 + ID_remote_control = 0x304, // 键鼠遥控数据(图传链路) + ID_sender_id = 0x0307, // 选手端小地图接收哨兵数据 } CmdID_e; /* 命令码数据段长,根据官方协议来定义长度,还有自定义数据长度 */ -typedef enum -{ - LEN_game_state = 3, // 0x0001 - LEN_game_result = 1, // 0x0002 - LEN_game_robot_HP = 2, // 0x0003 - LEN_event_data = 4, // 0x0101 - LEN_supply_projectile_action = 4, // 0x0102 - LEN_game_robot_state = 27, // 0x0201 - LEN_power_heat_data = 14, // 0x0202 - LEN_game_robot_pos = 16, // 0x0203 - LEN_buff_musk = 1, // 0x0204 - LEN_aerial_robot_energy = 1, // 0x0205 - LEN_robot_hurt = 1, // 0x0206 - LEN_shoot_data = 7, // 0x0207 - LEN_receive_data = 6 + Communicate_Data_LEN, // 0x0301 +typedef enum { + LEN_game_state = 11, // 0x0001 + LEN_game_result = 1, // 0x0002 + LEN_game_robot_HP = 32, // 0x0003 + LEN_event_data = 4, // 0x0101 + LEN_supply_projectile_action = 4, // 0x0102 + LEN_game_robot_state = 13, // 0x0201 + LEN_power_heat_data = 16, // 0x0202 + LEN_game_robot_pos = 16, // 0x0203 + LEN_buff_musk = 6, // 0x0204 + LEN_aerial_robot_energy = 2, // 0x0205 + LEN_robot_hurt = 1, // 0x0206 + LEN_shoot_data = 7, // 0x0207 + LEN_receive_data = 6 + Communicate_Data_LEN, // 0x0301 + LEN__custom_robot = 30, // 0x0302 + LEN_remote_control = 12, // 0x0304 } JudgeDataLength_e; /****************************接收数据的详细说明****************************/ /****************************接收数据的详细说明****************************/ -/* ID: 0x0001 Byte: 3 V1.6.1 比赛状态数据 */ -typedef struct -{ - uint8_t game_type : 4; - uint8_t game_progress : 4; - uint16_t stage_remain_time; - uint64_t SyncTimeStamp; +/* ID: 0x0001 Byte: 3 比赛状态数据 */ +typedef struct { + uint8_t game_type: 4; + uint8_t game_progress: 4; + uint16_t stage_remain_time; + uint64_t SyncTimeStamp; } ext_game_state_t; /* ID: 0x0002 Byte: 1 比赛结果数据 */ -typedef struct -{ - uint8_t winner; +typedef struct { + uint8_t winner; } ext_game_result_t; /* ID: 0x0003 Byte: 32 比赛机器人血量数据 */ -typedef struct -{ - uint16_t red_1_robot_HP; - uint16_t red_2_robot_HP; - uint16_t red_3_robot_HP; - uint16_t red_4_robot_HP; - uint16_t red_5_robot_HP; - uint16_t red_7_robot_HP; - uint16_t red_outpost_HP; - uint16_t red_base_HP; - uint16_t blue_1_robot_HP; - uint16_t blue_2_robot_HP; - uint16_t blue_3_robot_HP; - uint16_t blue_4_robot_HP; - uint16_t blue_5_robot_HP; - uint16_t blue_7_robot_HP; - uint16_t blue_outpost_HP; - uint16_t blue_base_HP; +typedef struct { + uint16_t red_1_robot_HP; + uint16_t red_2_robot_HP; + uint16_t red_3_robot_HP; + uint16_t red_4_robot_HP; + uint16_t red_5_robot_HP; + uint16_t red_7_robot_HP; + uint16_t red_outpost_HP; + uint16_t red_base_HP; + uint16_t blue_1_robot_HP; + uint16_t blue_2_robot_HP; + uint16_t blue_3_robot_HP; + uint16_t blue_4_robot_HP; + uint16_t blue_5_robot_HP; + uint16_t blue_7_robot_HP; + uint16_t blue_outpost_HP; + uint16_t blue_base_HP; } ext_game_robot_HP_t; /* ID: 0x0101 Byte: 4 场地事件数据 */ -typedef struct -{ - uint32_t event_type; +typedef struct { + uint32_t event_type; } ext_event_data_t; -/* ID: 0x0102 Byte: 3 场地补给站动作标识数据 */ -typedef struct -{ - uint8_t supply_projectile_id; - uint8_t supply_robot_id; - uint8_t supply_projectile_step; - uint8_t supply_projectile_num; +/* ID: 0x0102 Byte: 4 场地补给站动作标识数据 */ +typedef struct { + uint8_t supply_projectile_id; + uint8_t supply_robot_id; + uint8_t supply_projectile_step; + uint8_t supply_projectile_num; } ext_supply_projectile_action_t; -/* ID: 0X0201 Byte: 27 V1.6.1 机器人性能体系数据 */ -typedef struct -{ +/* ID: 0X0201 Byte: 13 机器人性能体系数据 */ +typedef struct { uint8_t robot_id; uint8_t robot_level; uint16_t current_HP; @@ -169,14 +164,13 @@ typedef struct uint16_t shooter_barrel_heat_limit; uint16_t chassis_power_limit; - uint8_t power_management_gimbal_output : 1; - uint8_t power_management_chassis_output : 1; - uint8_t power_management_shooter_output : 1; + uint8_t power_management_gimbal_output: 1; + uint8_t power_management_chassis_output: 1; + uint8_t power_management_shooter_output: 1; } ext_game_robot_state_t; -/* ID: 0X0202 Byte: 14 V1.6.1 实时功率热量数据 */ -typedef struct -{ +/* ID: 0X0202 Byte: 16 实时功率热量数据 */ +typedef struct { uint16_t chassis_voltage; uint16_t chassis_current; float chassis_power; @@ -187,106 +181,122 @@ typedef struct } ext_power_heat_data_t; /* ID: 0x0203 Byte: 16 机器人位置数据 */ -typedef struct -{ - float x; - float y; - float z; - float yaw; +typedef struct { + float x; + float y; + float z; + float yaw; } ext_game_robot_pos_t; -/* ID: 0x0204 Byte: 1 机器人增益数据 */ -typedef struct -{ - uint8_t power_rune_buff; +/* ID: 0x0204 Byte: 6 机器人增益数据 */ +typedef struct { + uint8_t recovery_buff; + uint8_t cooling_buff; + uint8_t defence_buff; + uint8_t vulnerability_buff; + uint16_t attack_buff; + uint8_t power_rune_buff; } ext_buff_musk_t; -/* ID: 0x0205 Byte: 1 空中机器人能量状态数据 */ -typedef struct -{ - uint8_t attack_time; +/* ID: 0x0205 Byte: 2 空中机器人能量状态数据 */ +typedef struct { + uint8_t airforce_status; + uint8_t time_remain; } aerial_robot_energy_t; /* ID: 0x0206 Byte: 1 伤害状态数据 */ -typedef struct -{ - uint8_t armor_id : 4; - uint8_t hurt_type : 4; +typedef struct { + uint8_t armor_id: 4; + uint8_t hurt_type: 4; } ext_robot_hurt_t; /* ID: 0x0207 Byte: 7 实时射击数据 */ +typedef struct { + uint8_t bullet_type; + uint8_t shooter_id; + uint8_t bullet_freq; + float bullet_speed; +} ext_shoot_data_t; + +/* ID: 0x020D Byte: 4 哨兵决策数据 */ typedef struct { - uint8_t bullet_type; - uint8_t shooter_id; - uint8_t bullet_freq; - float bullet_speed; -} ext_shoot_data_t; + uint32_t sentry_info; +} ext_sentry_info_t; + +/****************************图传链路数据****************************/ +/* ID: 0x0304 Byte: 12 图传链路键鼠遥控数据 */ +typedef struct { + int16_t mouse_x; + int16_t mouse_y; + int16_t mouse_z; + int8_t left_button_down; + int8_t right_button_down; + uint16_t keyboard_value; + uint16_t reserved; +} vision_transfer_t; +/****************************图传链路数据****************************/ /****************************机器人交互数据****************************/ /****************************机器人交互数据****************************/ /* 发送的内容数据段最大为 113 检测是否超出大小限制?实际上图形段不会超,数据段最多30个,也不会超*/ /* 交互数据头结构 */ -typedef struct -{ - uint16_t data_cmd_id; // 由于存在多个内容 ID,但整个cmd_id 上行频率最大为 10Hz,请合理安排带宽。注意交互部分的上行频率 - uint16_t sender_ID; - uint16_t receiver_ID; +typedef struct { + uint16_t data_cmd_id; // 由于存在多个内容 ID,但整个cmd_id 上行频率最大为 10Hz,请合理安排带宽。注意交互部分的上行频率 + uint16_t sender_ID; + uint16_t receiver_ID; } ext_student_interactive_header_data_t; /* 机器人id */ -typedef enum -{ - // 红方机器人ID - RobotID_RHero = 1, - RobotID_REngineer = 2, - RobotID_RStandard1 = 3, - RobotID_RStandard2 = 4, - RobotID_RStandard3 = 5, - RobotID_RAerial = 6, - RobotID_RSentry = 7, - RobotID_RRadar = 9, - // 蓝方机器人ID - RobotID_BHero = 101, - RobotID_BEngineer = 102, - RobotID_BStandard1 = 103, - RobotID_BStandard2 = 104, - RobotID_BStandard3 = 105, - RobotID_BAerial = 106, - RobotID_BSentry = 107, - RobotID_BRadar = 109, +typedef enum { + // 红方机器人ID + RobotID_RHero = 1, + RobotID_REngineer = 2, + RobotID_RStandard1 = 3, + RobotID_RStandard2 = 4, + RobotID_RStandard3 = 5, + RobotID_RAerial = 6, + RobotID_RSentry = 7, + RobotID_RRadar = 9, + // 蓝方机器人ID + RobotID_BHero = 101, + RobotID_BEngineer = 102, + RobotID_BStandard1 = 103, + RobotID_BStandard2 = 104, + RobotID_BStandard3 = 105, + RobotID_BAerial = 106, + RobotID_BSentry = 107, + RobotID_BRadar = 109, //裁判系统服务器ID 用于哨兵和雷达自主决策 RobotID_Referee = 0x8080, } Robot_ID_e; /* 交互数据ID */ -typedef enum -{ - UI_Data_ID_Del = 0x100, - UI_Data_ID_Draw1 = 0x101, - UI_Data_ID_Draw2 = 0x102, - UI_Data_ID_Draw5 = 0x103, - UI_Data_ID_Draw7 = 0x104, - UI_Data_ID_DrawChar = 0x110, +typedef enum { + UI_Data_ID_Del = 0x100, + UI_Data_ID_Draw1 = 0x101, + UI_Data_ID_Draw2 = 0x102, + UI_Data_ID_Draw5 = 0x103, + UI_Data_ID_Draw7 = 0x104, + UI_Data_ID_DrawChar = 0x110, - /* 自定义交互数据部分 */ - Communicate_Data_ID = 0x0200, + /* 自定义交互数据部分 */ + Communicate_Data_ID = 0x0200, // 哨兵雷达自主决策部分 Sentry_Decision_ID = 0x0120, Radar_Decision_ID = 0x0121, } Interactive_Data_ID_e; /* 交互数据长度 */ -typedef enum -{ - Interactive_Data_LEN_Head = 6, - UI_Operate_LEN_Del = 2, - UI_Operate_LEN_PerDraw = 15, - UI_Operate_LEN_DrawChar = 15 + 30, +typedef enum { + Interactive_Data_LEN_Head = 6, + UI_Operate_LEN_Del = 2, + UI_Operate_LEN_PerDraw = 15, + UI_Operate_LEN_DrawChar = 15 + 30, - /* 自定义交互数据部分 */ - // Communicate_Data_LEN = 5, + /* 自定义交互数据部分 */ + // Communicate_Data_LEN = 5, Sentry_Decision_LEN = 4, Radar_Decision_LEN = 1, @@ -299,108 +309,98 @@ typedef enum 发送频率:上限 10Hz */ // 自定义交互数据协议,可更改,更改后需要修改最上方宏定义数据长度的值 -typedef struct -{ - uint8_t data[Communicate_Data_LEN]; // 数据段,n需要小于113 +typedef struct { + uint8_t data[Communicate_Data_LEN]; // 数据段,n需要小于113 } robot_interactive_data_t; // 机器人交互信息_发送 -typedef struct -{ - xFrameHeader FrameHeader; - uint16_t CmdID; - ext_student_interactive_header_data_t datahead; - robot_interactive_data_t Data; // 数据段 - uint16_t frametail; +typedef struct { + xFrameHeader FrameHeader; + uint16_t CmdID; + ext_student_interactive_header_data_t datahead; + robot_interactive_data_t Data; // 数据段 + uint16_t frametail; } Communicate_SendData_t; // 机器人交互信息_接收 -typedef struct -{ - ext_student_interactive_header_data_t datahead; - robot_interactive_data_t Data; // 数据段 +typedef struct { + ext_student_interactive_header_data_t datahead; + robot_interactive_data_t Data; // 数据段 } Communicate_ReceiveData_t; // 哨兵决策数据 -typedef struct -{ - uint32_t reborn:1; // 读条确认复活 - uint32_t reborn_now:1; // 买活 - uint32_t buy_bullet:11; +typedef struct { + uint32_t reborn: 1; // 读条确认复活 + uint32_t reborn_now: 1; // 买活 + uint32_t buy_bullet: 11; // 购买弹丸数量 开局为0,修改此值后,哨兵在补血点即可兑换允许发弹量。此值的变化需要单调递增,否则视为不合法。 - uint32_t remote_bullet:4; + uint32_t remote_bullet: 4; //哨兵远程兑换发弹量的请求次数,开局为0,修改此值即可请求远程兑换发弹量。此值的变化需要单调递增且每次仅能增加1,否则视为不合法。 - uint32_t remote_HP:4; + uint32_t remote_HP: 4; //哨兵远程兑换血量的请求次数,开局为0,修改此值即可请求远程兑换血量。此值的变化需要单调递增且每次仅能增加1,否则视为不合法。 - uint32_t reserve:11; -}Sentry_Decision_Data_t; + uint32_t reserve: 11; +} Sentry_Decision_Data_t; //在哨兵发送该子命令时,服务器将按照从相对低位到相对高位的原则依次处理这些指令,直至全部成功或不能处理为止。 /****************************UI交互数据****************************/ /* 图形数据 */ -typedef struct -{ - uint8_t graphic_name[3]; - uint32_t operate_tpye : 3; - uint32_t graphic_tpye : 3; - uint32_t layer : 4; - uint32_t color : 4; - uint32_t start_angle : 9; - uint32_t end_angle : 9; - uint32_t width : 10; - uint32_t start_x : 11; - uint32_t start_y : 11; - uint32_t radius : 10; - uint32_t end_x : 11; - uint32_t end_y : 11; +typedef struct { + uint8_t graphic_name[3]; + uint32_t operate_tpye: 3; + uint32_t graphic_tpye: 3; + uint32_t layer: 4; + uint32_t color: 4; + uint32_t start_angle: 9; + uint32_t end_angle: 9; + uint32_t width: 10; + uint32_t start_x: 11; + uint32_t start_y: 11; + uint32_t radius: 10; + uint32_t end_x: 11; + uint32_t end_y: 11; } Graph_Data_t; -typedef struct -{ - Graph_Data_t Graph_Control; - uint8_t show_Data[30]; +typedef struct { + Graph_Data_t Graph_Control; + uint8_t show_Data[30]; } String_Data_t; // 打印字符串数据 /* 删除操作 */ -typedef enum -{ - UI_Data_Del_NoOperate = 0, - UI_Data_Del_Layer = 1, - UI_Data_Del_ALL = 2, // 删除全部图层,后面的参数已经不重要了。 +typedef enum { + UI_Data_Del_NoOperate = 0, + UI_Data_Del_Layer = 1, + UI_Data_Del_ALL = 2, // 删除全部图层,后面的参数已经不重要了。 } UI_Delete_Operate_e; /* 图形配置参数__图形操作 */ -typedef enum -{ - UI_Graph_ADD = 1, - UI_Graph_Change = 2, - UI_Graph_Del = 3, +typedef enum { + UI_Graph_ADD = 1, + UI_Graph_Change = 2, + UI_Graph_Del = 3, } UI_Graph_Operate_e; /* 图形配置参数__图形类型 */ -typedef enum -{ - UI_Graph_Line = 0, // 直线 - UI_Graph_Rectangle = 1, // 矩形 - UI_Graph_Circle = 2, // 整圆 - UI_Graph_Ellipse = 3, // 椭圆 - UI_Graph_Arc = 4, // 圆弧 - UI_Graph_Float = 5, // 浮点型 - UI_Graph_Int = 6, // 整形 - UI_Graph_Char = 7, // 字符型 +typedef enum { + UI_Graph_Line = 0, // 直线 + UI_Graph_Rectangle = 1, // 矩形 + UI_Graph_Circle = 2, // 整圆 + UI_Graph_Ellipse = 3, // 椭圆 + UI_Graph_Arc = 4, // 圆弧 + UI_Graph_Float = 5, // 浮点型 + UI_Graph_Int = 6, // 整形 + UI_Graph_Char = 7, // 字符型 } UI_Graph_Type_e; /* 图形配置参数__图形颜色 */ -typedef enum -{ - UI_Color_Main = 0, // 红蓝主色 - UI_Color_Yellow = 1, - UI_Color_Green = 2, - UI_Color_Orange = 3, - UI_Color_Purplish_red = 4, // 紫红色 - UI_Color_Pink = 5, - UI_Color_Cyan = 6, // 青色 - UI_Color_Black = 7, - UI_Color_White = 8, +typedef enum { + UI_Color_Main = 0, // 红蓝主色 + UI_Color_Yellow = 1, + UI_Color_Green = 2, + UI_Color_Orange = 3, + UI_Color_Purplish_red = 4, // 紫红色 + UI_Color_Pink = 5, + UI_Color_Cyan = 6, // 青色 + UI_Color_Black = 7, + UI_Color_White = 8, } UI_Graph_Color_e;