@@ -57,7 +57,7 @@ static Graph_Data_t UI_shoot_line[10]; // 射击准线
static Graph_Data_t UI_Energy [ 3 ] ; // 电容能量条
static String_Data_t UI_State_sta [ 6 ] ; // 机器人状态,静态只需画一次
static String_Data_t UI_State_dyn [ 6 ] ; // 机器人状态,动态先add才能change
static uint32_t shoot_line_location [ 10 ] = { 540 , 96 0 , 490 , 515 , 565 } ;
static uint32_t shoot_line_location [ 10 ] = { 525 , 95 0 , 490 , 515 , 565 } ;
void MyUIInit ( )
{
@@ -73,12 +73,12 @@ void MyUIInit()
UILineDraw ( & UI_shoot_line [ 0 ] , " sl0 " , UI_Graph_ADD , 7 , UI_Color_White , 3 , 710 , shoot_line_location [ 0 ] , 1210 , shoot_line_location [ 0 ] ) ;
UILineDraw ( & UI_shoot_line [ 1 ] , " sl1 " , UI_Graph_ADD , 7 , UI_Color_White , 3 , shoot_line_location [ 1 ] , 340 , shoot_line_location [ 1 ] , 740 ) ;
UILineDraw ( & UI_shoot_line [ 2 ] , " sl2 " , UI_Graph_ADD , 7 , UI_Color_Yellow , 2 , 810 , shoot_line_location [ 2 ] , 1110 , shoot_line_location [ 2 ] ) ;
UILineDraw ( & UI_shoot_line [ 3 ] , " sl3 " , UI_Graph_ADD , 7 , UI_Color_Yellow , 2 , 81 0 , shoot_line_location [ 3 ] , 111 0 , shoot_line_location [ 3 ] ) ;
UILineDraw ( & UI_shoot_line [ 3 ] , " sl3 " , UI_Graph_ADD , 7 , UI_Color_Yellow , 2 , 86 0 , 475 , 106 0 , 475 ) ;
UILineDraw ( & UI_shoot_line [ 4 ] , " sl4 " , UI_Graph_ADD , 7 , UI_Color_Yellow , 2 , 810 , shoot_line_location [ 4 ] , 1110 , shoot_line_location [ 4 ] ) ;
UIGraphRefresh ( & referee_recv_info - > referee_id , 5 , UI_shoot_line [ 0 ] , UI_shoot_line [ 1 ] , UI_shoot_line [ 2 ] , UI_shoot_line [ 3 ] , UI_shoot_line [ 4 ] ) ;
// 绘制车辆状态标志指示
UICharDraw ( & UI_State_sta [ 0 ] , " ss0 " , UI_Graph_ADD , 8 , UI_Color_Main , 15 , 2 , 150 , 750 , " chassis :" ) ;
UICharDraw ( & UI_State_sta [ 0 ] , " ss0 " , UI_Graph_ADD , 8 , UI_Color_Main , 15 , 2 , 150 , 750 , " level :" ) ;
UICharRefresh ( & referee_recv_info - > referee_id , UI_State_sta [ 0 ] ) ;
UICharDraw ( & UI_State_sta [ 1 ] , " ss1 " , UI_Graph_ADD , 8 , UI_Color_Yellow , 15 , 2 , 150 , 700 , " gimbal: " ) ;
UICharRefresh ( & referee_recv_info - > referee_id , UI_State_sta [ 1 ] ) ;
@@ -91,7 +91,7 @@ void MyUIInit()
// 绘制车辆状态标志,动态
// 由于初始化时xxx_last_mode默认为0, 所以此处对应UI也应该设为0时对应的UI, 防止模式不变的情况下无法置位flag, 导致UI无法刷新
UICharDraw ( & UI_State_dyn [ 0 ] , " sd0 " , UI_Graph_ADD , 8 , UI_Color_Main , 15 , 2 , 270 , 750 , " zeroforce " ) ;
UICharDraw ( & UI_State_dyn [ 0 ] , " sd0 " , UI_Graph_ADD , 8 , UI_Color_Main , 15 , 2 , 270 , 750 , " 1 " ) ;
UICharRefresh ( & referee_recv_info - > referee_id , UI_State_dyn [ 0 ] ) ;
UICharDraw ( & UI_State_dyn [ 1 ] , " sd1 " , UI_Graph_ADD , 8 , UI_Color_Yellow , 15 , 2 , 270 , 700 , " zeroforce " ) ;
UICharRefresh ( & referee_recv_info - > referee_id , UI_State_dyn [ 1 ] ) ;
@@ -116,7 +116,7 @@ void MyUIInit()
UIGraphRefresh ( & referee_recv_info - > referee_id , 2 , UI_Energy [ 1 ] , UI_Energy [ 2 ] ) ;
}
// 测试用函数,实现模式自动变化,用于检查该任务和裁判系统是否连接正常
// 测试用函数,实现模式自动变化,用于检查该任务和裁判系统是否连接正常.
static uint8_t count = 0 ;
static uint16_t count1 = 0 ;
static void RobotModeTest ( Referee_Interactive_info_t * _Interactive_data ) // 测试用函数,实现模式自动变化
@@ -176,27 +176,15 @@ static void RobotModeTest(Referee_Interactive_info_t *_Interactive_data) // 测
static void MyUIRefresh ( referee_info_t * referee_recv_info , Referee_Interactive_info_t * _Interactive_data )
{
UIChangeCheck ( _Interactive_data ) ;
// chassis
if ( _Interactive_data - > Referee_Interactive_Flag . chassis _flag = = 1 )
// robot level
if ( _Interactive_data - > Referee_Interactive_Flag . robot_level _flag = = 1 )
{
switch ( _Interactive_data - > chassis_mode )
{
case CHASSIS_ZERO_FORCE :
UICharDraw ( & UI_State_dyn [ 0 ] , " sd0 " , UI_Graph_Change , 8 , UI_Color_Main , 15 , 2 , 270 , 750 , " zeroforce " ) ;
break ;
case CHASSIS_ROTATE :
UICharDraw ( & UI_State_dyn [ 0 ] , " sd0 " , UI_Graph_Change , 8 , UI_Color_Main , 15 , 2 , 270 , 750 , " rotate " ) ;
// 此处注意字数对齐问题,字数相同才能覆盖掉
break ;
case CHASSIS_NO_FOLLOW :
UICharDraw ( & UI_State_dyn [ 0 ] , " sd0 " , UI_Graph_Change , 8 , UI_Color_Main , 15 , 2 , 270 , 750 , " nofollow " ) ;
break ;
case CHASSIS_FOLLOW_GIMBAL_YAW :
UICharDraw ( & UI_State_dyn [ 0 ] , " sd0 " , UI_Graph_Change , 8 , UI_Color_Main , 15 , 2 , 270 , 750 , " follow " ) ;
break ;
}
char level_str [ 2 ] ;
level_str [ 0 ] = ' 0 ' + _Interactive_data - > robot_level ;
level_str [ 1 ] = ' \0 ' ;
UICharDraw ( & UI_State_dyn [ 0 ] , " sd0 " , UI_Graph_Change , 8 , UI_Color_Main , 15 , 2 , 270 , 750 , level_str ) ;
UICharRefresh ( & referee_recv_info - > referee_id , UI_State_dyn [ 0 ] ) ;
_Interactive_data - > Referee_Interactive_Flag . chassis _flag = 0 ;
_Interactive_data - > Referee_Interactive_Flag . robot_level _flag = 0 ;
}
// gimbal
if ( _Interactive_data - > Referee_Interactive_Flag . gimbal_flag = = 1 )
@@ -261,6 +249,12 @@ static void MyUIRefresh(referee_info_t *referee_recv_info, Referee_Interactive_i
*/
static void UIChangeCheck ( Referee_Interactive_info_t * _Interactive_data )
{
if ( _Interactive_data - > robot_level ! = _Interactive_data - > robot_last_level )
{
_Interactive_data - > Referee_Interactive_Flag . robot_level_flag = 1 ;
_Interactive_data - > robot_last_level = _Interactive_data - > robot_level ;
}
if ( _Interactive_data - > chassis_mode ! = _Interactive_data - > chassis_last_mode )
{
_Interactive_data - > Referee_Interactive_Flag . chassis_flag = 1 ;