74 lines
1.3 KiB
C
74 lines
1.3 KiB
C
#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 "remote_control.h"
|
|
#include "shoot.h"
|
|
int8_t remote_ParseHost(Gimbal_CMD_t *g_cmd,RC_ctrl_t *rc_ctrl,Gimbal_IMU_t*imu)
|
|
{
|
|
if(rc_ctrl->sw[1]==306){
|
|
g_cmd->mode=GIMBAL_MODE_ABSOLUTE;
|
|
// g_cmd->delta_pit=((rc_ctrl->ch[1]-114)*(0.1/758));//806~-780,0.473~-0.71
|
|
// g_cmd->delta_yaw=((rc_ctrl->ch[0]+84)*(1.8/781));//400~-397
|
|
|
|
}
|
|
else if(rc_ctrl->sw[1]==1694)
|
|
{
|
|
g_cmd->mode=GIMBAL_MODE_RELAX;
|
|
}
|
|
|
|
}
|
|
|
|
int8_t shoot_remote_cmd(Shoot_CMD_t *s_cmd,RC_ctrl_t *rc_ctrl,Remote_Mode *mode)
|
|
{
|
|
if(rc_ctrl!=NULL){
|
|
s_cmd->online=true;
|
|
s_cmd->mode=true;
|
|
}
|
|
|
|
if(rc_ctrl->sw[6]==1000){
|
|
s_cmd->online=false;
|
|
s_cmd->mode=false;
|
|
}
|
|
|
|
|
|
if(rc_ctrl->sw[3]==1800){
|
|
s_cmd->firecmd=false;
|
|
s_cmd->ready=false;
|
|
}
|
|
if(rc_ctrl->sw[3]==1000)
|
|
{
|
|
s_cmd->firecmd=false;
|
|
s_cmd->ready=true;
|
|
}
|
|
if(rc_ctrl->sw[3]==200)
|
|
{
|
|
s_cmd->firecmd=true;
|
|
s_cmd->ready=true;
|
|
}
|
|
|
|
|
|
if(rc_ctrl->sw[4]==200){
|
|
mode->S_Mode= SHOOT_MODE_SAFE ; /* 安全模式 */
|
|
}
|
|
if(rc_ctrl->sw[4]==1000)
|
|
{
|
|
mode->S_Mode= SHOOT_MODE_SINGLE ; /* 安全模式 */
|
|
}
|
|
if(rc_ctrl->sw[4]==1800)
|
|
{
|
|
mode->S_Mode= SHOOT_MODE_BURST ; /* 安全模式 */
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|