#include "shoot.h"
#include "remote_control.h"
#include "read_spi.h"

extern RC_mess_t RC_mess;
extern Encoder_t encoder;
extern motor_measure_t *trigger_motor_data;//3508电机数据

int mode=0;
int shoot=0;
int xxx=0;

#define Stop 0
#define Hasten 1
#define Slow 2
#define Shoot 3
#define VESC_ID 77

int speed_6384=-1500;

void control_clutch_shoot(void)
{

    if(mode == Stop)
    {

        if(encoder.round_cnt == 0)
        {

         CAN_VESC_HEAD(VESC_ID);  
        }
  

    }
    else if(mode == Hasten)
    {
       if(shoot ==0)
       { 
        if(encoder.round_cnt <= 2)
        {
 
					xxx=1;
         CAN_VESC_RPM(VESC_ID, speed_6384); 

        }

       }
       else if(shoot ==Shoot)
       {
        if(encoder.round_cnt <= 3)
        {
          xxx=3; 
         HAL_GPIO_WritePin(key_GPIO_Port,key_Pin,GPIO_PIN_SET);

         CAN_VESC_RPM(VESC_ID, speed_6384);     

        }

        //   xxx=3; 
        //  HAL_GPIO_WritePin(key_GPIO_Port,key_Pin,GPIO_PIN_SET);
        //  CAN_VESC_RPM(VESC_ID, speed_6384);     

        if(encoder.round_cnt >= 3)
        {
					xxx=4;
          shoot=Slow;
          HAL_GPIO_WritePin(key_GPIO_Port,key_Pin,GPIO_PIN_RESET);  
            
          CAN_VESC_HEAD(VESC_ID);         
        }
        

       }
        else if(shoot == Slow)
        {

          CAN_VESC_HEAD(VESC_ID); 
   
        }
    }

}
