#include "remote_cmd.h"
#include <string.h>
#include "bsp\uart.h"
#include "component\crc16.h"
#include "component\crc8.h"
#include "component\user_math.h"
#include "gimbal.h"
#include "device\dr16.h"
#include "shoot.h"

int8_t Gimbal_Cmd( Gimbal_CMD_t *g_cmd, DR16_t *dr16) 
{

    switch (dr16->data.sw_l)
    {
    case DR16_SW_DOWN:
        g_cmd->mode=  GIMBAL_MODE_RELAX;   /* 放松模式 */  
        break;
      case DR16_SW_MID:
        g_cmd->ctrl_mode=  GIMBAL_MODE_REMOTE;   /* 遥控器模式 */
        g_cmd->mode=  GIMBAL_MODE_ABSOLUTE;    
        g_cmd->delta_yaw=0.8*(dr16->raw_data.ch_r_x-1024)/660; /* 云台Yaw速度设定 */
        g_cmd->delta_pit=0.6*(dr16->raw_data.ch_r_y-16)/640; /* 云台Pitch速度设定 */
        break;  
     case DR16_SW_UP:
       g_cmd->ctrl_mode=  GIMBAL_MODE_AI;   /* 遥控器模式 */
        g_cmd->mode=  GIMBAL_MODE_ABSOLUTE;   
        break;
    }

}

int8_t Shoot_Cmd(Shoot_CMD_t *s_cmd,DR16_t *dr16) 
{

    switch (dr16->data.sw_r)
    {
    case DR16_SW_DOWN:
				s_cmd->firecmd=false;
				s_cmd->ready=false;
        break;
      case DR16_SW_MID:
        s_cmd->firecmd=false;
				s_cmd->ready=true;
        break;  
     case DR16_SW_UP:
        s_cmd->firecmd=true;
        s_cmd->ready=true;
        break;
    }

}






