Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
解决误码问题
#8 连续的输出导致误码。
这个bug目前只是绕开了,要彻底解决得完成对资源的控制。
  • Loading branch information
xxyyttxx committed Jan 1, 2018
1 parent 7dc9fc8 commit 4271a29
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 36 deletions.
39 changes: 9 additions & 30 deletions project/p10-ANO/application/data_transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ void ANO_DT_Data_Exchange(void)
// void ANO_DT_Send_Fx_pid_ans(u8 Fx, float rcver_rol, float rcver_pit, float rcver_yaw,
// float error_rol, float error_pit, float error_yaw,
// float react_rol, float react_pit, float react_yaw);

ANO_DT_Send_Fx_pid_ans(0xF1,
static u8 buf[50];
ANO_DT_Send_Fx_9float(buf, 0xF1,
roll_angle_PID.Desired, pitch_angle_PID.Desired, yaw_angle_PID.Desired,
roll_angle_PID.Error, pitch_angle_PID.Error, yaw_angle_PID.Error,
roll_angle_PID.Output, pitch_angle_PID.Output, yaw_angle_PID.Output
Expand All @@ -163,7 +163,8 @@ void ANO_DT_Data_Exchange(void)
// void ANO_DT_Send_Fx_pid_part(u8 Fx, float P_Output_rol, float P_Output_pit, float P_Output_yaw,
// float I_Output_rol, float I_Output_pit, float I_Output_yaw,
// float D_Output_rol, float D_Output_rol, float D_Output_rol);
ANO_DT_Send_Fx_pid_part( 0xF2,
static u8 buf[50];
ANO_DT_Send_Fx_9float(buf, 0xF2,
// PID->P * PID->Error
roll_angle_PID.D * roll_angle_PID.Error,
pitch_angle_PID.D * pitch_angle_PID.Error,
Expand All @@ -184,8 +185,8 @@ void ANO_DT_Data_Exchange(void)
// void ANO_DT_Send_Fx_pid_ans(u8 Fx, float rcver_rol, float rcver_pit, float rcver_yaw,
// float error_rol, float error_pit, float error_yaw,
// float react_rol, float react_pit, float react_yaw);

ANO_DT_Send_Fx_pid_ans(0xF3,
static u8 buf[50];
ANO_DT_Send_Fx_9float(buf, 0xF3,
roll_rate_PID.Desired, pitch_rate_PID.Desired, yaw_rate_PID.Desired,
roll_rate_PID.Error, pitch_rate_PID.Error, yaw_rate_PID.Error,
roll_rate_PID.Output, pitch_rate_PID.Output, yaw_rate_PID.Output
Expand All @@ -197,7 +198,8 @@ void ANO_DT_Data_Exchange(void)
// void ANO_DT_Send_Fx_pid_part(u8 Fx, float P_Output_rol, float P_Output_pit, float P_Output_yaw,
// float I_Output_rol, float I_Output_pit, float I_Output_yaw,
// float D_Output_rol, float D_Output_rol, float D_Output_rol);
ANO_DT_Send_Fx_pid_part( 0xF4,
static u8 buf[50];
ANO_DT_Send_Fx_9float(buf, 0xF4,
// PID->P * PID->Error
roll_rate_PID.D * roll_rate_PID.Error,
pitch_rate_PID.D * pitch_rate_PID.Error,
Expand Down Expand Up @@ -645,12 +647,11 @@ void ANO_DT_Send_PID(u8 group,float p1_p,float p1_i,float p1_d,float p2_p,float
/******************* (C) COPYRIGHT 2014 ANO TECH *****END OF FILE************/


void ANO_DT_Send_Fx_9float(u8 Fx,
void ANO_DT_Send_Fx_9float(u8 data_to_send[], u8 Fx,
float _f1, float _f2, float _f3,
float _f4, float _f5, float _f6,
float _f7, float _f8, float _f9)
{
static u8 data_to_send[200];
u8 _cnt=0;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
Expand Down Expand Up @@ -705,25 +706,3 @@ void ANO_DT_Send_Fx_9float(u8 Fx,

ANO_DT_Send_Data(data_to_send, _cnt);
}

void ANO_DT_Send_Fx_pid_ans(u8 Fx,
float rcver_rol, float rcver_pit, float rcver_yaw,
float error_rol, float error_pit, float error_yaw,
float react_rol, float react_pit, float react_yaw)
{
ANO_DT_Send_Fx_9float(Fx,
rcver_rol, rcver_pit, rcver_yaw,
error_rol, error_pit, error_yaw,
react_rol, react_pit, react_yaw);
}

void ANO_DT_Send_Fx_pid_part(u8 Fx,
float P_Output_rol, float P_Output_pit, float P_Output_yaw,
float I_Output_rol, float I_Output_pit, float I_Output_yaw,
float D_Output_rol, float D_Output_pit, float D_Output_yaw)
{
ANO_DT_Send_Fx_9float(Fx,
P_Output_rol, P_Output_pit, P_Output_yaw,
I_Output_rol, I_Output_pit, I_Output_yaw,
D_Output_rol, D_Output_pit, D_Output_yaw);
}
16 changes: 10 additions & 6 deletions project/p10-ANO/application/data_transfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ void ANO_DT_Send_RCData(u16 thr,u16 yaw,u16 rol,u16 pit,u16 aux1,u16 aux2,u16 au
void ANO_DT_Send_Power(u16 votage, u16 current);
void ANO_DT_Send_MotoPWM(u16 m_1,u16 m_2,u16 m_3,u16 m_4,u16 m_5,u16 m_6,u16 m_7,u16 m_8);
void ANO_DT_Send_PID(u8 group,float p1_p,float p1_i,float p1_d,float p2_p,float p2_i,float p2_d,float p3_p,float p3_i,float p3_d);
void ANO_DT_Send_Fx_pid_ans(u8 Fx, float rcver_rol, float rcver_pit, float rcver_yaw,
float error_rol, float error_pit, float error_yaw,
float react_rol, float react_pit, float react_yaw);
void ANO_DT_Send_Fx_pid_part(u8 Fx, float P_Output_rol, float P_Output_pit, float P_Output_yaw,
float I_Output_rol, float I_Output_pit, float I_Output_yaw,
float D_Output_rol, float D_Output_pit, float D_Output_yaw);
// void ANO_DT_Send_Fx_pid_ans(u8 Fx, float rcver_rol, float rcver_pit, float rcver_yaw,
// float error_rol, float error_pit, float error_yaw,
// float react_rol, float react_pit, float react_yaw);
// void ANO_DT_Send_Fx_pid_part(u8 Fx, float P_Output_rol, float P_Output_pit, float P_Output_yaw,
// float I_Output_rol, float I_Output_pit, float I_Output_yaw,
// float D_Output_rol, float D_Output_pit, float D_Output_yaw);
void ANO_DT_Send_Fx_9float(u8 buf[], u8 Fx,
float _f1, float _f2, float _f3,
float _f4, float _f5, float _f6,
float _f7, float _f8, float _f9);

#endif /* _DATA_TRANSFER_H */

0 comments on commit 4271a29

Please sign in to comment.