15 Compatible With ESPilot APP

一、ESPilot APP通信协议

ESPlane

Direction

ESPilot App

function

192.168.43.42::2390/2392

UDP双向

2399

typr

byte

function

1

head

2-12

data

head

function

0x04

PID Received from App Store in EEPROM

0x08

App requested for PID

else

Control Packet Received

/*Control Packet Received*/
          rch   = (-1.0)*(float)((((uint16_t)packetBuffer[1]<<8)+(uint16_t)packetBuffer[2])-296);
          pch   = (-1.0)*(float)((((uint16_t)packetBuffer[3]<<8)+(uint16_t)packetBuffer[4])-296);
          tch   = (float)((((uint16_t)packetBuffer[5]<<8)+(uint16_t)packetBuffer[6])+200);
          ych   = (float)((((uint16_t)packetBuffer[7]<<8)+(uint16_t)packetBuffer[8])-296);
/*PID Received from App Store in EEPROM*/
          pid_p_gain_roll = (float)packetBuffer[1]/10; pid_i_gain_roll = (float)packetBuffer[2]/100; pid_d_gain_roll = (float)packetBuffer[3]/10;              
          pid_p_gain_pitch = (float)packetBuffer[4]/10; pid_i_gain_pitch = (float)packetBuffer[5]/100; pid_d_gain_pitch = (float)packetBuffer[6]/10;
          pid_p_gain_yaw = (float)packetBuffer[7]/10; pid_i_gain_yaw = (float)packetBuffer[8]/100; pid_d_gain_yaw = (float)packetBuffer[9]/10;

二、飞机端代码移植

1. 检测数据包是否来自旧版本ESPilot APP

2. 将ESPilot 协议包转成CRTP协议包

最后更新于

这有帮助吗?