diff --git a/AUTO_CHASSIS.ioc b/AUTO_CHASSIS.ioc
index f608f02..cd34fe9 100644
--- a/AUTO_CHASSIS.ioc
+++ b/AUTO_CHASSIS.ioc
@@ -145,23 +145,24 @@ Mcu.Pin24=PA4
Mcu.Pin25=PC4
Mcu.Pin26=PC5
Mcu.Pin27=PE9
-Mcu.Pin28=PA7
-Mcu.Pin29=PB0
+Mcu.Pin28=PE11
+Mcu.Pin29=PA7
Mcu.Pin3=PB3
-Mcu.Pin30=VP_CRC_VS_CRC
-Mcu.Pin31=VP_FREERTOS_VS_CMSIS_V2
-Mcu.Pin32=VP_SYS_VS_Systick
-Mcu.Pin33=VP_TIM4_VS_ClockSourceINT
-Mcu.Pin34=VP_TIM7_VS_ClockSourceINT
-Mcu.Pin35=VP_TIM10_VS_ClockSourceINT
-Mcu.Pin36=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
+Mcu.Pin30=PB0
+Mcu.Pin31=VP_CRC_VS_CRC
+Mcu.Pin32=VP_FREERTOS_VS_CMSIS_V2
+Mcu.Pin33=VP_SYS_VS_Systick
+Mcu.Pin34=VP_TIM4_VS_ClockSourceINT
+Mcu.Pin35=VP_TIM7_VS_ClockSourceINT
+Mcu.Pin36=VP_TIM10_VS_ClockSourceINT
+Mcu.Pin37=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
Mcu.Pin4=PA14
Mcu.Pin5=PA13
Mcu.Pin6=PB7
Mcu.Pin7=PB6
Mcu.Pin8=PD0
Mcu.Pin9=PC11
-Mcu.PinsNb=37
+Mcu.PinsNb=38
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F407IGHx
@@ -272,12 +273,14 @@ PD14.GPIOParameters=GPIO_Label
PD14.GPIO_Label=Buzzer
PD14.Locked=true
PD14.Signal=S_TIM4_CH3
-PE9.GPIOParameters=PinState,GPIO_PuPd,GPIO_Label
-PE9.GPIO_Label=FlagForUpper
+PE11.GPIOParameters=GPIO_PuPd
+PE11.GPIO_PuPd=GPIO_PULLUP
+PE11.Locked=true
+PE11.Signal=GPIO_Input
+PE9.GPIOParameters=GPIO_PuPd
PE9.GPIO_PuPd=GPIO_PULLUP
PE9.Locked=true
-PE9.PinState=GPIO_PIN_SET
-PE9.Signal=GPIO_Output
+PE9.Signal=GPIO_Input
PF6.GPIOParameters=GPIO_Speed,GPIO_Label
PF6.GPIO_Label=IMU_HEAT_PWM
PF6.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
diff --git a/Core/Inc/main.h b/Core/Inc/main.h
index 9f65da1..8d46470 100644
--- a/Core/Inc/main.h
+++ b/Core/Inc/main.h
@@ -78,8 +78,6 @@ void Error_Handler(void);
#define GYRO_INT_Pin GPIO_PIN_5
#define GYRO_INT_GPIO_Port GPIOC
#define GYRO_INT_EXTI_IRQn EXTI9_5_IRQn
-#define FlagForUpper_Pin GPIO_PIN_9
-#define FlagForUpper_GPIO_Port GPIOE
#define GYRO_CS_Pin GPIO_PIN_0
#define GYRO_CS_GPIO_Port GPIOB
diff --git a/Core/Inc/stm32f4xx_hal_conf.h b/Core/Inc/stm32f4xx_hal_conf.h
index cf0bc67..8495479 100644
--- a/Core/Inc/stm32f4xx_hal_conf.h
+++ b/Core/Inc/stm32f4xx_hal_conf.h
@@ -190,7 +190,7 @@
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */
#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */
-#define USE_HAL_UART_REGISTER_CALLBACKS 1U /* UART register callback disabled */
+#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */
#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */
diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c
index 7b59a61..03b692d 100644
--- a/Core/Src/gpio.c
+++ b/Core/Src/gpio.c
@@ -60,9 +60,6 @@ void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(ACCL_CS_GPIO_Port, ACCL_CS_Pin, GPIO_PIN_SET);
- /*Configure GPIO pin Output Level */
- HAL_GPIO_WritePin(FlagForUpper_GPIO_Port, FlagForUpper_Pin, GPIO_PIN_SET);
-
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GYRO_CS_GPIO_Port, GYRO_CS_Pin, GPIO_PIN_SET);
@@ -92,12 +89,11 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
- /*Configure GPIO pin : PtPin */
- GPIO_InitStruct.Pin = FlagForUpper_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ /*Configure GPIO pins : PE9 PE11 */
+ GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_11;
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(FlagForUpper_GPIO_Port, &GPIO_InitStruct);
+ HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = GYRO_CS_Pin;
diff --git a/Core/Src/main.c b/Core/Src/main.c
index 39a953b..f48044b 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -79,7 +79,8 @@ int main(void)
/* MCU Configuration--------------------------------------------------------*/
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. * HAL_Init();
+ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
+ HAL_Init();
/* USER CODE BEGIN Init */
@@ -94,7 +95,6 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
-
MX_DMA_Init();
MX_SPI1_Init();
MX_TIM4_Init();
diff --git a/MDK-ARM/AUTO_CHASSIS.uvoptx b/MDK-ARM/AUTO_CHASSIS.uvoptx
index 5fb0e6c..e280df3 100644
--- a/MDK-ARM/AUTO_CHASSIS.uvoptx
+++ b/MDK-ARM/AUTO_CHASSIS.uvoptx
@@ -120,7 +120,7 @@
0
ST-LINKIII-KEIL_SWO
- -U00160029510000164E574E32 -O206 -SF5000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO131091 -TC12000000 -TT12000000 -TP21 -TDS8005 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407IGHx$CMSIS\Flash\STM32F4xx_1024.FLM)
+ -U00260035480000034E575152 -O206 -SF5000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO131091 -TC12000000 -TT12000000 -TP21 -TDS8005 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407IGHx$CMSIS\Flash\STM32F4xx_1024.FLM)
0
@@ -235,6 +235,21 @@
1
flaggg,0x0A
+
+ 16
+ 1
+ aaaa,0x0A
+
+
+ 17
+ 1
+ imu_temp_pid_param,0x0A
+
+
+ 18
+ 1
+ imu_temp,0x0A
+
diff --git a/MDK-ARM/ELE_CHASSIS/AUTO_CHASSIS.axf b/MDK-ARM/ELE_CHASSIS/AUTO_CHASSIS.axf
index 669a09d..ec8d789 100644
Binary files a/MDK-ARM/ELE_CHASSIS/AUTO_CHASSIS.axf and b/MDK-ARM/ELE_CHASSIS/AUTO_CHASSIS.axf differ
diff --git a/User/Module/up.c b/User/Module/up.c
index 9c35bbd..9c483a4 100644
--- a/User/Module/up.c
+++ b/User/Module/up.c
@@ -70,6 +70,10 @@ int8_t UP_UpdateFeedback(UP_t *u, const CAN_t *can, CMD_t *c) {
u->cmd =c;
+ if(HAL_GPIO_ReadPin (GPIOE,GPIO_PIN_9)==GPIO_PIN_RESET) u->Light_Flag =1;
+ else u->Light_Flag =0;
+
+
return 0;
}
@@ -201,9 +205,11 @@ int8_t ALL_Motor_Control(UP_t *u,CAN_Output_t *out)
- GO_SendData(u,0 ,u->motor_target .go_shoot );
+ GO_SendData(u,0 ,u->motor_target .go_shoot );
GO_SendData(u,1 ,u->motor_target .go_spin);
+ VESC_M5065_Control(u, u->motor_target .VESC_5065_M1_rpm );
+
for(int i=0;i<4;i++){
out ->motor3508 .as_array[i]=u->final_out.final_3508out [i] ;
@@ -211,6 +217,7 @@ int8_t ALL_Motor_Control(UP_t *u,CAN_Output_t *out)
out ->chassis5065 .erpm [0]= u->final_out .final_VESC_5065_M1out ;
out ->chassis5065 .erpm [1]= -u->final_out .final_VESC_5065_M2out ;
+
out ->chassis6020 .as_array [2]=u->final_out .final_pitchout ;
@@ -264,30 +271,22 @@ int8_t UP_control(UP_t *u,CAN_Output_t *out,CMD_t *c)
u->state .Pitch_flag =Not_started_Pit;
u->state .last_state = Not_started_Pit;
- u->motor_target .go_shoot =0;
- u->motor_target .M2006_angle =-140;
-
+
break;
case Pitch_pull :
if(u->state .last_state == Not_started_Pit)
{
- u->motor_target .go_shoot =-300;
- u->motor_target .M2006_angle =-140;
-
- if(u->motorfeedback .GO_motor_info[0]->Pos < (-4.8)) //到达位置后再扣扳机
- {
- u->motor_target .M2006_angle =0;
- if(u->motorfeedback .M2006.total_angle>-5)
- {//避免没勾上就拉
- u->motor_target .go_shoot =0;
- u->state .Pitch_flag = Launch_Ready ;
+ u->motor_target .VESC_5065_M1_rpm = 40000;
+ u->motor_target .VESC_5065_M2_rpm = 40000;
+
+ u->state .Pitch_flag = Launch_Ready ;
u->state .last_state = Launch_Ready;
- }
- }
+
+
}
break ;
@@ -296,8 +295,18 @@ int8_t UP_control(UP_t *u,CAN_Output_t *out,CMD_t *c)
{
u->motor_target .M2006_angle =-140;
+ if((u->Light_Flag) ==1){
+
+ u->motor_target .VESC_5065_M1_rpm = 0;
+ u->motor_target .VESC_5065_M2_rpm = 0;
+
+ u->motor_target .M2006_angle =0;
+
u->state .Pitch_flag = Done_Pit ;
u->state .last_state = Done_Pit;
+
+
+ }
}
{
diff --git a/User/Module/up.h b/User/Module/up.h
index 6630a7b..f66056b 100644
--- a/User/Module/up.h
+++ b/User/Module/up.h
@@ -117,6 +117,7 @@ typedef struct
typedef struct{
uint8_t up_task_run;
+
const UP_Param_t *param;
UP_Imu_t pos088;
@@ -124,6 +125,8 @@ typedef struct{
/*控制及状态*/
CMD_t *cmd;
Oper_control_state_t state;//上层机构的运行状态
+
+ int Light_Flag;
struct{
fp32 rotor_pit6020ecd;
@@ -192,7 +195,7 @@ typedef struct{
LowPassFilter2p_t filled[6]; /* 输出滤波器滤波器数组 */
- fp32 vofa_send[8];
+ fp32 vofa_send[8];
diff --git a/User/task/up_task.c b/User/task/up_task.c
index 1fe2e44..861289b 100644
--- a/User/task/up_task.c
+++ b/User/task/up_task.c
@@ -35,7 +35,7 @@ float aaa=0;
float bbb=0;
float CCC=0;
-
+int aaaa;
/**
* \brief
*
@@ -59,10 +59,10 @@ void Task_up(void *argument)
// GM6020_control(&UP, 100) ;
// UP_M3508_speed(&UP, 500);
-// UP_angle_control(&UP,0,M2006);
+// UP_angle_control(&UP,bbb,M2006);
//
//
-// VESC_M5065_Control(&UP, 20000);
+// VESC_M5065_Control(&UP, 2000);
//
@@ -70,7 +70,7 @@ void Task_up(void *argument)
// GO_SendData(&UP, 0,aaa);
UP_control(&UP,&UP_CAN_out,&up_cmd);
ALL_Motor_Control(&UP,&UP_CAN_out);
-
+
osDelay(1);