iNavFlight之MSP DJI协议天空端请求报文

Posted lida2003

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iNavFlight之MSP DJI协议天空端请求报文相关的知识,希望对你有一定的参考价值。

iNavFlight之MSP DJI协议天空端请求报文

MSP DJI协议是用于DJI天空端与飞控端之间的通信协议,其工作模式符合C/S经典设计。

这里我们重点介绍下天空端请求报文格式和命令。

1. 报文格式(请求)

  +---+---+--------+---------+--------+------+-------------+------------------------------+-------------+
  |                            Multiwii Serial Protocol V2                    length = 9 + payload size |
  +---+---+--------+---------+--------+------+-------------+------------------------------+-------------+
  | $ | X |    <   | flag(1) | cmd(2)        | size(2) = 0 | payload(16bit len)           | checksum_v2 |
  +---+---+--------+---------+--------+------+-------------+------------------------------+-------------+
  • ‘$’:表示SOF(Start Of a frame)
  • ‘X’:表示V2
  • ‘<’: 表示request

2. 报文标志(flag)

请求报文:MSP_RESULT_ACK //截止发稿日

// return positive for ACK, negative on error, zero for no reply
typedef enum 
    MSP_RESULT_ACK = 1,
    MSP_RESULT_ERROR = -1,
    MSP_RESULT_NO_REPLY = 0
 mspResult_e;

3. 报文命令(cmd)

#define DJI_MSP_API_VERSION             1    // 
#define DJI_MSP_FC_VARIANT              2    // 
#define DJI_MSP_FC_VERSION              3    // 
#define DJI_MSP_NAME                    10   // For OSD 'Craft Name'
#define DJI_MSP_OSD_CONFIG              84   // OSD item count + positions
#define DJI_MSP_FILTER_CONFIG           92   //
#define DJI_MSP_PID_ADVANCED            94   //
#define DJI_MSP_STATUS                  101  // For OSD ‘armingTime’, Flight controller arming status
#define DJI_MSP_RC                      105  //
#define DJI_MSP_RAW_GPS                 106  // For OSD ‘GPS Sats’ + coordinates
#define DJI_MSP_COMP_GPS                107  // GPS direction to home & distance to home
#define DJI_MSP_ATTITUDE                108  // For OSD ‘Angle: roll & pitch’
#define DJI_MSP_ALTITUDE                109  // For OSD ‘Numerical Vario’
#define DJI_MSP_ANALOG                  110  // For OSD ‘RSSI Value’, For OSD ‘Battery voltage’ etc
#define DJI_MSP_RC_TUNING               111  //
#define DJI_MSP_PID                     112  // For OSD ‘PID roll, yaw, pitch'
#define DJI_MSP_BATTERY_STATE           130  // For OSD ‘Battery current mAh drawn’ etc
#define DJI_MSP_ESC_SENSOR_DATA         134  // For OSD ‘ESC temperature’
#define DJI_MSP_STATUS_EX               150  // For OSD ‘Fly mode', For OSD ‘Disarmed’
#define DJI_MSP_RTC                     247  // For OSD ‘RTC date time’

4. 参考资料

【1】iNavFlight之MSP DJI协议分析
【2】BetaFlight模块设计之三十二:MSP协议模块分析
【3】iNavFlight之MSP DJI协议飞控端请求应答

以上是关于iNavFlight之MSP DJI协议天空端请求报文的主要内容,如果未能解决你的问题,请参考以下文章

iNavFlight之MSP DJI协议分析

iNavFlight之RC遥控MSP协议

iNavFlight之MSP v2 Sensor报文格式

iNavFlight之电传MAVLink协议

iNavFlight之RC遥控CRSF协议

BetaFlight模块设计之三十二:MSP协议模块分析