86 lines
1.6 KiB
C++
86 lines
1.6 KiB
C++
#include "TopDefine.h"
|
||
#include "FreeRTOS.h"
|
||
#include "userTask.h"
|
||
#include <cmsis_os2.h>
|
||
#include "shootTask.hpp"
|
||
#include "shoot.hpp"
|
||
#include "motor.hpp"
|
||
#include "remote_control.h"
|
||
extern RC_ctrl_t rc_ctrl;
|
||
Shoot shoot;
|
||
|
||
int shoot_flag = 0;
|
||
|
||
int anglexiaomi = 0;
|
||
int xxxxx;
|
||
int speed5 = 0;
|
||
int a2;
|
||
|
||
|
||
|
||
// sw[0]2 下306上1694 sw[5]3前306后1694 sw[4]4前1694后306 sw[1]xuan1 sw[3]xuan2
|
||
|
||
//F键 sw[0]👆 1800 中 1000 👇200
|
||
//E键 sw[1]👆 1800 👇200
|
||
|
||
void FunctionShoot(void *argument)
|
||
{
|
||
(void)argument; /* 未使用argument,消除警告 */
|
||
|
||
HAL_Delay(500); //一定时间延时 等待电机初始化完成
|
||
|
||
const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_CTRL_SHOOT;
|
||
|
||
uint32_t tick = osKernelGetTickCount();
|
||
|
||
while(1)
|
||
{
|
||
#ifdef DEBUG
|
||
task_struct.stack_water_mark.shoot = osThreadGetStackSpace(osThreadGetId());
|
||
#endif
|
||
|
||
//我放的任务通知 运球成功放置过来后
|
||
shoot.flag_thread=osThreadFlagsGet();
|
||
|
||
CAN_VESC_Control(2,speed5,&hcan2);
|
||
xxxxx++;
|
||
|
||
CAN_cmd(1,&shoot.JZ_xiaomi);
|
||
HAL_Delay (100);
|
||
|
||
// if(shoot.flag_thread & BALL_OK)
|
||
// {
|
||
// a2=2;
|
||
// // shoot.shootThree();
|
||
// }
|
||
|
||
// shoot_flag=HAL_GPIO_ReadPin(STOP_GPIO_Port, STOP_Pin);
|
||
|
||
// if(rc_ctrl.sw[1]>1000)
|
||
// {
|
||
// shoot.shootStateMachine();
|
||
// if(rc_ctrl.sw[0]==200)
|
||
// {
|
||
// shoot.shootBack();
|
||
// }
|
||
// if(rc_ctrl.sw[0]==1000)
|
||
// {
|
||
// shoot.shootStop();
|
||
// }
|
||
// }
|
||
// if(rc_ctrl.sw[1]==200)
|
||
// {
|
||
// shoot.shootStop();
|
||
|
||
// }
|
||
|
||
// shoot.trigger_control();
|
||
// osDelay(2);
|
||
|
||
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
||
osDelayUntil(tick);
|
||
|
||
}
|
||
}
|
||
|