#include "shoot_task.h"
#include "TopDefine.h"
#include "FreeRTOS.h"
#include "attrTask.h"
#include <cmsis_os2.h>
#include "remote_control.h"
#include "shoot.h"
#include "dji.h"
#include "go.h"


extern RC_mess_t RC_mess;
extern motor_measure_t *trigger_motor_data;//3508电机数据
extern GO go;

int gopos=0;


#define VESC_SHOOT 1


void Task_Shoot(void *argument)
{
    (void)argument; /* 未使用argument，消除警告 */
   const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_CAN;
   
   #if GO1_SHOOT == 1   
   shooterInit();
   #endif

 uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计算 */

	 //go.angleSetgo[0] = 0; //id暂时未知
	  GO_TURN_ball(TURN,go,gopos); //发射舵机位置
	  osDelay(500);
    while(1)
    {
    
      #if VESC_SHOOT == 1
      gopos=35;//云台位置
      GO_TURN_ball(GIMBAL,go,gopos); //锁云台
      control_shoot();

      

      #endif
     tick += delay_tick; /* 计算下一个唤醒时刻 */
     osDelayUntil(tick); /* 运行结束，等待下一个周期唤醒 */
    }

}
