diff --git a/src/app/inc/robot.h b/src/app/inc/robot.h index 00c6059..47a0eb0 100644 --- a/src/app/inc/robot.h +++ b/src/app/inc/robot.h @@ -36,6 +36,7 @@ typedef struct uint8_t prev_G; uint8_t prev_V; uint8_t prev_Z; + uint8_t prev_Shift; uint8_t prev_left_switch; } Key_Prev_t; diff --git a/src/app/src/robot.c b/src/app/src/robot.c index c16c788..da462ac 100644 --- a/src/app/src/robot.c +++ b/src/app/src/robot.c @@ -140,7 +140,7 @@ void Robot_Cmd_Loop() /* Launch control starts here */ g_launch_target.heat_count++; - if (Referee_Robot_State.Shooter_Heat_1 < (Referee_Robot_State.Heat_Max-10)) + if (Referee_Robot_State.Shooter_Heat_1 < (Referee_Robot_State.Heat_Max-20)) { if (g_remote.controller.wheel < -50.0f) { // dial wheel forward single fire @@ -188,10 +188,19 @@ void Robot_Cmd_Loop() Referee_Robot_State.Manual_Level++; __MAX_LIMIT(Referee_Robot_State.Manual_Level,1,10); } + if (g_remote.keyboard.Shift == 1) + { + g_supercap.supercap_enabled_flag = 1; + } + else + { + g_supercap.supercap_enabled_flag = 0; + } 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; + g_key_prev.prev_Shift = g_remote.keyboard.Shift; /* Keyboard Toggles Start Here */ /* AutoAiming Flag, not used only for debug */ diff --git a/src/devices/inc/referee_system.h b/src/devices/inc/referee_system.h index c42909c..069f359 100644 --- a/src/devices/inc/referee_system.h +++ b/src/devices/inc/referee_system.h @@ -16,6 +16,7 @@ #include "dma.h" #include "bsp_uart.h" #include "bsp_daemon.h" +#include "supercap.h" #include #include diff --git a/src/devices/inc/supercap.h b/src/devices/inc/supercap.h index c5ab13f..ebb40df 100644 --- a/src/devices/inc/supercap.h +++ b/src/devices/inc/supercap.h @@ -4,6 +4,7 @@ #include #include "bsp_can.h" #include "referee_system.h" +#include "jetson_orin.h" typedef struct { @@ -13,6 +14,7 @@ typedef struct uint8_t send_counter; uint8_t supercap_percent; + uint8_t supercap_enabled_flag; } Supercap_t; void Supercap_Init(Supercap_t *g_supercap); diff --git a/src/devices/src/referee_system.c b/src/devices/src/referee_system.c index 71c92c9..bc7cdf8 100644 --- a/src/devices/src/referee_system.c +++ b/src/devices/src/referee_system.c @@ -26,7 +26,7 @@ void Referee_Set_Robot_State(void) 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_Max = Referee_System.Robot_State.Chassis_Power_Max + g_supercap.supercap_enabled_flag*40.0f;; Referee_Robot_State.Chassis_Power = Referee_System.Power_Heat.Chassis_Power; Referee_Robot_State.Power_Buffer = Referee_System.Power_Heat.Chassis_Power_Buffer; @@ -42,7 +42,7 @@ void Referee_Set_Robot_State(void) 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 = (DEFAULT_STANDARD_POWER_MAX-10)+(Referee_Robot_State.Manual_Level-1)*5; - Referee_Robot_State.Chassis_Power_Max = DEFAULT_STANDARD_POWER_MAX+(Referee_Robot_State.Manual_Level-1)*5; + Referee_Robot_State.Chassis_Power_Max = DEFAULT_STANDARD_POWER_MAX+(Referee_Robot_State.Manual_Level-1)*5+g_supercap.supercap_enabled_flag*20.0f; #endif #ifdef ROBOT_TYPE_HERO diff --git a/src/devices/src/supercap.c b/src/devices/src/supercap.c index 5597845..ad2eef5 100644 --- a/src/devices/src/supercap.c +++ b/src/devices/src/supercap.c @@ -1,6 +1,8 @@ #include "supercap.h" + Supercap_t g_supercap; CAN_Instance_t *supercap_can_instance; +extern Jetson_Orin_Data_t g_orin_data; void Supercap_Init(Supercap_t *g_supercap) { @@ -15,13 +17,21 @@ void Supercap_Decode(CAN_Instance_t *can_instance) { // Send supercap data uint8_t *data = can_instance->rx_buffer; - g_supercap.supercap_percent = data[0]; + g_supercap.supercap_percent = (data[0]-20)*2; } void Supercap_Send(void) { // Send supercap data uint8_t *data = supercap_can_instance->tx_buffer; - data[0] = 45;//Referee_Robot_State.Chassis_Power_Max; + if (g_orin_data.sending.game_start_flag) + { + data[0] = Referee_Robot_State.Chassis_Power_Max; + } + else + { + data[0] = 90; + } + CAN_Transmit(supercap_can_instance); } \ No newline at end of file