#include "dji_task.h"
#include "TopDefine.h"//事件组的一些东西
#include "FreeRTOS.h"
#include "attrTask.h"
#include <cmsis_os2.h>
#include "remote_control.h"
#include "dji.h"
#include "read_spi.h"
#include "vofa.h"
#include "buzzer.h"

extern RC_mess_t RC_mess;

extern int16_t t_result;
extern motor_measure_t *trigger_motor_data;
Encoder_t encoder;

int shoot_f=0;
int pos2006=0;

/**
 * \brief 电机任务
 *
 * \param argument 未使用
 */
void Task_Motor(void *argument)
{
   (void)argument; /* 未使用argument，消除警告 */

  const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_CTRL_CHASSIS;

   motor_init();
   Encoder_Init(&encoder);
   
  uint32_t tick = osKernelGetTickCount();

   while(1)
  {

   if(RC_mess.RC_data.sw[4]==306||shoot_f==3)
   {
     pos2006=200;
     
   }
  else 
   {
     pos2006=0;
  
   }
  
   trigger_pos(pos2006);
   CAN_cmd_1FF(t_result,0,0,0,&hcan1);
   osDelay(1);

   tick += delay_tick;
   osDelayUntil(tick);

  }

}
