1 Star 0 Fork 8

Anderson/vtor_elec_module

forked from vtor3478/vtor_elec_module 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ano_dt.c 16.12 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
#include "ano_dt.h"
#include "vtor_elec_module.h"
#ifdef __ANO_DT__
#define BYTE0(dwTemp) ( *( (char *)(&dwTemp) ) )
#define BYTE1(dwTemp) ( *( (char *)(&dwTemp) + 1) )
#define BYTE2(dwTemp) ( *( (char *)(&dwTemp) + 2) )
#define BYTE3(dwTemp) ( *( (char *)(&dwTemp) + 3) )
dt_flag_t f;
uint8_t data_to_send[50];
void ANO_DT_Send_VtorTimer(void);
void ANO_DT_Send_PidValueWave(void);
#define __VTOR_COLLECT_ANO_DT_CONFIG_SEND_RESERVE__
#ifdef __VTOR_COLLECT_ANO_DT_CONFIG_SEND_RESERVE__
// 定义接口函数,避免编译错误
void ANO_DT_Send_Data(uint8_t* data_to_send, uint8_t _cnt)
{
}
#endif
void ANO_DT_Data_Exchange(void)
{
static uint8_t cnt = 0;
static uint8_t senser_cnt = 10;
static uint8_t status_cnt = 15;
static uint8_t rcdata_cnt = 20;
static uint8_t motopwm_cnt = 20;
static uint8_t power_cnt = 50;
if((cnt % senser_cnt) == (senser_cnt-1))
f.send_senser = 1;
if((cnt % status_cnt) == (status_cnt-1))
f.send_status = 1;
if((cnt % rcdata_cnt) == (rcdata_cnt-1))
f.send_rcdata = 1;
if((cnt % motopwm_cnt) == (motopwm_cnt-1))
f.send_motopwm = 1;
if((cnt % power_cnt) == (power_cnt-1))
f.send_power = 1;
cnt++;
/////////////////////////////////////////////////////////////////////////////////////
if(f.send_version)
{
f.send_version = 0;
// ANO_DT_Send_Version(4,300,100,400,0);
}
/////////////////////////////////////////////////////////////////////////////////////
else if(f.send_status)
{
//extern float Pitch,Roll,Yaw;
//float Pitch,Roll,Yaw;
//Pitch = 50;
//Roll = 11;
//Yaw = 180;
f.send_status = 0;
//ANO_DT_Send_Status(Roll,Pitch,Yaw,baroAlt,0,fly_ready);
//ANO_DT_Send_Status(Roll,Pitch,Yaw,0,0,0);
//ANO_DT_Send_Status(devStatus.roll,devStatus.pitch,devStatus.yaw,0,0,0);
//ANO_DT_Send_VtorTimer();
ANO_DT_Send_PidValueWave();
}
/////////////////////////////////////////////////////////////////////////////////////
else if(f.send_senser)
{
f.send_senser = 0;
//ANO_DT_Send_Senser(mpu6050.Acc.x,mpu6050.Acc.y,mpu6050.Acc.z,
// mpu6050.Gyro.x,mpu6050.Gyro.y,mpu6050.Gyro.z,
// 0, 0, 0, 0);
//ak8975.Mag_Adc.x,ak8975.Mag_Adc.y,ak8975.Mag_Adc.z,0);
}
/////////////////////////////////////////////////////////////////////////////////////
else if(f.send_rcdata)
{
f.send_rcdata = 0;
// ANO_DT_Send_RCData(Rc_Pwm_In[0],Rc_Pwm_In[1],Rc_Pwm_In[2],Rc_Pwm_In[3],Rc_Pwm_In[4],Rc_Pwm_In[5],Rc_Pwm_In[6],Rc_Pwm_In[7],0,0);
}
/////////////////////////////////////////////////////////////////////////////////////
else if(f.send_motopwm)
{
f.send_motopwm = 0;
// ANO_DT_Send_MotoPWM(1,2,3,4,5,6,7,8);
}
/////////////////////////////////////////////////////////////////////////////////////
else if(f.send_power)
{
f.send_power = 0;
//ANO_DT_Send_Power(123,456);
//ANO_DT_Send_UserData(0xf1, dutyArray, 10);
}
/////////////////////////////////////////////////////////////////////////////////////
else if(f.send_pid1)
{
f.send_pid1 = 0;
// ANO_DT_Send_PID(1,ctrl_1.PID[PIDROLL].kp,ctrl_1.PID[PIDROLL].ki,ctrl_1.PID[PIDROLL].kd,
// ctrl_1.PID[PIDPITCH].kp,ctrl_1.PID[PIDPITCH].ki,ctrl_1.PID[PIDPITCH].kd,
// ctrl_1.PID[PIDYAW].kp,ctrl_1.PID[PIDYAW].ki,ctrl_1.PID[PIDYAW].kd);
}
/////////////////////////////////////////////////////////////////////////////////////
else if(f.send_pid2)
{
f.send_pid2 = 0;
// ANO_DT_Send_PID(2,ctrl_1.PID[PID4].kp,ctrl_1.PID[PID4].ki,ctrl_1.PID[PID4].kd,
// ctrl_1.PID[PID5].kp,ctrl_1.PID[PID5].ki,ctrl_1.PID[PID5].kd,
// ctrl_1.PID[PID6].kp,ctrl_1.PID[PID6].ki,ctrl_1.PID[PID6].kd);
}
/////////////////////////////////////////////////////////////////////////////////////
else if(f.send_pid3)
{
f.send_pid3 = 0;
// ANO_DT_Send_PID(3,ctrl_2.PID[PIDROLL].kp,ctrl_2.PID[PIDROLL].ki,ctrl_2.PID[PIDROLL].kd,
// ctrl_2.PID[PIDPITCH].kp,ctrl_2.PID[PIDPITCH].ki,ctrl_2.PID[PIDPITCH].kd,
// ctrl_2.PID[PIDYAW].kp,ctrl_2.PID[PIDYAW].ki,ctrl_2.PID[PIDYAW].kd);
}
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
//Usb_Hid_Send();
/////////////////////////////////////////////////////////////////////////////////////
}
static void ANO_DT_Send_Check(uint8_t head, uint8_t check_sum)
{
data_to_send[0]=0xAA;
data_to_send[1]=0xAA;
data_to_send[2]=0xEF;
data_to_send[3]=2;
data_to_send[4]=head;
data_to_send[5]=check_sum;
uint8_t sum = 0;
for(uint8_t i=0;i<6;i++)
sum += data_to_send[i];
data_to_send[6]=sum;
ANO_DT_Send_Data(data_to_send, 7);
}
void ANO_DT_Data_Receive_Prepare(uint8_t data)
{
static uint8_t RxBuffer[50];
static uint8_t _data_len = 0,_data_cnt = 0;
static uint8_t state = 0;
if(state==0&&data==0xAA)
{
state=1;
RxBuffer[0]=data;
}
else if(state==1&&data==0xAF)
{
state=2;
RxBuffer[1]=data;
}
else if(state==2&&data<0XF1)
{
state=3;
RxBuffer[2]=data;
}
else if(state==3&&data<50)
{
state = 4;
RxBuffer[3]=data;
_data_len = data;
_data_cnt = 0;
}
else if(state==4&&_data_len>0)
{
_data_len--;
RxBuffer[4+_data_cnt++]=data;
if(_data_len==0)
state = 5;
}
else if(state==5)
{
state = 0;
RxBuffer[4+_data_cnt]=data;
ANO_DT_Data_Receive_Anl(RxBuffer,_data_cnt+5);
}
else
state = 0;
}
void ANO_DT_Data_Receive_Anl(uint8_t *data_buf,uint8_t num)
{
uint8_t sum = 0;
for(uint8_t i=0;i<(num-1);i++)
sum += *(data_buf+i);
if(!(sum==*(data_buf+num-1))) return; //�ж�sum
if(!(*(data_buf)==0xAA && *(data_buf+1)==0xAF)) return; //�ж�֡ͷ
if(*(data_buf+2)==0X01)
{
// if(*(data_buf+4)==0X01)
// mpu6050.Acc_CALIBRATE = 1;
// if(*(data_buf+4)==0X02)
// mpu6050.Gyro_CALIBRATE = 1;
// if(*(data_buf+4)==0X03)
// {
// mpu6050.Acc_CALIBRATE = 1;
// mpu6050.Gyro_CALIBRATE = 1;
// }
}
if(*(data_buf+2)==0X02)
{
if(*(data_buf+4)==0X01)
{
f.send_pid1 = 1;
f.send_pid2 = 1;
f.send_pid3 = 1;
f.send_pid4 = 1;
f.send_pid5 = 1;
f.send_pid6 = 1;
}
if(*(data_buf+4)==0X02)
{
}
if(*(data_buf+4)==0XA0)
{
f.send_version = 1;
}
if(*(data_buf+4)==0XA1)
{
// Para_ResetToFactorySetup();
}
}
if(*(data_buf+2)==0X10) //PID1
{
uint8_t i = 0;
volatile int16_t anoDtPidEdit[3][3] = {0};
for(i = 0; i < 9; i++)
{
anoDtPidEdit[i/3][i%3] = (volatile int16_t)(*(data_buf+4 + i * 2)<<8)|*(data_buf+5 + i * 2);
}
/*
attiSpdPid->kp = anoDtPidEdit[0][0] / 1000.0f;
attiSpdPid->ki = anoDtPidEdit[0][1] / 1000.0f;
attiSpdPid->kd = anoDtPidEdit[0][2] / 1000.0f;
leftSpeedPid->kp = anoDtPidEdit[1][0] / 1000.0f;
leftSpeedPid->ki = anoDtPidEdit[1][1] / 1000.0f;
leftSpeedPid->kd = anoDtPidEdit[1][2] / 1000.0f;
rightSpeedPid->kp = anoDtPidEdit[2][0] / 1000.0f;
rightSpeedPid->ki = anoDtPidEdit[2][1] / 1000.0f;
rightSpeedPid->kd = anoDtPidEdit[2][2] / 1000.0f;
*/
ANO_DT_Send_Check(*(data_buf+2),sum);
// Param_SavePID();
}
if(*(data_buf+2)==0X11) //PID2
{
uint8_t i = 0;
volatile int16_t anoDtPidEdit[3][3] = {0};
for(i = 0; i < 9; i++)
{
anoDtPidEdit[i/3][i%3] = (volatile int16_t)(*(data_buf+4 + i * 2)<<8)|*(data_buf+5 + i * 2);
}
/*
attiPid->kp = anoDtPidEdit[0][0] / 1000.0f;
attiPid->ki = anoDtPidEdit[0][1] / 1000.0f;
attiPid->kd = anoDtPidEdit[0][2] / 1000.0f;
*/
ANO_DT_Send_Check(*(data_buf+2),sum);
// Param_SavePID();
}
if(*(data_buf+2)==0X12) //PID3
{
ANO_DT_Send_Check(*(data_buf+2),sum);
// Param_SavePID();
}
if(*(data_buf+2)==0X13) //PID4
{
ANO_DT_Send_Check(*(data_buf+2),sum);
}
if(*(data_buf+2)==0X14) //PID5
{
ANO_DT_Send_Check(*(data_buf+2),sum);
}
if(*(data_buf+2)==0X15) //PID6
{
ANO_DT_Send_Check(*(data_buf+2),sum);
}
}
void ANO_DT_Send_Version(uint8_t hardware_type, uint16_t hardware_ver,uint16_t software_ver,uint16_t protocol_ver,uint16_t bootloader_ver)
{
uint8_t _cnt=0;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0x00;
data_to_send[_cnt++]=0;
data_to_send[_cnt++]=hardware_type;
data_to_send[_cnt++]=BYTE1(hardware_ver);
data_to_send[_cnt++]=BYTE0(hardware_ver);
data_to_send[_cnt++]=BYTE1(software_ver);
data_to_send[_cnt++]=BYTE0(software_ver);
data_to_send[_cnt++]=BYTE1(protocol_ver);
data_to_send[_cnt++]=BYTE0(protocol_ver);
data_to_send[_cnt++]=BYTE1(bootloader_ver);
data_to_send[_cnt++]=BYTE0(bootloader_ver);
data_to_send[3] = _cnt-4;
uint8_t sum = 0;
for(uint8_t i=0;i<_cnt;i++)
sum += data_to_send[i];
data_to_send[_cnt++]=sum;
ANO_DT_Send_Data(data_to_send, _cnt);
}
void ANO_DT_Send_Status(float angle_rol, float angle_pit, float angle_yaw, int32_t alt, uint8_t fly_model, uint8_t armed)
{
uint8_t _cnt=0;
volatile int16_t _temp;
volatile int32_t _temp2 = alt;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0x01;
data_to_send[_cnt++]=0;
_temp = (int)(angle_rol*100);
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = (int)(angle_pit*100);
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = (int)(angle_yaw*100);
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
data_to_send[_cnt++]=BYTE3(_temp2);
data_to_send[_cnt++]=BYTE2(_temp2);
data_to_send[_cnt++]=BYTE1(_temp2);
data_to_send[_cnt++]=BYTE0(_temp2);
data_to_send[_cnt++] = fly_model;
data_to_send[_cnt++] = armed;
data_to_send[3] = _cnt-4;
uint8_t sum = 0;
for(uint8_t i=0;i<_cnt;i++)
sum += data_to_send[i];
data_to_send[_cnt++]=sum;
ANO_DT_Send_Data(data_to_send, _cnt);
}
void ANO_DT_Send_Senser(int16_t a_x,int16_t a_y,int16_t a_z,int16_t g_x,int16_t g_y,int16_t g_z,int16_t m_x,int16_t m_y,int16_t m_z,int32_t bar)
{
uint8_t _cnt=0;
volatile int16_t _temp;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0x02;
data_to_send[_cnt++]=0;
_temp = a_x;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = a_y;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = a_z;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = g_x;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = g_y;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = g_z;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = m_x;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = m_y;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = m_z;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
data_to_send[3] = _cnt-4;
uint8_t sum = 0;
for(uint8_t i=0;i<_cnt;i++)
sum += data_to_send[i];
data_to_send[_cnt++] = sum;
ANO_DT_Send_Data(data_to_send, _cnt);
}
void ANO_DT_Send_RCData(uint16_t thr,uint16_t yaw,uint16_t rol,uint16_t pit,uint16_t aux1,uint16_t aux2,uint16_t aux3,uint16_t aux4,uint16_t aux5,uint16_t aux6)
{
uint8_t _cnt=0;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0x03;
data_to_send[_cnt++]=0;
data_to_send[_cnt++]=BYTE1(thr);
data_to_send[_cnt++]=BYTE0(thr);
data_to_send[_cnt++]=BYTE1(yaw);
data_to_send[_cnt++]=BYTE0(yaw);
data_to_send[_cnt++]=BYTE1(rol);
data_to_send[_cnt++]=BYTE0(rol);
data_to_send[_cnt++]=BYTE1(pit);
data_to_send[_cnt++]=BYTE0(pit);
data_to_send[_cnt++]=BYTE1(aux1);
data_to_send[_cnt++]=BYTE0(aux1);
data_to_send[_cnt++]=BYTE1(aux2);
data_to_send[_cnt++]=BYTE0(aux2);
data_to_send[_cnt++]=BYTE1(aux3);
data_to_send[_cnt++]=BYTE0(aux3);
data_to_send[_cnt++]=BYTE1(aux4);
data_to_send[_cnt++]=BYTE0(aux4);
data_to_send[_cnt++]=BYTE1(aux5);
data_to_send[_cnt++]=BYTE0(aux5);
data_to_send[_cnt++]=BYTE1(aux6);
data_to_send[_cnt++]=BYTE0(aux6);
data_to_send[3] = _cnt-4;
uint8_t sum = 0;
for(uint8_t i=0;i<_cnt;i++)
sum += data_to_send[i];
data_to_send[_cnt++]=sum;
ANO_DT_Send_Data(data_to_send, _cnt);
}
void ANO_DT_Send_Power(uint16_t votage, uint16_t current)
{
uint8_t _cnt=0;
uint16_t temp;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0x05;
data_to_send[_cnt++]=0;
temp = votage;
data_to_send[_cnt++]=BYTE1(temp);
data_to_send[_cnt++]=BYTE0(temp);
temp = current;
data_to_send[_cnt++]=BYTE1(temp);
data_to_send[_cnt++]=BYTE0(temp);
data_to_send[3] = _cnt-4;
uint8_t sum = 0;
for(uint8_t i=0;i<_cnt;i++)
sum += data_to_send[i];
data_to_send[_cnt++]=sum;
ANO_DT_Send_Data(data_to_send, _cnt);
}
void ANO_DT_Send_MotoPWM(uint16_t m_1,uint16_t m_2,uint16_t m_3,uint16_t m_4,uint16_t m_5,uint16_t m_6,uint16_t m_7,uint16_t m_8)
{
uint8_t _cnt=0;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0x06;
data_to_send[_cnt++]=0;
data_to_send[_cnt++]=BYTE1(m_1);
data_to_send[_cnt++]=BYTE0(m_1);
data_to_send[_cnt++]=BYTE1(m_2);
data_to_send[_cnt++]=BYTE0(m_2);
data_to_send[_cnt++]=BYTE1(m_3);
data_to_send[_cnt++]=BYTE0(m_3);
data_to_send[_cnt++]=BYTE1(m_4);
data_to_send[_cnt++]=BYTE0(m_4);
data_to_send[_cnt++]=BYTE1(m_5);
data_to_send[_cnt++]=BYTE0(m_5);
data_to_send[_cnt++]=BYTE1(m_6);
data_to_send[_cnt++]=BYTE0(m_6);
data_to_send[_cnt++]=BYTE1(m_7);
data_to_send[_cnt++]=BYTE0(m_7);
data_to_send[_cnt++]=BYTE1(m_8);
data_to_send[_cnt++]=BYTE0(m_8);
data_to_send[3] = _cnt-4;
uint8_t sum = 0;
for(uint8_t i=0;i<_cnt;i++)
sum += data_to_send[i];
data_to_send[_cnt++]=sum;
ANO_DT_Send_Data(data_to_send, _cnt);
}
void ANO_DT_Send_PID(uint8_t 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)
{
uint8_t _cnt=0;
volatile int16_t _temp;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0x10+group-1;
data_to_send[_cnt++]=0;
_temp = p1_p * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = p1_i * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = p1_d * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = p2_p * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = p2_i * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = p2_d * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = p3_p * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = p3_i * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
_temp = p3_d * 1000;
data_to_send[_cnt++]=BYTE1(_temp);
data_to_send[_cnt++]=BYTE0(_temp);
data_to_send[3] = _cnt-4;
uint8_t sum = 0;
for(uint8_t i=0;i<_cnt;i++)
sum += data_to_send[i];
data_to_send[_cnt++]=sum;
ANO_DT_Send_Data(data_to_send, _cnt);
}
void ANO_DT_Send_UserData(uint8_t funCode, uint16_t* data, uint8_t len)
{
uint8_t _cnt=0;
uint8_t idx = 0;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=0xAA;
data_to_send[_cnt++]=funCode;
data_to_send[_cnt++]=0;
for ( ; idx < len; ++idx)
{
data_to_send[_cnt++]=BYTE1(*(data + idx));
data_to_send[_cnt++]=BYTE0(*(data + idx));
}
data_to_send[3] = _cnt-4;
uint8_t sum = 0;
for(uint8_t i=0;i<_cnt;i++)
sum += data_to_send[i];
data_to_send[_cnt++]=sum;
ANO_DT_Send_Data(data_to_send, _cnt);
}
void ANO_DT_Send_VtorTimer()
{
uint16_t timeSliceCount[20] = {0};
uint8_t i = 1;
extern VtorTimer* vtorTimerHeader;
VtorTimer* timer = vtorTimerHeader;
//timeSliceCount[0] = sysTickMs;
while(NULL != timer->fun)
{
timeSliceCount[i] = timer->runCnt % 1000;
timer++;
i++;
}
ANO_DT_Send_UserData(0xf1, timeSliceCount, i);
}
void ANO_DT_Send_PidValueWave()
{
/*
int16_t valueWave[20] = {0};
VtorPid* pid = NULL;
pid = leftSpeedPid;
pid = attiPid;
int16_t value = 0;
uint8_t i = 0;
value = pid->out;
valueWave[i++] = value;
value = pid->outp;
valueWave[i++] = value;
value = pid->outi;
valueWave[i++] = value;
value = pid->outd;
valueWave[i++] = value;
value = pid->err;
valueWave[i++] = value;
valueWave[i++] = value;
ANO_DT_Send_UserData(0xf1, valueWave, 4);
*/
}
#endif // __ANO_DT__
/******************* (C) COPYRIGHT 2014 ANO TECH *****END OF FILE************/
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Thomas_Ti/vtor_elec_module.git
git@gitee.com:Thomas_Ti/vtor_elec_module.git
Thomas_Ti
vtor_elec_module
vtor_elec_module
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385