裁判系统发送重构前提交
This commit is contained in:
parent
11b401c2bc
commit
7bb41c56b7
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": []
|
||||
}
|
|
@ -3,10 +3,10 @@
|
|||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build task", // 任务标签
|
||||
"type": "shell", // 任务类型,因为要调用mingw32-make,是在终端(CMD)里运行的,所以是shell任务
|
||||
"command": "mingw32-make -j24",// 任务命令,线程数可以根据自己的电脑修改,建议为核数的4~8倍
|
||||
"problemMatcher": [],
|
||||
"label": "build task",
|
||||
"type": "shell",
|
||||
"command": "mingw32-make -j24",
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
|
@ -14,21 +14,21 @@
|
|||
},
|
||||
{
|
||||
"label": "download dap",
|
||||
"type": "shell", // 如果希望在下载前编译,可以把command换成下面的命令
|
||||
"command":"mingw32-make download_dap", // "mingw32-make -j24 && mingw32-make download_dap",
|
||||
"group": { // 如果没有修改代码,编译任务不会消耗时间,因此推荐使用上面的替换.
|
||||
"type": "shell",
|
||||
"command": "mingw32-make download_dap",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false,
|
||||
},
|
||||
"isDefault": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "download jlink",
|
||||
"type": "shell",
|
||||
"command":"mingw32-make download_jlink", // "mingw32-make -j24 && mingw32-make download_dap"
|
||||
"command": "mingw32-make download_jlink",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false,
|
||||
"isDefault": false
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
#include "referee_communication.h"
|
||||
|
||||
static Referee_Interactive_info_t Interactive_data; // 非裁判系统数据
|
||||
static referee_info_t *referee_data; // 裁判系统相关数据
|
||||
static referee_info_t *referee_data; // 裁判系统相关数据
|
||||
static robot_interactive_data_t *SendData;
|
||||
|
||||
static void determine_ID(referee_info_t *_referee_info);
|
||||
|
@ -23,25 +23,26 @@ static void My_UI_init(referee_info_t *_referee_info);
|
|||
static void My_UI_Refresh(referee_info_t *_referee_info, Referee_Interactive_info_t *_Interactive_data);
|
||||
static void Mode_Change_Check(Referee_Interactive_info_t *_Interactive_data); // 模式切换检测
|
||||
|
||||
//syhtod 正式上车后需删除
|
||||
// syhtod 正式上车后需删除
|
||||
static void robot_mode_change(Referee_Interactive_info_t *_Interactive_data); // 测试用函数,实现模式自动变化
|
||||
static void UI_test_init(referee_info_t *_referee_info);//UI测试函数
|
||||
static void UI_test_init(referee_info_t *_referee_info); // UI测试函数
|
||||
|
||||
void Referee_Interactive_init()
|
||||
{
|
||||
referee_data = RefereeInit(&huart6); // 裁判系统初始化
|
||||
while (referee_data->GameRobotState.robot_id == 0)
|
||||
;
|
||||
// while (referee_data->GameRobotState.robot_id == 0);
|
||||
referee_data->GameRobotState.robot_id = 101; // syhtodo RobotInit中关闭了中断进行初始化,无法读取到裁判系统的ID,暂时在此处写死
|
||||
determine_ID(referee_data);
|
||||
My_UI_init(referee_data);
|
||||
//UI_test_init(referee_data);
|
||||
// My_UI_init(referee_data);
|
||||
UI_test_init(referee_data); // syhtodo此处先使用测试函数
|
||||
|
||||
for (int i=0;i<Communicate_Data_LEN;i++)
|
||||
{
|
||||
SendData->data[i]=i+1;
|
||||
}
|
||||
referee_data->referee_id.Receiver_Robot_ID = RobotID_BEngineer; // 机器人车间通信时接收者的ID暂时发给蓝色2
|
||||
Communicate_SendData(&referee_data->referee_id,SendData);
|
||||
// syhtodo此处先关闭机器人车间通信
|
||||
// for (int i=0;i<Communicate_Data_LEN;i++)
|
||||
// {
|
||||
// SendData->data[i]=i+1;
|
||||
// }
|
||||
// referee_data->referee_id.Receiver_Robot_ID = RobotID_BEngineer; // 机器人车间通信时接收者的ID暂时发给蓝色2
|
||||
// Communicate_SendData(&referee_data->referee_id,SendData);
|
||||
}
|
||||
|
||||
void Referee_Interactive_task()
|
||||
|
@ -305,7 +306,6 @@ static void My_UI_Refresh(referee_info_t *_referee_info, Referee_Interactive_inf
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 模式切换检测,模式发生切换时,对flag置位
|
||||
* @param Referee_Interactive_info_t *_Interactive_data
|
||||
|
@ -357,29 +357,28 @@ static void determine_ID(referee_info_t *_referee_info)
|
|||
_referee_info->referee_id.Robot_Color = _referee_info->GameRobotState.robot_id > 7 ? Robot_Blue : Robot_Red;
|
||||
_referee_info->referee_id.Robot_ID = _referee_info->GameRobotState.robot_id;
|
||||
_referee_info->referee_id.Cilent_ID = 0x0100 + _referee_info->referee_id.Robot_ID; // 计算客户端ID
|
||||
_referee_info->referee_id.Receiver_Robot_ID = 0;
|
||||
_referee_info->referee_id.Receiver_Robot_ID = 0;
|
||||
}
|
||||
|
||||
/* 测试用函数 */
|
||||
static void UI_test_init(referee_info_t *_referee_info)
|
||||
{
|
||||
Graph_Data_t graph[5];
|
||||
Graph_Data_t num[2];
|
||||
String_Data_t sdata[1];
|
||||
Graph_Data_t num[2];
|
||||
String_Data_t sdata[1];
|
||||
UI_Delete(&_referee_info->referee_id, UI_Data_Del_ALL, 0);
|
||||
|
||||
Line_Draw(&graph[0],"s0",UI_Graph_ADD,0,UI_Color_White,3,710,540,1210,540);
|
||||
Rectangle_Draw(&graph[1],"s1",UI_Graph_ADD,0,UI_Color_Yellow,4,600,200,800,500);
|
||||
Circle_Draw(&graph[2],"s2",UI_Graph_ADD,0,UI_Color_Green,5,960,540,100);
|
||||
Elliptical_Draw(&graph[3],"s3",UI_Graph_ADD,0,UI_Color_Orange,3,960,540,100,20);
|
||||
Arc_Draw(&graph[4],"s4",UI_Graph_ADD,0,UI_Color_Purplish_red,30,160,3,1200,550,50,100);
|
||||
Line_Draw(&graph[0], "s0", UI_Graph_ADD, 0, UI_Color_White, 3, 710, 540, 1210, 540);
|
||||
Rectangle_Draw(&graph[1], "s1", UI_Graph_ADD, 0, UI_Color_Yellow, 4, 600, 200, 800, 500);
|
||||
Circle_Draw(&graph[2], "s2", UI_Graph_ADD, 0, UI_Color_Green, 5, 960, 540, 100);
|
||||
Elliptical_Draw(&graph[3], "s3", UI_Graph_ADD, 0, UI_Color_Orange, 3, 960, 540, 100, 20);
|
||||
Arc_Draw(&graph[4], "s4", UI_Graph_ADD, 0, UI_Color_Purplish_red, 30, 160, 3, 1200, 550, 50, 100);
|
||||
|
||||
Float_Draw(&num[0],"s5",UI_Graph_ADD,0,UI_Color_Pink,50,3,5,1050,660,1245545);
|
||||
Integer_Draw(&num[1],"s6",UI_Graph_ADD,0,UI_Color_Cyan,50,5,1050,460,12345);
|
||||
UI_ReFresh(&_referee_info->referee_id,7,graph[0],graph[1],graph[2],graph[3],graph[4],num[0],num[1]);
|
||||
Float_Draw(&num[0], "s5", UI_Graph_ADD, 0, UI_Color_Pink, 50, 3, 5, 1050, 660, 1245545);
|
||||
Integer_Draw(&num[1], "s6", UI_Graph_ADD, 0, UI_Color_Cyan, 50, 5, 1050, 460, 12345);
|
||||
UI_ReFresh(&_referee_info->referee_id, 7, graph[0], graph[1], graph[2], graph[3], graph[4], num[0], num[1]);
|
||||
|
||||
|
||||
Char_Draw(&sdata[0],"s7",UI_Graph_ADD,0,UI_Color_Green,20,2,620,710);
|
||||
Char_Write(&sdata[0],"number:%d",123);
|
||||
Char_ReFresh(&_referee_info->referee_id,sdata[0]);
|
||||
Char_Draw(&sdata[0], "s7", UI_Graph_ADD, 0, UI_Color_Green, 20, 2, 620, 710);
|
||||
Char_Write(&sdata[0], "number:%d", 123);
|
||||
Char_ReFresh(&_referee_info->referee_id, sdata[0]);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,6 @@ void RobotTask()
|
|||
|
||||
#if defined(ONE_BOARD) || defined(CHASSIS_BOARD)
|
||||
ChassisTask();
|
||||
Referee_Interactive_task();
|
||||
// Referee_Interactive_task();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ void RefereeSend(uint8_t *send, uint16_t tx_len)
|
|||
{
|
||||
USARTSend(referee_usart_instance, send, tx_len);
|
||||
/* syhtodo DMA请求过快会导致数据发送丢失,考虑数据尽可能打成一个整包以及队列发送,并且发送函数添加缓冲区 */
|
||||
HAL_Delay(5);
|
||||
}
|
||||
|
||||
/*裁判系统串口接收回调函数,解析数据 */
|
||||
|
|
Loading…
Reference in New Issue