#include "ai.h"
#include <string.h>
#include "bsp\uart.h"
#include "component\crc16.h"
#include "component\user_math.h"
#include "gimbal.h"
#include "shoot.h"
#include "remote_control.h"
#define a_pit 0.000744005
#define b_pit 0.10966763
#define a_yaw 0.0078782936
#define b_yaw 0.011819322
int8_t remote_ParseHost(Gimbal_CMD_t *g_cmd,RC_ctrl_t *rc_ctrl,Gimbal_IMU_t*imu) 
{
	if(rc_ctrl->sw[2]==1800){
	g_cmd->mode=GIMBAL_MODE_ABSOLUTE;
	g_cmd->delta_pit=((rc_ctrl->ch[2]-780)*(0.6/791));//806~-780,0.473~-0.71
	g_cmd->delta_yaw=((rc_ctrl->ch[0])*(1.8/808));//400~-397
	}
	if(rc_ctrl->sw[2]==200)
	{
	g_cmd->mode=GIMBAL_MODE_RELAX;
	}
}

int8_t remote_shoot_ParseHost(COMP_AT9S_CMD_t *s_cmd,RC_ctrl_t *rc_ctrl) 
{
	if(rc_ctrl!=NULL)s_cmd->online=true;	
	if(rc_ctrl->sw[3]==1800)
	{
		s_cmd->shoot.firecmd=false;
		s_cmd->shoot.ready=false;
//		s_cmd->mode=SHOOT_MODE_SAFE;	
	}	
//	if(rc_ctrl->sw[3]==1000){
//		s_cmd->mode=SHOOT_MODE_SINGLE;
//	}
//	if(rc_ctrl->sw[3]==200){
//		s_cmd->mode=SHOOT_MODE_BURST;	
//	}
		if(rc_ctrl->sw[4]==200){
		s_cmd->shoot.firecmd=false;
		s_cmd->shoot.ready=false;
	}
		if(rc_ctrl->sw[4]==1000){
		s_cmd->shoot.ready=true;
		s_cmd->shoot.firecmd=false;	
		}
		if(rc_ctrl->sw[4]==1800){
			s_cmd->shoot.ready=true;
			s_cmd->shoot.firecmd=true;	
			}
}








