From 0a99d523b26413a7c30210cbcbe4cb68ea8fe438 Mon Sep 17 00:00:00 2001 From: Leo Liu <65527170+CuboiLeo@users.noreply.github.com> Date: Mon, 27 May 2024 23:51:14 -0400 Subject: [PATCH] referee uart bug sometimes occur, level indicator added --- Makefile | 1 + src/app/inc/robot.h | 1 + src/app/src/debug_task.c | 4 +- src/app/src/robot.c | 5 ++ src/app/src/ui_task.c | 107 ++++++++++++++++--------------- src/devices/inc/referee_system.h | 89 ++++++------------------- src/devices/src/referee_system.c | 55 ++++++++++++---- src/ui/inc/ui.h | 11 +++- src/ui/inc/ui_indicator_0_11.h | 16 +++++ src/ui/inc/ui_indicator_1_0.h | 1 + src/ui/src/ui_indicator_0_11.c | 47 ++++++++++++++ src/ui/src/ui_indicator_1_0.c | 12 +++- 12 files changed, 214 insertions(+), 135 deletions(-) create mode 100644 src/ui/inc/ui_indicator_0_11.h create mode 100644 src/ui/src/ui_indicator_0_11.c diff --git a/Makefile b/Makefile index 0714899..436d8c9 100644 --- a/Makefile +++ b/Makefile @@ -154,6 +154,7 @@ src/ui/src/ui_indicator_0_7.c \ src/ui/src/ui_indicator_0_8.c \ src/ui/src/ui_indicator_0_9.c \ src/ui/src/ui_indicator_0_10.c \ +src/ui/src/ui_indicator_0_11.c \ src/ui/src/ui_indicator_1_0.c # ASM sources diff --git a/src/app/inc/robot.h b/src/app/inc/robot.h index 8efad3b..64329ec 100644 --- a/src/app/inc/robot.h +++ b/src/app/inc/robot.h @@ -34,6 +34,7 @@ typedef struct uint8_t prev_B; uint8_t prev_G; uint8_t prev_V; + uint8_t prev_Z; uint8_t prev_left_switch; } Key_Prev_t; diff --git a/src/app/src/debug_task.c b/src/app/src/debug_task.c index a4f1c5b..f59c344 100644 --- a/src/app/src/debug_task.c +++ b/src/app/src/debug_task.c @@ -21,6 +21,7 @@ extern Launch_Target_t g_launch_target; extern uint64_t t; extern Daemon_Instance_t *g_daemon_instances[3]; extern Daemon_Instance_t *g_remote_daemon; +extern Daemon_Instance_t *g_referee_daemon_instance_ptr; #define PRINT_RUNTIME_STATS #ifdef PRINT_RUNTIME_STATS char g_debug_buffer[1024*2] = {0}; @@ -52,6 +53,7 @@ void Debug_Task_Loop(void) // if (counter > 0xFFFFFFFF) { // counter = 0; // } - DEBUG_PRINTF(&huart6, ">ref:%f\n>act:%f\n",g_motor_feed->velocity_pid->ref,g_motor_feed->stats->current_vel_rpm); + //DEBUG_PRINTF(&huart6, ">ref:%f\n>act:%f\n",g_motor_feed->velocity_pid->ref,g_motor_feed->stats->current_vel_rpm); + DEBUG_PRINTF(&huart6, ">ref:%d\n",g_referee_daemon_instance_ptr->counter); #endif } \ No newline at end of file diff --git a/src/app/src/robot.c b/src/app/src/robot.c index 69587ae..6c640e5 100644 --- a/src/app/src/robot.c +++ b/src/app/src/robot.c @@ -174,9 +174,14 @@ void Robot_Cmd_Loop() { _toggle_robot_state(&g_robot_state.UI_enabled); } + if (g_remote.keyboard.Z == 1 && g_key_prev.prev_Z == 0) + { + Referee_Robot_State.Manual_Level++; + } g_key_prev.prev_B = g_remote.keyboard.B; g_key_prev.prev_G = g_remote.keyboard.G; g_key_prev.prev_V = g_remote.keyboard.V; + g_key_prev.prev_Z = g_remote.keyboard.Z; /* Keyboard Toggles Start Here */ /* AutoAiming Flag, not used only for debug */ diff --git a/src/app/src/ui_task.c b/src/app/src/ui_task.c index bbaaf71..c2a6a49 100644 --- a/src/app/src/ui_task.c +++ b/src/app/src/ui_task.c @@ -2,54 +2,61 @@ void UI_Task_Loop(void) { - ui_self_id = Referee_Robot_State.ID; - if (!g_robot_state.UI_enabled) - { - ui_remove_indicator_0(); - ui_init_indicator_0(); - ui_remove_indicator_1(); - ui_init_indicator_1(); - g_robot_state.UI_enabled = 1; - } - if (g_launch_target.flywheel_enabled) - { - ui_indicator_1_Flywheel_Select->start_x = 270; - ui_indicator_1_Flywheel_Select->end_x = 320; - } - else - { - ui_indicator_1_Flywheel_Select->start_x = 335; - ui_indicator_1_Flywheel_Select->end_x = 385; - } - if (g_robot_state.spintop_mode) - { - ui_indicator_1_Spintop_Select->start_x = 270; - ui_indicator_1_Spintop_Select->end_x = 320; - } - else - { - ui_indicator_1_Spintop_Select->start_x = 335; - ui_indicator_1_Spintop_Select->end_x = 385; - } - if (g_robot_state.autoaiming_enabled) - { - ui_indicator_1_Autoaim_Select->start_x = 270; - ui_indicator_1_Autoaim_Select->end_x = 320; - ui_indicator_1_Aim_H_Line->color = 2; - ui_indicator_1_Aim_V_Line->color = 2; - } - else - { - ui_indicator_1_Autoaim_Select->start_x = 335; - ui_indicator_1_Autoaim_Select->end_x = 385; - ui_indicator_1_Aim_H_Line->color = 3; - ui_indicator_1_Aim_V_Line->color = 3; - } - if (ui_indicator_1_Supercap->number>=99) - { - ui_indicator_1_Supercap->number = 0; - } - ui_indicator_1_Supercap->number++; - - ui_update_indicator_1(); + ui_self_id = Referee_Robot_State.ID; + if (!g_robot_state.UI_enabled) + { + ui_remove_indicator_0(); + ui_init_indicator_0(); + ui_remove_indicator_1(); + ui_init_indicator_1(); + g_robot_state.UI_enabled = 1; + } + if (g_launch_target.flywheel_enabled) + { + ui_indicator_1_Flywheel_Select->start_x = 270; + ui_indicator_1_Flywheel_Select->end_x = 320; + } + else + { + ui_indicator_1_Flywheel_Select->start_x = 335; + ui_indicator_1_Flywheel_Select->end_x = 385; + } + if (g_robot_state.spintop_mode) + { + ui_indicator_1_Spintop_Select->start_x = 270; + ui_indicator_1_Spintop_Select->end_x = 320; + } + else + { + ui_indicator_1_Spintop_Select->start_x = 335; + ui_indicator_1_Spintop_Select->end_x = 385; + } + if (g_robot_state.autoaiming_enabled) + { + ui_indicator_1_Autoaim_Select->start_x = 270; + ui_indicator_1_Autoaim_Select->end_x = 320; + ui_indicator_1_Aim_H_Line->color = 2; + ui_indicator_1_Aim_V_Line->color = 2; + } + else + { + ui_indicator_1_Autoaim_Select->start_x = 335; + ui_indicator_1_Autoaim_Select->end_x = 385; + ui_indicator_1_Aim_H_Line->color = 3; + ui_indicator_1_Aim_V_Line->color = 3; + } + if (ui_indicator_1_Supercap->number>=99) + { + ui_indicator_1_Supercap->number = 0; + } + if(Referee_System.Online_Flag) + { + ui_indicator_1_Level_Indicator->number = Referee_Robot_State.Level; + } + else + { + ui_indicator_1_Level_Indicator->number = Referee_Robot_State.Manual_Level; + } + ui_indicator_1_Supercap->number++; + ui_update_indicator_1(); } \ No newline at end of file diff --git a/src/devices/inc/referee_system.h b/src/devices/inc/referee_system.h index 3a4c709..3d9da0d 100644 --- a/src/devices/inc/referee_system.h +++ b/src/devices/inc/referee_system.h @@ -21,75 +21,27 @@ #define REFEREE_TIMEOUT_MS 500 -//Standard Confrontation -#define V1_STANDARD_POWER_MAX 120 -#define V1_STANDARD_HP_MAX 200 -#define V1_STANDARD_LAUNCH_SPEED_MAX 30 -#define V1_STANDARD_HEAT_MAX 280 -#define V1_STANDARD_COOLING_RATE 25 +#define ROBOT_TYPE_STANDARD +//#define ROBOT_TYPE_HERO +//#define ROBOT_TYPE_SENTRY -#define V1_SBR_POWER_MAX 150 -#define V1_SBR_HP_MAX 200 -#define V1_SBR_LAUNCH_SPEED_MAX 30 -#define V1_SBR_HEAT_MAX 280 -#define V1_SBR_COOLING_RATE 50 +//Standard Default Configuration +#define DEFAULT_STANDARD_POWER_MAX 200 +#define DEFAULT_STANDARD_LAUNCH_SPEED_MAX 30 +#define DEFAULT_STANDARD_HEAT_MAX 200 +#define DEFAULT_STANDARD_COOLING_RATE 10 -//Sentry Configuration -#define SENTRY_POWER_MAX 100 -#define SENTRY_HP_MAX 600 -#define SENTRY_LAUNCH_SPEED_MAX 30 -#define SENTRY_HEAT_MAX 400 -#define SENTRY_COOLING_RATE 80 +//Sentry Default Configuration +#define DEFAULT_SENTRY_POWER_MAX 100 +#define DEFAULT_SENTRY_LAUNCH_SPEED_MAX 30 +#define DEFAULT_SENTRY_HEAT_MAX 400 +#define DEFAULT_SENTRY_COOLING_RATE 80 -//3V3 Confrontation -#define V3_STANDARD_LAUNCH_SPEED_MAX 30 -#define V3_STANDARD_LV10_HP_MAX 400 -#define V3_STANDARD_LV10_POWER_MAX 100 - -#define V3_HERO_LAUNCH_SPEED_MAX 16 -#define V3_HERO_LV10_HP_MAX 500 -#define V3_HERO_LV10_POWER_MAX 120 - -#define V3_HERO_POWER_FOCUSED_LV1_HP_MAX 200 -#define V3_HERO_POWER_FOCUSED_HP_INCREMENT 25 -#define V3_HERO_POWER_FOCUSED_LV1_POWER_MAX 70 -#define V3_HERO_POWER_FOCUSED_POWER_INCREMENT 5 - -#define V3_HERO_HP_FOCUSED_LV1_HP_MAX 250 -#define V3_HERO_HP_FOCUSED_HP_INCREMENT 25 -#define V3_HERO_HP_FOCUSED_LV1_POWER_MAX 55 -#define V3_HERO_HP_FOCUSED_POWER_INCREMENT 5 -#define V3_HERO_HP_FOCUSED_LV9_POWER_MAX 100 - -#define V3_STANDARD_POWER_FOCUSED_LV1_HP_MAX 150 -#define V3_STANDARD_POWER_FOCUSED_HP_INCREMENT 25 -#define V3_STANDARD_POWER_FOCUSED_LV1_POWER_MAX 60 -#define V3_STANDARD_POWER_FOCUSED_POWER_INCREMENT 5 - -#define V3_STANDARD_HP_FOCUSED_LV1_HP_MAX 200 -#define V3_STANDARD_HP_FOCUSED_HP_INCREMENT 25 -#define V3_STANDARD_HP_FOCUSED_LV1_POWER_MAX 45 -#define V3_STANDARD_HP_FOCUSED_POWER_INCREMENT 5 -#define V3_STANDARD_HP_FOCUSED_LV9_POWER_MAX 90 - -#define V3_STANDARD_BURST_FOCUSED_LV1_HEAT_MAX 200 -#define V3_STANDARD_BURST_FOCUSED_HEAT_INCREMENT 50 -#define V3_STANDARD_BURST_FOCUSED_LV1_COOLING_MAX 10 -#define V3_STANDARD_BURST_FOCUSED_COOLING_INCREMENT 5 - -#define V3_STANDARD_COOLING_FOCUSED_LV1_HEAT_MAX 50 -#define V3_STANDARD_COOLING_FOCUSED_HEAT_INCREMENT 35 -#define V3_STANDARD_COOLING_FOCUSED_LV10_HEAT_MAX 400 -#define V3_STANDARD_COOLING_FOCUSED_LV1_COOLING_MAX 40 -#define V3_STANDARD_COOLING_FOCUSED_COOLING_INCREMENT 5 -#define V3_STANDARD_COOLING_FOCUSED_LV10_COOLING_MAX 80 - -#define V3_HERO_LV1_HEAT_MAX 200 -#define V3_HERO_LV10_HEAT_MAX 200 -#define V3_HERO_HEAT_INCREMENT 30 -#define V3_HERO_LV1_COOLING_MAX 40 -#define V3_HERO_COOLING_INCREMENT 8 -#define V3_HERO_LV10_COOLING_MAX 120 +//Hero Default Configuration +#define DEFAULT_HERO_POWER_MAX 55 +#define DEFAULT_HERO_LAUNCH_SPEED_MAX 16 +#define DEFAULT_HERO_HEAT_MAX 200 +#define DEFAULT_HERO_COOLING_RATE 40 #define REFEREE_BUFFER_LEN 273u //Buffer length to receive all data #define REFEREE_FRAME_HEADER_START 0xA5 //Frame header @@ -142,6 +94,7 @@ typedef struct uint8_t Game_Type; //1 for 7v7, 4 for 3v3, 5 for 1v1 uint8_t ID; //3,4,5 Red Standard - 103,104,105 Blue Standard uint8_t Level; + uint8_t Manual_Level; uint16_t Cooling_Rate; uint16_t Heat_Max; @@ -151,7 +104,7 @@ typedef struct float Chassis_Power; float Power_Buffer; uint16_t Shooter_Heat_1; - uint16_t Shooter_Heat_2; + uint16_t Shooter_Heat_2; uint8_t Shooting_Frequency; float Shooting_Speed; }Referee_Robot_State_t; @@ -296,7 +249,7 @@ typedef struct }RFID; uint16_t Info_Update_Frame; - uint8_t Offline_Flag; + uint8_t Online_Flag; } Referee_System_t; void Referee_Get_Data(UART_Instance_t *uart_instance); diff --git a/src/devices/src/referee_system.c b/src/devices/src/referee_system.c index cfb834b..d32a090 100644 --- a/src/devices/src/referee_system.c +++ b/src/devices/src/referee_system.c @@ -17,31 +17,59 @@ Daemon_Instance_t *g_referee_daemon_instance_ptr; void Referee_Set_Robot_State(void) { - Referee_Robot_State.Game_Type = Referee_System.Game_Status.Type; - Referee_Robot_State.ID = Referee_System.Robot_State.ID; - Referee_Robot_State.Level = Referee_System.Robot_State.Level; + if (Referee_System.Online_Flag) + { + Referee_Robot_State.Game_Type = Referee_System.Game_Status.Type; + Referee_Robot_State.ID = Referee_System.Robot_State.ID; + Referee_Robot_State.Level = Referee_System.Robot_State.Level; + + Referee_Robot_State.Cooling_Rate = Referee_System.Robot_State.Shooter_Cooling_Value; + Referee_Robot_State.Heat_Max = Referee_System.Robot_State.Shooter_Heat_Max; + Referee_Robot_State.Launch_Speed_Max = DEFAULT_STANDARD_LAUNCH_SPEED_MAX; + Referee_Robot_State.Chassis_Power_Max = Referee_System.Robot_State.Chassis_Power_Max; + + Referee_Robot_State.Chassis_Power = Referee_System.Power_Heat.Chassis_Power; + Referee_Robot_State.Power_Buffer = Referee_System.Power_Heat.Chassis_Power_Buffer; + Referee_Robot_State.Shooter_Heat_1 = Referee_System.Power_Heat.Shooter_1_17mm_Heat; + Referee_Robot_State.Shooter_Heat_2 = Referee_System.Power_Heat.Shooter_2_17mm_Heat; + Referee_Robot_State.Shooting_Frequency = Referee_System.Shooter.Frequency; + Referee_Robot_State.Shooting_Speed = Referee_System.Shooter.Speed; + } + else + { + #ifdef ROBOT_TYPE_STANDARD + Referee_Robot_State.Cooling_Rate = DEFAULT_STANDARD_COOLING_RATE+(Referee_Robot_State.Manual_Level-1)*5; + Referee_Robot_State.Heat_Max = DEFAULT_STANDARD_HEAT_MAX+(Referee_Robot_State.Manual_Level-1)*50; + Referee_Robot_State.Launch_Speed_Max = DEFAULT_STANDARD_LAUNCH_SPEED_MAX; + Referee_Robot_State.Chassis_Power_Max = DEFAULT_STANDARD_POWER_MAX+(Referee_Robot_State.Manual_Level-1)*5; + #endif - Referee_Robot_State.Cooling_Rate = Referee_System.Robot_State.Shooter_Cooling_Value; - Referee_Robot_State.Heat_Max = Referee_System.Robot_State.Shooter_Heat_Max; - Referee_Robot_State.Launch_Speed_Max = V3_STANDARD_LAUNCH_SPEED_MAX; - Referee_Robot_State.Chassis_Power_Max = Referee_System.Robot_State.Chassis_Power_Max; + #ifdef ROBOT_TYPE_HERO + Referee_Robot_State.Cooling_Rate = DEFAULT_HERO_COOLING_RATE+(Referee_Robot_State.Manual_Level-1)*8; + Referee_Robot_State.Heat_Max = DEFAULT_HERO_HEAT_MAX+(Referee_Robot_State.Manual_Level-1)*30; + Referee_Robot_State.Launch_Speed_Max = DEFAULT_HERO_LAUNCH_SPEED_MAX; + Referee_Robot_State.Chassis_Power_Max = DEFAULT_HERO_POWER_MAX+(Referee_Robot_State.Manual_Level-1)*5; + #endif - Referee_Robot_State.Chassis_Power = Referee_System.Power_Heat.Chassis_Power; - Referee_Robot_State.Power_Buffer = Referee_System.Power_Heat.Chassis_Power_Buffer; - Referee_Robot_State.Shooter_Heat_1 = Referee_System.Power_Heat.Shooter_1_17mm_Heat; - Referee_Robot_State.Shooter_Heat_2 = Referee_System.Power_Heat.Shooter_2_17mm_Heat; - Referee_Robot_State.Shooting_Frequency = Referee_System.Shooter.Frequency; - Referee_Robot_State.Shooting_Speed = Referee_System.Shooter.Speed; + #ifdef ROBOT_TYPE_SENTRY + Referee_Robot_State.Cooling_Rate = DEFAULT_SENTRY_COOLING_RATE; + Referee_Robot_State.Heat_Max = DEFAULT_SENTRY_HEAT_MAX; + Referee_Robot_State.Launch_Speed_Max = DEFAULT_SENTRY_LAUNCH_SPEED_MAX; + Referee_Robot_State.Chassis_Power_Max = DEFAULT_SENTRY_POWER_MAX; + #endif + } } void Referee_System_Timeout_Callback() { // Attemp to reinitialize UART service UART_Service_Init(g_referee_uart_instance_ptr); + Referee_System.Online_Flag = 0; } void Referee_System_Init(UART_HandleTypeDef *huart) { Referee_System.huart = huart; + Referee_Robot_State.Manual_Level = 1; HAL_UART_Receive_DMA(huart, Referee_System.Buffer, REFEREE_BUFFER_LEN); g_referee_uart_instance_ptr = UART_Register(huart, Referee_System.Buffer, REFEREE_BUFFER_LEN, Referee_Get_Data); @@ -62,6 +90,7 @@ void Referee_Get_Data(UART_Instance_t *uart_instance) if (Referee_System.Buffer[n] == REFEREE_FRAME_HEADER_START) { Daemon_Reload(g_referee_daemon_instance_ptr); + Referee_System.Online_Flag = 1; switch (Referee_System.Buffer[n + 5] | Referee_System.Buffer[n + 6] << 8) { case REFEREE_GAME_STATUS: diff --git a/src/ui/inc/ui.h b/src/ui/inc/ui.h index b78f07c..cf798ee 100644 --- a/src/ui/inc/ui.h +++ b/src/ui/inc/ui.h @@ -21,6 +21,7 @@ extern "C" { #include "ui_indicator_0_8.h" #include "ui_indicator_0_9.h" #include "ui_indicator_0_10.h" +#include "ui_indicator_0_11.h" #define ui_init_indicator_0() \ _ui_init_indicator_0_0(); \ @@ -44,7 +45,9 @@ osDelay(100); \ _ui_init_indicator_0_9(); \ osDelay(100); \ _ui_init_indicator_0_10();\ -osDelay(100) +osDelay(100); \ +_ui_init_indicator_0_11();\ +osDelay(100) #define ui_update_indicator_0() \ _ui_update_indicator_0_0(); \ @@ -68,7 +71,9 @@ osDelay(100); \ _ui_update_indicator_0_9(); \ osDelay(100); \ _ui_update_indicator_0_10();\ -osDelay(100) +osDelay(100); \ +_ui_update_indicator_0_11();\ +osDelay(100) #define ui_remove_indicator_0() \ _ui_remove_indicator_0_0(); \ @@ -92,6 +97,8 @@ osDelay(100); \ _ui_remove_indicator_0_9(); \ osDelay(100); \ _ui_remove_indicator_0_10();\ +osDelay(100); \ +_ui_remove_indicator_0_11();\ osDelay(100) #include "ui_indicator_1_0.h" diff --git a/src/ui/inc/ui_indicator_0_11.h b/src/ui/inc/ui_indicator_0_11.h new file mode 100644 index 0000000..884e754 --- /dev/null +++ b/src/ui/inc/ui_indicator_0_11.h @@ -0,0 +1,16 @@ +// +// Created by RM UI Designer +// + +#ifndef UI_indicator_0_11_H +#define UI_indicator_0_11_H + +#include "ui_interface.h" + +extern ui_interface_string_t *ui_indicator_0_Level_Text; + +void _ui_init_indicator_0_11(); +void _ui_update_indicator_0_11(); +void _ui_remove_indicator_0_11(); + +#endif //UI_indicator_0_11_H diff --git a/src/ui/inc/ui_indicator_1_0.h b/src/ui/inc/ui_indicator_1_0.h index 170bb47..d540338 100644 --- a/src/ui/inc/ui_indicator_1_0.h +++ b/src/ui/inc/ui_indicator_1_0.h @@ -13,6 +13,7 @@ extern ui_interface_rect_t *ui_indicator_1_Autoaim_Select; extern ui_interface_number_t *ui_indicator_1_Supercap; extern ui_interface_line_t *ui_indicator_1_Aim_V_Line; extern ui_interface_line_t *ui_indicator_1_Aim_H_Line; +extern ui_interface_number_t *ui_indicator_1_Level_Indicator; void _ui_init_indicator_1_0(); void _ui_update_indicator_1_0(); diff --git a/src/ui/src/ui_indicator_0_11.c b/src/ui/src/ui_indicator_0_11.c new file mode 100644 index 0000000..09b1d19 --- /dev/null +++ b/src/ui/src/ui_indicator_0_11.c @@ -0,0 +1,47 @@ +// +// Created by RM UI Designer +// + +#include "ui_indicator_0_11.h" +#include "string.h" + +#define FRAME_ID 1 +#define GROUP_ID 0 +#define START_ID 11 + +ui_string_frame_t ui_indicator_0_11; + +ui_interface_string_t* ui_indicator_0_Level_Text = &ui_indicator_0_11.option; + +void _ui_init_indicator_0_11() { + ui_indicator_0_11.option.figure_name[0] = FRAME_ID; + ui_indicator_0_11.option.figure_name[1] = GROUP_ID; + ui_indicator_0_11.option.figure_name[2] = START_ID; + ui_indicator_0_11.option.operate_tpyel = 1; + ui_indicator_0_11.option.figure_tpye = 7; + ui_indicator_0_11.option.layer = 0; + ui_indicator_0_11.option.font_size = 20; + ui_indicator_0_11.option.start_x = 900; + ui_indicator_0_11.option.start_y = 100; + ui_indicator_0_11.option.color = 1; + ui_indicator_0_11.option.str_length = 6; + ui_indicator_0_11.option.width = 2; + strcpy(ui_indicator_0_Level_Text->string, "LEVEL:"); + + ui_proc_string_frame(&ui_indicator_0_11); + SEND_MESSAGE((uint8_t *) &ui_indicator_0_11, sizeof(ui_indicator_0_11)); +} + +void _ui_update_indicator_0_11() { + ui_indicator_0_11.option.operate_tpyel = 2; + + ui_proc_string_frame(&ui_indicator_0_11); + SEND_MESSAGE((uint8_t *) &ui_indicator_0_11, sizeof(ui_indicator_0_11)); +} + +void _ui_remove_indicator_0_11() { + ui_indicator_0_11.option.operate_tpyel = 3; + + ui_proc_string_frame(&ui_indicator_0_11); + SEND_MESSAGE((uint8_t *) &ui_indicator_0_11, sizeof(ui_indicator_0_11)); +} \ No newline at end of file diff --git a/src/ui/src/ui_indicator_1_0.c b/src/ui/src/ui_indicator_1_0.c index c14f06c..bc000e7 100644 --- a/src/ui/src/ui_indicator_1_0.c +++ b/src/ui/src/ui_indicator_1_0.c @@ -7,7 +7,7 @@ #define FRAME_ID 1 #define GROUP_ID 1 #define START_ID 0 -#define OBJ_NUM 6 +#define OBJ_NUM 7 #define FRAME_OBJ_NUM 7 CAT(ui_, CAT(FRAME_OBJ_NUM, _frame_t)) ui_indicator_1_0; @@ -17,6 +17,7 @@ ui_interface_rect_t *ui_indicator_1_Autoaim_Select = (ui_interface_rect_t *)&(ui ui_interface_number_t *ui_indicator_1_Supercap = (ui_interface_number_t *)&(ui_indicator_1_0.data[3]); ui_interface_line_t *ui_indicator_1_Aim_V_Line = (ui_interface_line_t *)&(ui_indicator_1_0.data[4]); ui_interface_line_t *ui_indicator_1_Aim_H_Line = (ui_interface_line_t *)&(ui_indicator_1_0.data[5]); +ui_interface_number_t *ui_indicator_1_Level_Indicator = (ui_interface_number_t *)&(ui_indicator_1_0.data[6]); void _ui_init_indicator_1_0() { for (int i = 0; i < OBJ_NUM; i++) { @@ -82,6 +83,15 @@ void _ui_init_indicator_1_0() { ui_indicator_1_Aim_H_Line->end_y = 470; ui_indicator_1_Aim_H_Line->color = 3; ui_indicator_1_Aim_H_Line->width = 2; + + ui_indicator_1_Level_Indicator->figure_tpye = 6; + ui_indicator_1_Level_Indicator->layer = 1; + ui_indicator_1_Level_Indicator->font_size = 20; + ui_indicator_1_Level_Indicator->start_x = 1020; + ui_indicator_1_Level_Indicator->start_y = 100; + ui_indicator_1_Level_Indicator->color = 1; + ui_indicator_1_Level_Indicator->number = 1; + ui_indicator_1_Level_Indicator->width = 2; CAT(ui_proc_, CAT(FRAME_OBJ_NUM, _frame))(&ui_indicator_1_0); SEND_MESSAGE((uint8_t *) &ui_indicator_1_0, sizeof(ui_indicator_1_0));