添加测试代码
This commit is contained in:
parent
dc68657c16
commit
9968393672
|
@ -16,7 +16,7 @@
|
|||
|
||||
static Referee_Interactive_info_t Interactive_data; // 非裁判系统数据
|
||||
static referee_info_t *referee_data; // 裁判系统相关数据
|
||||
static robot_interactive_data_t *SendData={1,2,3,4,5};
|
||||
static robot_interactive_data_t *SendData;
|
||||
|
||||
static void determine_ID(referee_info_t *_referee_info);
|
||||
static void My_UI_init(referee_info_t *_referee_info);
|
||||
|
@ -25,7 +25,7 @@ static void Mode_Change_Check(Referee_Interactive_info_t *_Interactive_data); //
|
|||
|
||||
//syhtod 正式上车后需删除
|
||||
static void robot_mode_change(Referee_Interactive_info_t *_Interactive_data); // 测试用函数,实现模式自动变化
|
||||
|
||||
static void UI_test_init(referee_info_t *_referee_info);//UI测试函数
|
||||
|
||||
void Referee_Interactive_init()
|
||||
{
|
||||
|
@ -34,6 +34,12 @@ void Referee_Interactive_init()
|
|||
;
|
||||
determine_ID(referee_data);
|
||||
My_UI_init(referee_data);
|
||||
//UI_test_init(referee_data);
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -355,3 +361,27 @@ static void determine_ID(referee_info_t *_referee_info)
|
|||
_referee_info->referee_id.Cilent_ID = 0x0100 + _referee_info->referee_id.Robot_ID; // 计算客户端ID
|
||||
_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];
|
||||
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);
|
||||
|
||||
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]);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ void UI_Delete(referee_id_t *_id,uint8_t Del_Operate,uint8_t Del_Layer)
|
|||
void Line_Draw(Graph_Data_t *graph, char graphname[3], uint32_t Graph_Operate, uint32_t Graph_Layer, uint32_t Graph_Color,
|
||||
uint32_t Graph_Width, uint32_t Start_x, uint32_t Start_y, uint32_t End_x, uint32_t End_y)
|
||||
{
|
||||
// memset(graph,0,UI_Operate_LEN_PerDraw); //如果定义的是非静态变量,数据存在初始化未默认为0的情况,使用memset方法,以下类似 syhtodo
|
||||
int i;
|
||||
for (i = 0; i < 3 && graphname[i] != '\0'; i++) // 填充至‘0’为止
|
||||
{
|
||||
|
@ -72,9 +71,12 @@ void Line_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,uint
|
|||
graph->layer = Graph_Layer;
|
||||
graph->color = Graph_Color;
|
||||
|
||||
graph->start_angle = 0;
|
||||
graph->end_angle = 0;
|
||||
graph->width = Graph_Width;
|
||||
graph->start_x = Start_x;
|
||||
graph->start_y = Start_y;
|
||||
graph->radius = 0;
|
||||
graph->end_x = End_x;
|
||||
graph->end_y = End_y;
|
||||
}
|
||||
|
@ -92,7 +94,6 @@ void Line_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,uint
|
|||
void Rectangle_Draw(Graph_Data_t *graph, char graphname[3], uint32_t Graph_Operate, uint32_t Graph_Layer, uint32_t Graph_Color,
|
||||
uint32_t Graph_Width, uint32_t Start_x, uint32_t Start_y, uint32_t End_x, uint32_t End_y)
|
||||
{
|
||||
// memset(&graph,0,UI_Operate_LEN_PerDraw);
|
||||
int i;
|
||||
for (i = 0; i < 3 && graphname[i] != '\0'; i++)
|
||||
{
|
||||
|
@ -104,9 +105,12 @@ void Rectangle_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate
|
|||
graph->layer = Graph_Layer;
|
||||
graph->color = Graph_Color;
|
||||
|
||||
graph->start_angle = 0;
|
||||
graph->end_angle = 0;
|
||||
graph->width = Graph_Width;
|
||||
graph->start_x = Start_x;
|
||||
graph->start_y = Start_y;
|
||||
graph->radius = 0;
|
||||
graph->end_x = End_x;
|
||||
graph->end_y = End_y;
|
||||
}
|
||||
|
@ -125,7 +129,6 @@ void Rectangle_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate
|
|||
void Circle_Draw(Graph_Data_t *graph, char graphname[3], uint32_t Graph_Operate, uint32_t Graph_Layer, uint32_t Graph_Color,
|
||||
uint32_t Graph_Width, uint32_t Start_x, uint32_t Start_y, uint32_t Graph_Radius)
|
||||
{
|
||||
// memset(&graph,0,UI_Operate_LEN_PerDraw);
|
||||
int i;
|
||||
for (i = 0; i < 3 && graphname[i] != '\0'; i++)
|
||||
{
|
||||
|
@ -137,10 +140,14 @@ void Circle_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,ui
|
|||
graph->layer = Graph_Layer;
|
||||
graph->color = Graph_Color;
|
||||
|
||||
graph->start_angle = 0;
|
||||
graph->end_angle = 0;
|
||||
graph->width = Graph_Width;
|
||||
graph->start_x = Start_x;
|
||||
graph->start_y = Start_y;
|
||||
graph->radius = Graph_Radius;
|
||||
graph->end_x = 0;
|
||||
graph->end_y = 0;
|
||||
}
|
||||
/************************************************绘制椭圆*************************************************
|
||||
**参数:*graph Graph_Data类型变量指针,用于存放图形数据
|
||||
|
@ -155,7 +162,6 @@ void Circle_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,ui
|
|||
void Elliptical_Draw(Graph_Data_t *graph, char graphname[3], uint32_t Graph_Operate, uint32_t Graph_Layer, uint32_t Graph_Color,
|
||||
uint32_t Graph_Width, uint32_t Start_x, uint32_t Start_y, uint32_t end_x, uint32_t end_y)
|
||||
{
|
||||
// memset(&graph,0,UI_Operate_LEN_PerDraw);
|
||||
int i;
|
||||
for (i = 0; i < 3 && graphname[i] != '\0'; i++)
|
||||
{
|
||||
|
@ -168,13 +174,16 @@ void Elliptical_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operat
|
|||
graph->color = Graph_Color;
|
||||
graph->width = Graph_Width;
|
||||
|
||||
graph->start_angle = 0;
|
||||
graph->end_angle = 0;
|
||||
graph->width = Graph_Width;
|
||||
graph->start_x = Start_x;
|
||||
graph->start_y = Start_y;
|
||||
graph->radius = 0;
|
||||
graph->end_x = end_x;
|
||||
graph->end_y = end_y;
|
||||
}
|
||||
|
||||
|
||||
/************************************************绘制圆弧*************************************************
|
||||
**参数:*graph Graph_Data类型变量指针,用于存放图形数据
|
||||
graphname[3] 图片名称,用于标识更改
|
||||
|
@ -191,7 +200,6 @@ void Arc_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,uint3
|
|||
uint32_t Graph_StartAngle, uint32_t Graph_EndAngle, uint32_t Graph_Width, uint32_t Start_x, uint32_t Start_y,
|
||||
uint32_t end_x, uint32_t end_y)
|
||||
{
|
||||
//memset(&graph,0,UI_Operate_LEN_PerDraw);
|
||||
int i;
|
||||
for (i = 0; i < 3 && graphname[i] != '\0'; i++)
|
||||
{
|
||||
|
@ -208,6 +216,7 @@ void Arc_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,uint3
|
|||
graph->width = Graph_Width;
|
||||
graph->start_x = Start_x;
|
||||
graph->start_y = Start_y;
|
||||
graph->radius = 0;
|
||||
graph->end_x = end_x;
|
||||
graph->end_y = end_y;
|
||||
}
|
||||
|
@ -230,7 +239,7 @@ void Arc_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,uint3
|
|||
void Float_Draw(Graph_Data_t *graph, char graphname[3], uint32_t Graph_Operate, uint32_t Graph_Layer, uint32_t Graph_Color,
|
||||
uint32_t Graph_Size, uint32_t Graph_Digit, uint32_t Graph_Width, uint32_t Start_x, uint32_t Start_y, int32_t Graph_Float)
|
||||
{
|
||||
//memset(&graph,0,UI_Operate_LEN_PerDraw);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 3 && graphname[i] != '\0'; i++)
|
||||
{
|
||||
|
@ -268,7 +277,6 @@ void Float_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,uin
|
|||
void Integer_Draw(Graph_Data_t *graph, char graphname[3], uint32_t Graph_Operate, uint32_t Graph_Layer, uint32_t Graph_Color,
|
||||
uint32_t Graph_Size, uint32_t Graph_Width, uint32_t Start_x, uint32_t Start_y, int32_t Graph_Integer)
|
||||
{
|
||||
//memset(&graph,0,UI_Operate_LEN_PerDraw);
|
||||
int i;
|
||||
for (i = 0; i < 3 && graphname[i] != '\0'; i++)
|
||||
{
|
||||
|
@ -280,16 +288,15 @@ void Integer_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,u
|
|||
graph->color = Graph_Color;
|
||||
|
||||
graph->start_angle = Graph_Size;
|
||||
graph->end_angle = 0;
|
||||
graph->width = Graph_Width;
|
||||
graph->start_x = Start_x;
|
||||
graph->start_y = Start_y;
|
||||
|
||||
graph->radius = Graph_Integer & 0x3FF;
|
||||
graph->end_x = (Graph_Integer >> 10) & 0x7FF;
|
||||
graph->end_y = (Graph_Integer >> 21) & 0x7FF;
|
||||
}
|
||||
|
||||
|
||||
/************************************************绘制字符型数据*************************************************
|
||||
**参数:*graph Graph_Data类型变量指针,用于存放图形数据
|
||||
graphname[3] 图片名称,用于标识更改
|
||||
|
@ -303,8 +310,6 @@ void Integer_Draw(Graph_Data_t *graph,char graphname[3],uint32_t Graph_Operate,u
|
|||
void Char_Draw(String_Data_t *graph, char graphname[3], uint32_t Graph_Operate, uint32_t Graph_Layer, uint32_t Graph_Color,
|
||||
uint32_t Graph_Size, uint32_t Graph_Width, uint32_t Start_x, uint32_t Start_y)
|
||||
{
|
||||
// //memset(graph->Graph_Control.graphic_name, 0, 3);//syhtodo 是否需要手动清零
|
||||
//memset(&graph,0,UI_Operate_LEN_DrawChar);
|
||||
int i;
|
||||
for (i = 0; i < 3 && graphname[i] != '\0'; i++)
|
||||
{
|
||||
|
@ -320,8 +325,6 @@ void Char_Draw(String_Data_t *graph,char graphname[3],uint32_t Graph_Operate,uin
|
|||
graph->Graph_Control.start_x = Start_x;
|
||||
graph->Graph_Control.start_y = Start_y;
|
||||
graph->Graph_Control.start_angle = Graph_Size;
|
||||
|
||||
//syhtodo无关的赋值为0
|
||||
graph->Graph_Control.radius = 0;
|
||||
graph->Graph_Control.end_x = 0;
|
||||
graph->Graph_Control.end_y = 0;
|
||||
|
@ -343,7 +346,6 @@ void Char_Write(String_Data_t *graph,char* fmt, ...)
|
|||
graph->Graph_Control.end_angle = i;
|
||||
}
|
||||
|
||||
|
||||
/* UI推送函数(使更改生效)
|
||||
参数: cnt 图形个数
|
||||
... 图形变量参数
|
||||
|
@ -429,4 +431,3 @@ void Char_ReFresh(referee_id_t *_id,String_Data_t string_Data)
|
|||
|
||||
UI_Seq++; // 包序号+1
|
||||
}
|
||||
|
|
@ -339,7 +339,7 @@ typedef struct
|
|||
uint32_t radius : 10;
|
||||
uint32_t end_x : 11;
|
||||
uint32_t end_y : 11;
|
||||
} Graph_Data_t; // syhtodo 定义要有-t
|
||||
} Graph_Data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue