Browse Source

添加智能电池,数字电调数据消息

Liu Yang 1 year ago
parent
commit
8c33e5e862

+ 40 - 1
msg_definitions/VKFly.xml

@@ -510,7 +510,7 @@
       <field type="float" name="raw_gps_alt" units="m">gps amsl altitude for data fusion</field>
       <field type="uint8_t" name="solv_psat_num">satelites number for position</field>
       <field type="uint8_t" name="solv_hsat_num">satelites number for heading</field>
-      <field type="int16_t" name="temperature" units="cdegC">temperature</field>
+      <field type="int16_t" name="temperature" units="degC">temperature</field>
       <field type="uint8_t" name="vibe_coe"></field>
     </message>
 
@@ -535,6 +535,45 @@
       <field type="uint16_t" name="state" enum="VKFLY_ROI_STATE">Bitmap to indicate ROI state </field>
     </message>
 
+    <message id="53003" name="VK_BMS_STATUS">
+      <description> battery bms status message </description>
+      <field type="uint32_t" name="time_boot_ms" units="ms">Timestamp in ms from system boot.</field>
+      <field type="uint32_t" name="voltage" units="mV">BMS voltage in mV</field>
+      <field type="int16_t" name="current" units="cA">BMS current in cA, negative value means in charging</field>
+      <field type="uint16_t" name="cyc_cnt" minValue="0" increment="1">BMS change and discharge
+        cycle times</field>
+      <field type="int16_t" name="temperature" units="degC">BMS temperature in degC</field>
+      <field type="int8_t" name="cap_percent" units="%">BMS remaining power in percentage</field>
+      <field type="uint8_t" name="bat_id" minValue="0" maxValue="1" increment="1">BMS id, start from
+        0</field>
+      <field type="uint32_t" name="err_code" display="bitmask" print_format="0x%04x">BMS error code,
+        0 means no error</field>
+      <field type="uint16_t" name="cell_num" minValue="0" maxValue="100">BMS cell numbers</field>
+      <field type="uint16_t[30]" name="cell_volt" units="mV">BMS cell voltage in mV</field>
+    </message>
+
+    <message id="53004" name="VK_BMS_INFO">
+      <description> battery bms information message, this message can be required by
+        MAV_CMD_REQUEST_MESSAGE with param1 ad bms id </description>
+      <field type="uint32_t" name="time_boot_ms" units="ms">Timestamp in ms from system boot.</field>
+      <field type="uint8_t[20]" name="man_name">BMS manufactor string</field>
+      <field type="uint8_t[20]" name="model_name">BMS equpment model name string</field>
+      <field type="uint8_t[20]" name="sn_id">BMS SN id string</field>
+      <field type="uint8_t[10]" name="hw_ver">BMS hardware version string</field>
+      <field type="uint8_t[10]" name="fw_ver">BMS firmware version string</field>
+    </message>
+
+    <message id="53005" name="VK_DIGI_ESC_STATUS">
+      <description> digital esc status with can or serial interface</description>
+      <field type="uint32_t" name="time_boot_ms" units="ms">Timestamp in ms from system boot.</field>
+      <field type="uint16_t" name="rot_spd">BMS manufactor string</field>
+      <field type="uint8_t[20]" name="model_name">BMS equpment model name string</field>
+      <field type="uint8_t[20]" name="sn_id">BMS SN id string</field>
+      <field type="uint8_t[10]" name="hw_ver">BMS hardware version string</field>
+      <field type="uint8_t[10]" name="fw_ver">BMS firmware version string</field>
+    </message>
+
+
     <message id="53100" name="VK_FW_UPDATE_BEGIN">
       <description>VKFLY autopilot update firmware begin. This message send from GCS to autopilot. </description>
       <field type="uint8_t" name="target_system">Target system id.</field>

+ 53 - 21
readme.md

@@ -68,24 +68,24 @@
   
   飞控定周期向外发送, 默认 2hz. 包含传感器\电池\故障码等一些重要状态信息.
 
-  | 字段                                     | 说明                                          |
-  | ---------------------------------------- | --------------------------------------------- |
-  | onboard_control_sensors_present          | 飞控具有的传感器, bit位按common.xml中标准定义 |
-  | onboard_control_sensors_enabled          | 飞控启用的传感器, bit位按common.xml中标准定义 |
-  | onboard_control_sensors_health           | 传感器健康状态, bit位按common.xml中标准定义   |
-  | load                                     | 系统cpu负载, 0~1000, 按commom.xml标准定义     |
-  | voltage_battery                          | 电压mV, 传输为飞控供电电压                    |
-  | current_battery                          | 电流cA                                        |
-  | drop_rate_comm                           | 预留                                          |
-  | errors_comm                              | 预留                                          |
-  | errors_count1                            | bit位参考自定义vkfly.xml中 VKFLY_SYS_ERROR1   |
-  | errors_count2                            | bit位参考自定义vkfly.xml中 VKFLY_SYS_ERROR2   |
-  | errors_count3                            | 预留                                          |
-  | errors_count4                            | 预留                                          |
-  | battery_remaining                        | 剩余电量百分比%                               |
-  | onboard_control_sensors_present_extended | 参考 VKFLY_SYS_STATUS_SENSOR_EXTEND           |
-  | onboard_control_sensors_enable_extended  | 参考 VKFLY_SYS_STATUS_SENSOR_EXTEND           |
-  | onboard_control_sensors_health_extended  | 参考 VKFLY_SYS_STATUS_SENSOR_EXTEND           |
+  | 字段                                     | 说明                                                                                |
+  | ---------------------------------------- | ----------------------------------------------------------------------------------- |
+  | onboard_control_sensors_present          | 飞控具有的传感器, bit位按common.xml中标准定义                                       |
+  | onboard_control_sensors_enabled          | 飞控启用的传感器, bit位按common.xml中标准定义                                       |
+  | onboard_control_sensors_health           | 传感器健康状态, bit位按common.xml中标准定义                                         |
+  | load                                     | 系统cpu负载, 0~1000, 按commom.xml标准定义                                           |
+  | voltage_battery                          | 电压cV, 传输为飞控供电电压, 注意此单位与通用定义有区别,因为通用定义范围无法满足需求 |
+  | current_battery                          | 电流cA                                                                              |
+  | drop_rate_comm                           | 预留                                                                                |
+  | errors_comm                              | 预留                                                                                |
+  | errors_count1                            | bit位参考自定义vkfly.xml中 VKFLY_SYS_ERROR1                                         |
+  | errors_count2                            | bit位参考自定义vkfly.xml中 VKFLY_SYS_ERROR2                                         |
+  | errors_count3                            | 预留                                                                                |
+  | errors_count4                            | 预留                                                                                |
+  | battery_remaining                        | 剩余电量百分比%                                                                     |
+  | onboard_control_sensors_present_extended | 参考 VKFLY_SYS_STATUS_SENSOR_EXTEND                                                 |
+  | onboard_control_sensors_enable_extended  | 参考 VKFLY_SYS_STATUS_SENSOR_EXTEND                                                 |
+  | onboard_control_sensors_health_extended  | 参考 VKFLY_SYS_STATUS_SENSOR_EXTEND                                                 |
 
 - [MAVLINK_MSG_ID_HOME_POSITION](https://mavlink.io/en/messages/common.html#HOME_POSITION)
   
@@ -176,6 +176,10 @@
   电机输出信息
   飞控顶周期向外发送, 默认 5hz. 包含各通道电机控制PWM信号的值.
 
+- [MAVLINK_MSG_ID_ESC_STATUS]
+  电调数据信息
+  数字接口电调反馈的状态信息, 包括转速, 电压, 电流. 有电调接入后飞控以默认 2hz 发送给地面站.
+
 - [MAVLINK_MSG_ID_VFR_HUD](https://mavlink.io/en/messages/common.html#VFR_HUDhttps://mavlink.io/en/messages/common.html#VFR_HUD)
   
   仪表HUD信息
@@ -962,6 +966,34 @@ mavlink common 标准消息集中主要由 MAVLINK_MSG_ID_COMMAND_INT 和 MAVLIN
   | flight_time  | 飞行时间,s                      |
   | dist_t_tar   | 目标距离, cm                    |
 
+- MAVLINK_VK_BMS_STATUS
+  智能电池状态数据
+  当检测到智能电池数据接入, 飞控自动周期向地面站发送此消息
+  | 字段         | 说明                         |
+  | ------------ | ---------------------------- |
+  | time_boot_ms | 系统本地时间戳ms             |
+  | voltage      | 电压 mV                      |
+  | current      | 电流 cA(0.01A), 负数表示充电 |
+  | cyc_cnt      | 充放电次数                   |
+  | temperature  | 温度 1度                     |
+  | cap_percent  | 电量 1%                      |
+  | bat_id       | 电池编号, 0~5                |
+  | err_code     | 故障码, 0为无故障            |
+  | cell_num     | 电芯数                       |
+  | cell_volt    | 电芯电压 mV                  |
+
+- MAVLINK_VK_BMS_INFO
+  智能电池 info 数据, 本数据可以通过 MAV_CMD_REQUEST 进行读取, param1 是电池的 bat_id.
+  | 字段         | 说明             |
+  | ------------ | ---------------- |
+  | time_boot_ms | 系统本地时间戳ms |
+  | man_name     | 制造商名         |
+  | model_name   | 型号名           |
+  | sn_id        | 序列号           |
+  | hw_ver       | 硬件号           |
+  | fw_ver       | 软件号           |
+ 
+
 ## 飞控参数说明
 
 ### 飞控参数表
@@ -981,7 +1013,7 @@ mavlink common 标准消息集中主要由 MAVLINK_MSG_ID_COMMAND_INT 和 MAVLIN
 | RCFAIL_LOT_T    | RC失控悬停时间           | UINT16 | 范围0~UINT16_MAX, 单位s. 遥控器失控后悬停等待时间                                              |
 | VOLT1_LOW_VAL   | 一级电压低阈值           | FLOAT  | 范围0~1000, 单位V                                                                              |
 | VOLT2_LOW_VAL   | 二级电压低阈值           | FLOAT  | 范围0~1000, 单位V                                                                              |
-| VCAP1_LOW_VAL   | 一级电量低阈值           | UINT8  | 范围0~100, 单位1%                                                                              |
+| VCAP1_LOW_VAL   | 一级电量低阈值           | UINT8  | 范围0~100, 单位1%, 当具有多个智能电池时, 飞控按他们的平均电量进行触发保护判定                  |
 | VCAP2_LOW_VAL   | 二级电量低阈值           | UINT8  | 范围0~100, 单位1%                                                                              |
 | VOLT_PROT_CH    | 电压保护通道             | UINT16 | 范围0~10, 触发电压保护的通道, 默认0飞控供电                                                    |
 | OBAVOID_DIST    | 障碍悬停距离             | FLOAT  | 范围2~8, 单位m                                                                                 |
@@ -1120,8 +1152,8 @@ mavlink common 标准消息集中主要由 MAVLINK_MSG_ID_COMMAND_INT 和 MAVLIN
 | IMU_ATT_POFF0   | IMU水平PITCH偏移         | FLOAT  | 范围-180~180, 单位 deg <br>飞控通过水平校准自动捕获                                            |
 | IMU_ATT_YOFF0   | IMU水平YAW偏移           | FLOAT  | 范围-180~180, 单位 deg <br>可用于设置飞控IMU安装朝向 <br>安装方向前0, 右90, 左-90, 后180       |
 | ASPD_OFFSET0    | 空速计零偏               | FLOAT  | 范围 -5000~5000, 单位Pa                                                                        |
-| IMU_GFLT_TYPE   | 角速度滤波类型           | UINT8  | 范围0~5, 0-VVH 1-VH 2-H 3-M 4-L 5-VL                                                            |
-| IMU_AFLT_TYPE   | 加速度滤波类型           | UINT8  | 范围0~5, 0-VVH 1-VH 2-H 3-M 4-L 5-VL                                                            |
+| IMU_GFLT_TYPE   | 角速度滤波类型           | UINT8  | 范围0~5, 0-VVH 1-VH 2-H 3-M 4-L 5-VL                                                           |
+| IMU_AFLT_TYPE   | 加速度滤波类型           | UINT8  | 范围0~5, 0-VVH 1-VH 2-H 3-M 4-L 5-VL                                                           |
 | IMU_PXOFF       | 飞控IMU X安装距离偏差    | INT32  | 范围-1000~1000, 单位cm <br>IMU安装离飞机中心X轴向偏差距离                                      |
 | IMU_PYOFF       | 飞控IMU Y安装距离偏差    | INT32  | 范围-1000~1000, 单位cm <br>IMU安装离飞机中心Y轴向偏差距离                                      |
 | IMU_PZOFF       | 飞控IMU Z安装距离偏差    | INT32  | 范围-1000~1000, 单位cm <br>IMU安装离飞机中心Z轴向偏差距离                                      |

File diff suppressed because it is too large
+ 1 - 1
v2.0/VKFly/VKFly.h


+ 1 - 1
v2.0/VKFly/mavlink.h

@@ -6,7 +6,7 @@
 #ifndef MAVLINK_H
 #define MAVLINK_H
 
-#define MAVLINK_PRIMARY_XML_HASH 6950645065552306442
+#define MAVLINK_PRIMARY_XML_HASH -1336360527562923858
 
 #ifndef MAVLINK_STX
 #define MAVLINK_STX 253

+ 394 - 0
v2.0/VKFly/mavlink_msg_vk_bms_info.h

@@ -0,0 +1,394 @@
+#pragma once
+// MESSAGE VK_BMS_INFO PACKING
+
+#define MAVLINK_MSG_ID_VK_BMS_INFO 53004
+
+
+typedef struct __mavlink_vk_bms_info_t {
+ uint32_t time_boot_ms; /*< [ms] Timestamp in ms from system boot.*/
+ uint8_t man_name[20]; /*<  BMS manufactor string*/
+ uint8_t model_name[20]; /*<  BMS equpment model name string*/
+ uint8_t sn_id[20]; /*<  BMS SN id string*/
+ uint8_t hw_ver[10]; /*<  BMS hardware version string*/
+ uint8_t fw_ver[10]; /*<  BMS firmware version string*/
+} mavlink_vk_bms_info_t;
+
+#define MAVLINK_MSG_ID_VK_BMS_INFO_LEN 84
+#define MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN 84
+#define MAVLINK_MSG_ID_53004_LEN 84
+#define MAVLINK_MSG_ID_53004_MIN_LEN 84
+
+#define MAVLINK_MSG_ID_VK_BMS_INFO_CRC 205
+#define MAVLINK_MSG_ID_53004_CRC 205
+
+#define MAVLINK_MSG_VK_BMS_INFO_FIELD_MAN_NAME_LEN 20
+#define MAVLINK_MSG_VK_BMS_INFO_FIELD_MODEL_NAME_LEN 20
+#define MAVLINK_MSG_VK_BMS_INFO_FIELD_SN_ID_LEN 20
+#define MAVLINK_MSG_VK_BMS_INFO_FIELD_HW_VER_LEN 10
+#define MAVLINK_MSG_VK_BMS_INFO_FIELD_FW_VER_LEN 10
+
+#if MAVLINK_COMMAND_24BIT
+#define MAVLINK_MESSAGE_INFO_VK_BMS_INFO { \
+    53004, \
+    "VK_BMS_INFO", \
+    6, \
+    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_bms_info_t, time_boot_ms) }, \
+         { "man_name", NULL, MAVLINK_TYPE_UINT8_T, 20, 4, offsetof(mavlink_vk_bms_info_t, man_name) }, \
+         { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 20, 24, offsetof(mavlink_vk_bms_info_t, model_name) }, \
+         { "sn_id", NULL, MAVLINK_TYPE_UINT8_T, 20, 44, offsetof(mavlink_vk_bms_info_t, sn_id) }, \
+         { "hw_ver", NULL, MAVLINK_TYPE_UINT8_T, 10, 64, offsetof(mavlink_vk_bms_info_t, hw_ver) }, \
+         { "fw_ver", NULL, MAVLINK_TYPE_UINT8_T, 10, 74, offsetof(mavlink_vk_bms_info_t, fw_ver) }, \
+         } \
+}
+#else
+#define MAVLINK_MESSAGE_INFO_VK_BMS_INFO { \
+    "VK_BMS_INFO", \
+    6, \
+    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_bms_info_t, time_boot_ms) }, \
+         { "man_name", NULL, MAVLINK_TYPE_UINT8_T, 20, 4, offsetof(mavlink_vk_bms_info_t, man_name) }, \
+         { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 20, 24, offsetof(mavlink_vk_bms_info_t, model_name) }, \
+         { "sn_id", NULL, MAVLINK_TYPE_UINT8_T, 20, 44, offsetof(mavlink_vk_bms_info_t, sn_id) }, \
+         { "hw_ver", NULL, MAVLINK_TYPE_UINT8_T, 10, 64, offsetof(mavlink_vk_bms_info_t, hw_ver) }, \
+         { "fw_ver", NULL, MAVLINK_TYPE_UINT8_T, 10, 74, offsetof(mavlink_vk_bms_info_t, fw_ver) }, \
+         } \
+}
+#endif
+
+/**
+ * @brief Pack a vk_bms_info message
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param msg The MAVLink message to compress the data into
+ *
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
+ * @param man_name  BMS manufactor string
+ * @param model_name  BMS equpment model name string
+ * @param sn_id  BMS SN id string
+ * @param hw_ver  BMS hardware version string
+ * @param fw_ver  BMS firmware version string
+ * @return length of the message in bytes (excluding serial stream start sign)
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
+                               uint32_t time_boot_ms, const uint8_t *man_name, const uint8_t *model_name, const uint8_t *sn_id, const uint8_t *hw_ver, const uint8_t *fw_ver)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char buf[MAVLINK_MSG_ID_VK_BMS_INFO_LEN];
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint8_t_array(buf, 4, man_name, 20);
+    _mav_put_uint8_t_array(buf, 24, model_name, 20);
+    _mav_put_uint8_t_array(buf, 44, sn_id, 20);
+    _mav_put_uint8_t_array(buf, 64, hw_ver, 10);
+    _mav_put_uint8_t_array(buf, 74, fw_ver, 10);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
+#else
+    mavlink_vk_bms_info_t packet;
+    packet.time_boot_ms = time_boot_ms;
+    mav_array_memcpy(packet.man_name, man_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.sn_id, sn_id, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.hw_ver, hw_ver, sizeof(uint8_t)*10);
+    mav_array_memcpy(packet.fw_ver, fw_ver, sizeof(uint8_t)*10);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
+#endif
+
+    msg->msgid = MAVLINK_MSG_ID_VK_BMS_INFO;
+    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
+}
+
+/**
+ * @brief Pack a vk_bms_info message
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param status MAVLink status structure
+ * @param msg The MAVLink message to compress the data into
+ *
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
+ * @param man_name  BMS manufactor string
+ * @param model_name  BMS equpment model name string
+ * @param sn_id  BMS SN id string
+ * @param hw_ver  BMS hardware version string
+ * @param fw_ver  BMS firmware version string
+ * @return length of the message in bytes (excluding serial stream start sign)
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
+                               uint32_t time_boot_ms, const uint8_t *man_name, const uint8_t *model_name, const uint8_t *sn_id, const uint8_t *hw_ver, const uint8_t *fw_ver)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char buf[MAVLINK_MSG_ID_VK_BMS_INFO_LEN];
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint8_t_array(buf, 4, man_name, 20);
+    _mav_put_uint8_t_array(buf, 24, model_name, 20);
+    _mav_put_uint8_t_array(buf, 44, sn_id, 20);
+    _mav_put_uint8_t_array(buf, 64, hw_ver, 10);
+    _mav_put_uint8_t_array(buf, 74, fw_ver, 10);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
+#else
+    mavlink_vk_bms_info_t packet;
+    packet.time_boot_ms = time_boot_ms;
+    mav_array_memcpy(packet.man_name, man_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.sn_id, sn_id, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.hw_ver, hw_ver, sizeof(uint8_t)*10);
+    mav_array_memcpy(packet.fw_ver, fw_ver, sizeof(uint8_t)*10);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
+#endif
+
+    msg->msgid = MAVLINK_MSG_ID_VK_BMS_INFO;
+#if MAVLINK_CRC_EXTRA
+    return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
+#else
+    return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
+#endif
+}
+
+/**
+ * @brief Pack a vk_bms_info message on a channel
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param chan The MAVLink channel this message will be sent over
+ * @param msg The MAVLink message to compress the data into
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
+ * @param man_name  BMS manufactor string
+ * @param model_name  BMS equpment model name string
+ * @param sn_id  BMS SN id string
+ * @param hw_ver  BMS hardware version string
+ * @param fw_ver  BMS firmware version string
+ * @return length of the message in bytes (excluding serial stream start sign)
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
+                               mavlink_message_t* msg,
+                                   uint32_t time_boot_ms,const uint8_t *man_name,const uint8_t *model_name,const uint8_t *sn_id,const uint8_t *hw_ver,const uint8_t *fw_ver)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char buf[MAVLINK_MSG_ID_VK_BMS_INFO_LEN];
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint8_t_array(buf, 4, man_name, 20);
+    _mav_put_uint8_t_array(buf, 24, model_name, 20);
+    _mav_put_uint8_t_array(buf, 44, sn_id, 20);
+    _mav_put_uint8_t_array(buf, 64, hw_ver, 10);
+    _mav_put_uint8_t_array(buf, 74, fw_ver, 10);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
+#else
+    mavlink_vk_bms_info_t packet;
+    packet.time_boot_ms = time_boot_ms;
+    mav_array_memcpy(packet.man_name, man_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.sn_id, sn_id, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.hw_ver, hw_ver, sizeof(uint8_t)*10);
+    mav_array_memcpy(packet.fw_ver, fw_ver, sizeof(uint8_t)*10);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
+#endif
+
+    msg->msgid = MAVLINK_MSG_ID_VK_BMS_INFO;
+    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
+}
+
+/**
+ * @brief Encode a vk_bms_info struct
+ *
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param msg The MAVLink message to compress the data into
+ * @param vk_bms_info C-struct to read the message contents from
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vk_bms_info_t* vk_bms_info)
+{
+    return mavlink_msg_vk_bms_info_pack(system_id, component_id, msg, vk_bms_info->time_boot_ms, vk_bms_info->man_name, vk_bms_info->model_name, vk_bms_info->sn_id, vk_bms_info->hw_ver, vk_bms_info->fw_ver);
+}
+
+/**
+ * @brief Encode a vk_bms_info struct on a channel
+ *
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param chan The MAVLink channel this message will be sent over
+ * @param msg The MAVLink message to compress the data into
+ * @param vk_bms_info C-struct to read the message contents from
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vk_bms_info_t* vk_bms_info)
+{
+    return mavlink_msg_vk_bms_info_pack_chan(system_id, component_id, chan, msg, vk_bms_info->time_boot_ms, vk_bms_info->man_name, vk_bms_info->model_name, vk_bms_info->sn_id, vk_bms_info->hw_ver, vk_bms_info->fw_ver);
+}
+
+/**
+ * @brief Encode a vk_bms_info struct with provided status structure
+ *
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param status MAVLink status structure
+ * @param msg The MAVLink message to compress the data into
+ * @param vk_bms_info C-struct to read the message contents from
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vk_bms_info_t* vk_bms_info)
+{
+    return mavlink_msg_vk_bms_info_pack_status(system_id, component_id, _status, msg,  vk_bms_info->time_boot_ms, vk_bms_info->man_name, vk_bms_info->model_name, vk_bms_info->sn_id, vk_bms_info->hw_ver, vk_bms_info->fw_ver);
+}
+
+/**
+ * @brief Send a vk_bms_info message
+ * @param chan MAVLink channel to send the message
+ *
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
+ * @param man_name  BMS manufactor string
+ * @param model_name  BMS equpment model name string
+ * @param sn_id  BMS SN id string
+ * @param hw_ver  BMS hardware version string
+ * @param fw_ver  BMS firmware version string
+ */
+#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
+
+static inline void mavlink_msg_vk_bms_info_send(mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *man_name, const uint8_t *model_name, const uint8_t *sn_id, const uint8_t *hw_ver, const uint8_t *fw_ver)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char buf[MAVLINK_MSG_ID_VK_BMS_INFO_LEN];
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint8_t_array(buf, 4, man_name, 20);
+    _mav_put_uint8_t_array(buf, 24, model_name, 20);
+    _mav_put_uint8_t_array(buf, 44, sn_id, 20);
+    _mav_put_uint8_t_array(buf, 64, hw_ver, 10);
+    _mav_put_uint8_t_array(buf, 74, fw_ver, 10);
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, buf, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
+#else
+    mavlink_vk_bms_info_t packet;
+    packet.time_boot_ms = time_boot_ms;
+    mav_array_memcpy(packet.man_name, man_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.sn_id, sn_id, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet.hw_ver, hw_ver, sizeof(uint8_t)*10);
+    mav_array_memcpy(packet.fw_ver, fw_ver, sizeof(uint8_t)*10);
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, (const char *)&packet, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
+#endif
+}
+
+/**
+ * @brief Send a vk_bms_info message
+ * @param chan MAVLink channel to send the message
+ * @param struct The MAVLink struct to serialize
+ */
+static inline void mavlink_msg_vk_bms_info_send_struct(mavlink_channel_t chan, const mavlink_vk_bms_info_t* vk_bms_info)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    mavlink_msg_vk_bms_info_send(chan, vk_bms_info->time_boot_ms, vk_bms_info->man_name, vk_bms_info->model_name, vk_bms_info->sn_id, vk_bms_info->hw_ver, vk_bms_info->fw_ver);
+#else
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, (const char *)vk_bms_info, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
+#endif
+}
+
+#if MAVLINK_MSG_ID_VK_BMS_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
+/*
+  This variant of _send() can be used to save stack space by re-using
+  memory from the receive buffer.  The caller provides a
+  mavlink_message_t which is the size of a full mavlink message. This
+  is usually the receive buffer for the channel, and allows a reply to an
+  incoming message with minimum stack space usage.
+ */
+static inline void mavlink_msg_vk_bms_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t time_boot_ms, const uint8_t *man_name, const uint8_t *model_name, const uint8_t *sn_id, const uint8_t *hw_ver, const uint8_t *fw_ver)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char *buf = (char *)msgbuf;
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint8_t_array(buf, 4, man_name, 20);
+    _mav_put_uint8_t_array(buf, 24, model_name, 20);
+    _mav_put_uint8_t_array(buf, 44, sn_id, 20);
+    _mav_put_uint8_t_array(buf, 64, hw_ver, 10);
+    _mav_put_uint8_t_array(buf, 74, fw_ver, 10);
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, buf, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
+#else
+    mavlink_vk_bms_info_t *packet = (mavlink_vk_bms_info_t *)msgbuf;
+    packet->time_boot_ms = time_boot_ms;
+    mav_array_memcpy(packet->man_name, man_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet->model_name, model_name, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet->sn_id, sn_id, sizeof(uint8_t)*20);
+    mav_array_memcpy(packet->hw_ver, hw_ver, sizeof(uint8_t)*10);
+    mav_array_memcpy(packet->fw_ver, fw_ver, sizeof(uint8_t)*10);
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, (const char *)packet, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
+#endif
+}
+#endif
+
+#endif
+
+// MESSAGE VK_BMS_INFO UNPACKING
+
+
+/**
+ * @brief Get field time_boot_ms from vk_bms_info message
+ *
+ * @return [ms] Timestamp in ms from system boot.
+ */
+static inline uint32_t mavlink_msg_vk_bms_info_get_time_boot_ms(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_uint32_t(msg,  0);
+}
+
+/**
+ * @brief Get field man_name from vk_bms_info message
+ *
+ * @return  BMS manufactor string
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_get_man_name(const mavlink_message_t* msg, uint8_t *man_name)
+{
+    return _MAV_RETURN_uint8_t_array(msg, man_name, 20,  4);
+}
+
+/**
+ * @brief Get field model_name from vk_bms_info message
+ *
+ * @return  BMS equpment model name string
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_get_model_name(const mavlink_message_t* msg, uint8_t *model_name)
+{
+    return _MAV_RETURN_uint8_t_array(msg, model_name, 20,  24);
+}
+
+/**
+ * @brief Get field sn_id from vk_bms_info message
+ *
+ * @return  BMS SN id string
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_get_sn_id(const mavlink_message_t* msg, uint8_t *sn_id)
+{
+    return _MAV_RETURN_uint8_t_array(msg, sn_id, 20,  44);
+}
+
+/**
+ * @brief Get field hw_ver from vk_bms_info message
+ *
+ * @return  BMS hardware version string
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_get_hw_ver(const mavlink_message_t* msg, uint8_t *hw_ver)
+{
+    return _MAV_RETURN_uint8_t_array(msg, hw_ver, 10,  64);
+}
+
+/**
+ * @brief Get field fw_ver from vk_bms_info message
+ *
+ * @return  BMS firmware version string
+ */
+static inline uint16_t mavlink_msg_vk_bms_info_get_fw_ver(const mavlink_message_t* msg, uint8_t *fw_ver)
+{
+    return _MAV_RETURN_uint8_t_array(msg, fw_ver, 10,  74);
+}
+
+/**
+ * @brief Decode a vk_bms_info message into a struct
+ *
+ * @param msg The message to decode
+ * @param vk_bms_info C-struct to decode the message contents into
+ */
+static inline void mavlink_msg_vk_bms_info_decode(const mavlink_message_t* msg, mavlink_vk_bms_info_t* vk_bms_info)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    vk_bms_info->time_boot_ms = mavlink_msg_vk_bms_info_get_time_boot_ms(msg);
+    mavlink_msg_vk_bms_info_get_man_name(msg, vk_bms_info->man_name);
+    mavlink_msg_vk_bms_info_get_model_name(msg, vk_bms_info->model_name);
+    mavlink_msg_vk_bms_info_get_sn_id(msg, vk_bms_info->sn_id);
+    mavlink_msg_vk_bms_info_get_hw_ver(msg, vk_bms_info->hw_ver);
+    mavlink_msg_vk_bms_info_get_fw_ver(msg, vk_bms_info->fw_ver);
+#else
+        uint8_t len = msg->len < MAVLINK_MSG_ID_VK_BMS_INFO_LEN? msg->len : MAVLINK_MSG_ID_VK_BMS_INFO_LEN;
+        memset(vk_bms_info, 0, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
+    memcpy(vk_bms_info, _MAV_PAYLOAD(msg), len);
+#endif
+}

+ 520 - 0
v2.0/VKFly/mavlink_msg_vk_bms_status.h

@@ -0,0 +1,520 @@
+#pragma once
+// MESSAGE VK_BMS_STATUS PACKING
+
+#define MAVLINK_MSG_ID_VK_BMS_STATUS 53003
+
+
+typedef struct __mavlink_vk_bms_status_t {
+ uint32_t time_boot_ms; /*< [ms] Timestamp in ms from system boot.*/
+ uint32_t voltage; /*< [mV] BMS voltage in mV*/
+ uint32_t err_code; /*<  BMS error code,
+        0 means no error*/
+ int16_t current; /*< [cA] BMS current in cA, negative value means in charging*/
+ uint16_t cyc_cnt; /*<  BMS change and discharge
+        cycle times*/
+ int16_t temperature; /*< [degC] BMS temperature in degC*/
+ uint16_t cell_num; /*<  BMS cell numbers*/
+ uint16_t cell_volt[30]; /*< [mV] BMS cell voltage in mV*/
+ int8_t cap_percent; /*< [%] BMS remaining power in percentage*/
+ uint8_t bat_id; /*<  BMS id, start from
+        0*/
+} mavlink_vk_bms_status_t;
+
+#define MAVLINK_MSG_ID_VK_BMS_STATUS_LEN 82
+#define MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN 82
+#define MAVLINK_MSG_ID_53003_LEN 82
+#define MAVLINK_MSG_ID_53003_MIN_LEN 82
+
+#define MAVLINK_MSG_ID_VK_BMS_STATUS_CRC 13
+#define MAVLINK_MSG_ID_53003_CRC 13
+
+#define MAVLINK_MSG_VK_BMS_STATUS_FIELD_CELL_VOLT_LEN 30
+
+#if MAVLINK_COMMAND_24BIT
+#define MAVLINK_MESSAGE_INFO_VK_BMS_STATUS { \
+    53003, \
+    "VK_BMS_STATUS", \
+    10, \
+    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_bms_status_t, time_boot_ms) }, \
+         { "voltage", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_vk_bms_status_t, voltage) }, \
+         { "current", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_vk_bms_status_t, current) }, \
+         { "cyc_cnt", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_vk_bms_status_t, cyc_cnt) }, \
+         { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_vk_bms_status_t, temperature) }, \
+         { "cap_percent", NULL, MAVLINK_TYPE_INT8_T, 0, 80, offsetof(mavlink_vk_bms_status_t, cap_percent) }, \
+         { "bat_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 81, offsetof(mavlink_vk_bms_status_t, bat_id) }, \
+         { "err_code", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_vk_bms_status_t, err_code) }, \
+         { "cell_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_vk_bms_status_t, cell_num) }, \
+         { "cell_volt", NULL, MAVLINK_TYPE_UINT16_T, 30, 20, offsetof(mavlink_vk_bms_status_t, cell_volt) }, \
+         } \
+}
+#else
+#define MAVLINK_MESSAGE_INFO_VK_BMS_STATUS { \
+    "VK_BMS_STATUS", \
+    10, \
+    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_bms_status_t, time_boot_ms) }, \
+         { "voltage", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_vk_bms_status_t, voltage) }, \
+         { "current", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_vk_bms_status_t, current) }, \
+         { "cyc_cnt", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_vk_bms_status_t, cyc_cnt) }, \
+         { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_vk_bms_status_t, temperature) }, \
+         { "cap_percent", NULL, MAVLINK_TYPE_INT8_T, 0, 80, offsetof(mavlink_vk_bms_status_t, cap_percent) }, \
+         { "bat_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 81, offsetof(mavlink_vk_bms_status_t, bat_id) }, \
+         { "err_code", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_vk_bms_status_t, err_code) }, \
+         { "cell_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_vk_bms_status_t, cell_num) }, \
+         { "cell_volt", NULL, MAVLINK_TYPE_UINT16_T, 30, 20, offsetof(mavlink_vk_bms_status_t, cell_volt) }, \
+         } \
+}
+#endif
+
+/**
+ * @brief Pack a vk_bms_status message
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param msg The MAVLink message to compress the data into
+ *
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
+ * @param voltage [mV] BMS voltage in mV
+ * @param current [cA] BMS current in cA, negative value means in charging
+ * @param cyc_cnt  BMS change and discharge
+        cycle times
+ * @param temperature [degC] BMS temperature in degC
+ * @param cap_percent [%] BMS remaining power in percentage
+ * @param bat_id  BMS id, start from
+        0
+ * @param err_code  BMS error code,
+        0 means no error
+ * @param cell_num  BMS cell numbers
+ * @param cell_volt [mV] BMS cell voltage in mV
+ * @return length of the message in bytes (excluding serial stream start sign)
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
+                               uint32_t time_boot_ms, uint32_t voltage, int16_t current, uint16_t cyc_cnt, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char buf[MAVLINK_MSG_ID_VK_BMS_STATUS_LEN];
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint32_t(buf, 4, voltage);
+    _mav_put_uint32_t(buf, 8, err_code);
+    _mav_put_int16_t(buf, 12, current);
+    _mav_put_uint16_t(buf, 14, cyc_cnt);
+    _mav_put_int16_t(buf, 16, temperature);
+    _mav_put_uint16_t(buf, 18, cell_num);
+    _mav_put_int8_t(buf, 80, cap_percent);
+    _mav_put_uint8_t(buf, 81, bat_id);
+    _mav_put_uint16_t_array(buf, 20, cell_volt, 30);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
+#else
+    mavlink_vk_bms_status_t packet;
+    packet.time_boot_ms = time_boot_ms;
+    packet.voltage = voltage;
+    packet.err_code = err_code;
+    packet.current = current;
+    packet.cyc_cnt = cyc_cnt;
+    packet.temperature = temperature;
+    packet.cell_num = cell_num;
+    packet.cap_percent = cap_percent;
+    packet.bat_id = bat_id;
+    mav_array_memcpy(packet.cell_volt, cell_volt, sizeof(uint16_t)*30);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
+#endif
+
+    msg->msgid = MAVLINK_MSG_ID_VK_BMS_STATUS;
+    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_CRC);
+}
+
+/**
+ * @brief Pack a vk_bms_status message
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param status MAVLink status structure
+ * @param msg The MAVLink message to compress the data into
+ *
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
+ * @param voltage [mV] BMS voltage in mV
+ * @param current [cA] BMS current in cA, negative value means in charging
+ * @param cyc_cnt  BMS change and discharge
+        cycle times
+ * @param temperature [degC] BMS temperature in degC
+ * @param cap_percent [%] BMS remaining power in percentage
+ * @param bat_id  BMS id, start from
+        0
+ * @param err_code  BMS error code,
+        0 means no error
+ * @param cell_num  BMS cell numbers
+ * @param cell_volt [mV] BMS cell voltage in mV
+ * @return length of the message in bytes (excluding serial stream start sign)
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
+                               uint32_t time_boot_ms, uint32_t voltage, int16_t current, uint16_t cyc_cnt, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char buf[MAVLINK_MSG_ID_VK_BMS_STATUS_LEN];
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint32_t(buf, 4, voltage);
+    _mav_put_uint32_t(buf, 8, err_code);
+    _mav_put_int16_t(buf, 12, current);
+    _mav_put_uint16_t(buf, 14, cyc_cnt);
+    _mav_put_int16_t(buf, 16, temperature);
+    _mav_put_uint16_t(buf, 18, cell_num);
+    _mav_put_int8_t(buf, 80, cap_percent);
+    _mav_put_uint8_t(buf, 81, bat_id);
+    _mav_put_uint16_t_array(buf, 20, cell_volt, 30);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
+#else
+    mavlink_vk_bms_status_t packet;
+    packet.time_boot_ms = time_boot_ms;
+    packet.voltage = voltage;
+    packet.err_code = err_code;
+    packet.current = current;
+    packet.cyc_cnt = cyc_cnt;
+    packet.temperature = temperature;
+    packet.cell_num = cell_num;
+    packet.cap_percent = cap_percent;
+    packet.bat_id = bat_id;
+    mav_array_memcpy(packet.cell_volt, cell_volt, sizeof(uint16_t)*30);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
+#endif
+
+    msg->msgid = MAVLINK_MSG_ID_VK_BMS_STATUS;
+#if MAVLINK_CRC_EXTRA
+    return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_CRC);
+#else
+    return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
+#endif
+}
+
+/**
+ * @brief Pack a vk_bms_status message on a channel
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param chan The MAVLink channel this message will be sent over
+ * @param msg The MAVLink message to compress the data into
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
+ * @param voltage [mV] BMS voltage in mV
+ * @param current [cA] BMS current in cA, negative value means in charging
+ * @param cyc_cnt  BMS change and discharge
+        cycle times
+ * @param temperature [degC] BMS temperature in degC
+ * @param cap_percent [%] BMS remaining power in percentage
+ * @param bat_id  BMS id, start from
+        0
+ * @param err_code  BMS error code,
+        0 means no error
+ * @param cell_num  BMS cell numbers
+ * @param cell_volt [mV] BMS cell voltage in mV
+ * @return length of the message in bytes (excluding serial stream start sign)
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
+                               mavlink_message_t* msg,
+                                   uint32_t time_boot_ms,uint32_t voltage,int16_t current,uint16_t cyc_cnt,int16_t temperature,int8_t cap_percent,uint8_t bat_id,uint32_t err_code,uint16_t cell_num,const uint16_t *cell_volt)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char buf[MAVLINK_MSG_ID_VK_BMS_STATUS_LEN];
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint32_t(buf, 4, voltage);
+    _mav_put_uint32_t(buf, 8, err_code);
+    _mav_put_int16_t(buf, 12, current);
+    _mav_put_uint16_t(buf, 14, cyc_cnt);
+    _mav_put_int16_t(buf, 16, temperature);
+    _mav_put_uint16_t(buf, 18, cell_num);
+    _mav_put_int8_t(buf, 80, cap_percent);
+    _mav_put_uint8_t(buf, 81, bat_id);
+    _mav_put_uint16_t_array(buf, 20, cell_volt, 30);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
+#else
+    mavlink_vk_bms_status_t packet;
+    packet.time_boot_ms = time_boot_ms;
+    packet.voltage = voltage;
+    packet.err_code = err_code;
+    packet.current = current;
+    packet.cyc_cnt = cyc_cnt;
+    packet.temperature = temperature;
+    packet.cell_num = cell_num;
+    packet.cap_percent = cap_percent;
+    packet.bat_id = bat_id;
+    mav_array_memcpy(packet.cell_volt, cell_volt, sizeof(uint16_t)*30);
+        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
+#endif
+
+    msg->msgid = MAVLINK_MSG_ID_VK_BMS_STATUS;
+    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_CRC);
+}
+
+/**
+ * @brief Encode a vk_bms_status struct
+ *
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param msg The MAVLink message to compress the data into
+ * @param vk_bms_status C-struct to read the message contents from
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vk_bms_status_t* vk_bms_status)
+{
+    return mavlink_msg_vk_bms_status_pack(system_id, component_id, msg, vk_bms_status->time_boot_ms, vk_bms_status->voltage, vk_bms_status->current, vk_bms_status->cyc_cnt, vk_bms_status->temperature, vk_bms_status->cap_percent, vk_bms_status->bat_id, vk_bms_status->err_code, vk_bms_status->cell_num, vk_bms_status->cell_volt);
+}
+
+/**
+ * @brief Encode a vk_bms_status struct on a channel
+ *
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param chan The MAVLink channel this message will be sent over
+ * @param msg The MAVLink message to compress the data into
+ * @param vk_bms_status C-struct to read the message contents from
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vk_bms_status_t* vk_bms_status)
+{
+    return mavlink_msg_vk_bms_status_pack_chan(system_id, component_id, chan, msg, vk_bms_status->time_boot_ms, vk_bms_status->voltage, vk_bms_status->current, vk_bms_status->cyc_cnt, vk_bms_status->temperature, vk_bms_status->cap_percent, vk_bms_status->bat_id, vk_bms_status->err_code, vk_bms_status->cell_num, vk_bms_status->cell_volt);
+}
+
+/**
+ * @brief Encode a vk_bms_status struct with provided status structure
+ *
+ * @param system_id ID of this system
+ * @param component_id ID of this component (e.g. 200 for IMU)
+ * @param status MAVLink status structure
+ * @param msg The MAVLink message to compress the data into
+ * @param vk_bms_status C-struct to read the message contents from
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vk_bms_status_t* vk_bms_status)
+{
+    return mavlink_msg_vk_bms_status_pack_status(system_id, component_id, _status, msg,  vk_bms_status->time_boot_ms, vk_bms_status->voltage, vk_bms_status->current, vk_bms_status->cyc_cnt, vk_bms_status->temperature, vk_bms_status->cap_percent, vk_bms_status->bat_id, vk_bms_status->err_code, vk_bms_status->cell_num, vk_bms_status->cell_volt);
+}
+
+/**
+ * @brief Send a vk_bms_status message
+ * @param chan MAVLink channel to send the message
+ *
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
+ * @param voltage [mV] BMS voltage in mV
+ * @param current [cA] BMS current in cA, negative value means in charging
+ * @param cyc_cnt  BMS change and discharge
+        cycle times
+ * @param temperature [degC] BMS temperature in degC
+ * @param cap_percent [%] BMS remaining power in percentage
+ * @param bat_id  BMS id, start from
+        0
+ * @param err_code  BMS error code,
+        0 means no error
+ * @param cell_num  BMS cell numbers
+ * @param cell_volt [mV] BMS cell voltage in mV
+ */
+#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
+
+static inline void mavlink_msg_vk_bms_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t voltage, int16_t current, uint16_t cyc_cnt, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char buf[MAVLINK_MSG_ID_VK_BMS_STATUS_LEN];
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint32_t(buf, 4, voltage);
+    _mav_put_uint32_t(buf, 8, err_code);
+    _mav_put_int16_t(buf, 12, current);
+    _mav_put_uint16_t(buf, 14, cyc_cnt);
+    _mav_put_int16_t(buf, 16, temperature);
+    _mav_put_uint16_t(buf, 18, cell_num);
+    _mav_put_int8_t(buf, 80, cap_percent);
+    _mav_put_uint8_t(buf, 81, bat_id);
+    _mav_put_uint16_t_array(buf, 20, cell_volt, 30);
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_STATUS, buf, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_CRC);
+#else
+    mavlink_vk_bms_status_t packet;
+    packet.time_boot_ms = time_boot_ms;
+    packet.voltage = voltage;
+    packet.err_code = err_code;
+    packet.current = current;
+    packet.cyc_cnt = cyc_cnt;
+    packet.temperature = temperature;
+    packet.cell_num = cell_num;
+    packet.cap_percent = cap_percent;
+    packet.bat_id = bat_id;
+    mav_array_memcpy(packet.cell_volt, cell_volt, sizeof(uint16_t)*30);
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_CRC);
+#endif
+}
+
+/**
+ * @brief Send a vk_bms_status message
+ * @param chan MAVLink channel to send the message
+ * @param struct The MAVLink struct to serialize
+ */
+static inline void mavlink_msg_vk_bms_status_send_struct(mavlink_channel_t chan, const mavlink_vk_bms_status_t* vk_bms_status)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    mavlink_msg_vk_bms_status_send(chan, vk_bms_status->time_boot_ms, vk_bms_status->voltage, vk_bms_status->current, vk_bms_status->cyc_cnt, vk_bms_status->temperature, vk_bms_status->cap_percent, vk_bms_status->bat_id, vk_bms_status->err_code, vk_bms_status->cell_num, vk_bms_status->cell_volt);
+#else
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_STATUS, (const char *)vk_bms_status, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_CRC);
+#endif
+}
+
+#if MAVLINK_MSG_ID_VK_BMS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
+/*
+  This variant of _send() can be used to save stack space by re-using
+  memory from the receive buffer.  The caller provides a
+  mavlink_message_t which is the size of a full mavlink message. This
+  is usually the receive buffer for the channel, and allows a reply to an
+  incoming message with minimum stack space usage.
+ */
+static inline void mavlink_msg_vk_bms_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t time_boot_ms, uint32_t voltage, int16_t current, uint16_t cyc_cnt, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    char *buf = (char *)msgbuf;
+    _mav_put_uint32_t(buf, 0, time_boot_ms);
+    _mav_put_uint32_t(buf, 4, voltage);
+    _mav_put_uint32_t(buf, 8, err_code);
+    _mav_put_int16_t(buf, 12, current);
+    _mav_put_uint16_t(buf, 14, cyc_cnt);
+    _mav_put_int16_t(buf, 16, temperature);
+    _mav_put_uint16_t(buf, 18, cell_num);
+    _mav_put_int8_t(buf, 80, cap_percent);
+    _mav_put_uint8_t(buf, 81, bat_id);
+    _mav_put_uint16_t_array(buf, 20, cell_volt, 30);
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_STATUS, buf, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_CRC);
+#else
+    mavlink_vk_bms_status_t *packet = (mavlink_vk_bms_status_t *)msgbuf;
+    packet->time_boot_ms = time_boot_ms;
+    packet->voltage = voltage;
+    packet->err_code = err_code;
+    packet->current = current;
+    packet->cyc_cnt = cyc_cnt;
+    packet->temperature = temperature;
+    packet->cell_num = cell_num;
+    packet->cap_percent = cap_percent;
+    packet->bat_id = bat_id;
+    mav_array_memcpy(packet->cell_volt, cell_volt, sizeof(uint16_t)*30);
+    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_STATUS, (const char *)packet, MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN, MAVLINK_MSG_ID_VK_BMS_STATUS_CRC);
+#endif
+}
+#endif
+
+#endif
+
+// MESSAGE VK_BMS_STATUS UNPACKING
+
+
+/**
+ * @brief Get field time_boot_ms from vk_bms_status message
+ *
+ * @return [ms] Timestamp in ms from system boot.
+ */
+static inline uint32_t mavlink_msg_vk_bms_status_get_time_boot_ms(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_uint32_t(msg,  0);
+}
+
+/**
+ * @brief Get field voltage from vk_bms_status message
+ *
+ * @return [mV] BMS voltage in mV
+ */
+static inline uint32_t mavlink_msg_vk_bms_status_get_voltage(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_uint32_t(msg,  4);
+}
+
+/**
+ * @brief Get field current from vk_bms_status message
+ *
+ * @return [cA] BMS current in cA, negative value means in charging
+ */
+static inline int16_t mavlink_msg_vk_bms_status_get_current(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_int16_t(msg,  12);
+}
+
+/**
+ * @brief Get field cyc_cnt from vk_bms_status message
+ *
+ * @return  BMS change and discharge
+        cycle times
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_get_cyc_cnt(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_uint16_t(msg,  14);
+}
+
+/**
+ * @brief Get field temperature from vk_bms_status message
+ *
+ * @return [degC] BMS temperature in degC
+ */
+static inline int16_t mavlink_msg_vk_bms_status_get_temperature(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_int16_t(msg,  16);
+}
+
+/**
+ * @brief Get field cap_percent from vk_bms_status message
+ *
+ * @return [%] BMS remaining power in percentage
+ */
+static inline int8_t mavlink_msg_vk_bms_status_get_cap_percent(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_int8_t(msg,  80);
+}
+
+/**
+ * @brief Get field bat_id from vk_bms_status message
+ *
+ * @return  BMS id, start from
+        0
+ */
+static inline uint8_t mavlink_msg_vk_bms_status_get_bat_id(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_uint8_t(msg,  81);
+}
+
+/**
+ * @brief Get field err_code from vk_bms_status message
+ *
+ * @return  BMS error code,
+        0 means no error
+ */
+static inline uint32_t mavlink_msg_vk_bms_status_get_err_code(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_uint32_t(msg,  8);
+}
+
+/**
+ * @brief Get field cell_num from vk_bms_status message
+ *
+ * @return  BMS cell numbers
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_get_cell_num(const mavlink_message_t* msg)
+{
+    return _MAV_RETURN_uint16_t(msg,  18);
+}
+
+/**
+ * @brief Get field cell_volt from vk_bms_status message
+ *
+ * @return [mV] BMS cell voltage in mV
+ */
+static inline uint16_t mavlink_msg_vk_bms_status_get_cell_volt(const mavlink_message_t* msg, uint16_t *cell_volt)
+{
+    return _MAV_RETURN_uint16_t_array(msg, cell_volt, 30,  20);
+}
+
+/**
+ * @brief Decode a vk_bms_status message into a struct
+ *
+ * @param msg The message to decode
+ * @param vk_bms_status C-struct to decode the message contents into
+ */
+static inline void mavlink_msg_vk_bms_status_decode(const mavlink_message_t* msg, mavlink_vk_bms_status_t* vk_bms_status)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+    vk_bms_status->time_boot_ms = mavlink_msg_vk_bms_status_get_time_boot_ms(msg);
+    vk_bms_status->voltage = mavlink_msg_vk_bms_status_get_voltage(msg);
+    vk_bms_status->err_code = mavlink_msg_vk_bms_status_get_err_code(msg);
+    vk_bms_status->current = mavlink_msg_vk_bms_status_get_current(msg);
+    vk_bms_status->cyc_cnt = mavlink_msg_vk_bms_status_get_cyc_cnt(msg);
+    vk_bms_status->temperature = mavlink_msg_vk_bms_status_get_temperature(msg);
+    vk_bms_status->cell_num = mavlink_msg_vk_bms_status_get_cell_num(msg);
+    mavlink_msg_vk_bms_status_get_cell_volt(msg, vk_bms_status->cell_volt);
+    vk_bms_status->cap_percent = mavlink_msg_vk_bms_status_get_cap_percent(msg);
+    vk_bms_status->bat_id = mavlink_msg_vk_bms_status_get_bat_id(msg);
+#else
+        uint8_t len = msg->len < MAVLINK_MSG_ID_VK_BMS_STATUS_LEN? msg->len : MAVLINK_MSG_ID_VK_BMS_STATUS_LEN;
+        memset(vk_bms_status, 0, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
+    memcpy(vk_bms_status, _MAV_PAYLOAD(msg), len);
+#endif
+}

+ 6 - 6
v2.0/VKFly/mavlink_msg_vkins_status.h

@@ -11,7 +11,7 @@ typedef struct __mavlink_vkins_status_t {
  int32_t raw_longitude; /*< [degE7] raw latitidue for data fusion*/
  float baro_alt; /*< [m] raw baromoter altitude for data fusion*/
  float raw_gps_alt; /*< [m] gps amsl altitude for data fusion*/
- int16_t temperature; /*< [cdegC] temperature*/
+ int16_t temperature; /*< [degC] temperature*/
  uint8_t nav_status; /*<  VKINS
         navigation status flag.*/
  uint8_t s_flag1; /*<  vinks flag1*/
@@ -112,7 +112,7 @@ typedef struct __mavlink_vkins_status_t {
  * @param raw_gps_alt [m] gps amsl altitude for data fusion
  * @param solv_psat_num  satelites number for position
  * @param solv_hsat_num  satelites number for heading
- * @param temperature [cdegC] temperature
+ * @param temperature [degC] temperature
  * @param vibe_coe  
  * @return length of the message in bytes (excluding serial stream start sign)
  */
@@ -194,7 +194,7 @@ static inline uint16_t mavlink_msg_vkins_status_pack(uint8_t system_id, uint8_t
  * @param raw_gps_alt [m] gps amsl altitude for data fusion
  * @param solv_psat_num  satelites number for position
  * @param solv_hsat_num  satelites number for heading
- * @param temperature [cdegC] temperature
+ * @param temperature [degC] temperature
  * @param vibe_coe  
  * @return length of the message in bytes (excluding serial stream start sign)
  */
@@ -279,7 +279,7 @@ static inline uint16_t mavlink_msg_vkins_status_pack_status(uint8_t system_id, u
  * @param raw_gps_alt [m] gps amsl altitude for data fusion
  * @param solv_psat_num  satelites number for position
  * @param solv_hsat_num  satelites number for heading
- * @param temperature [cdegC] temperature
+ * @param temperature [degC] temperature
  * @param vibe_coe  
  * @return length of the message in bytes (excluding serial stream start sign)
  */
@@ -400,7 +400,7 @@ static inline uint16_t mavlink_msg_vkins_status_encode_status(uint8_t system_id,
  * @param raw_gps_alt [m] gps amsl altitude for data fusion
  * @param solv_psat_num  satelites number for position
  * @param solv_hsat_num  satelites number for heading
- * @param temperature [cdegC] temperature
+ * @param temperature [degC] temperature
  * @param vibe_coe  
  */
 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
@@ -696,7 +696,7 @@ static inline uint8_t mavlink_msg_vkins_status_get_solv_hsat_num(const mavlink_m
 /**
  * @brief Get field temperature from vkins_status message
  *
- * @return [cdegC] temperature
+ * @return [degC] temperature
  */
 static inline int16_t mavlink_msg_vkins_status_get_temperature(const mavlink_message_t* msg)
 {

+ 134 - 0
v2.0/VKFly/testsuite.h

@@ -230,6 +230,138 @@ static void mavlink_test_vk_roi_target(uint8_t system_id, uint8_t component_id,
 #endif
 }
 
+static void mavlink_test_vk_bms_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
+{
+#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
+    mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
+        if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VK_BMS_STATUS >= 256) {
+            return;
+        }
+#endif
+    mavlink_message_t msg;
+        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
+        uint16_t i;
+    mavlink_vk_bms_status_t packet_in = {
+        963497464,963497672,963497880,17859,17963,18067,18171,{ 18275, 18276, 18277, 18278, 18279, 18280, 18281, 18282, 18283, 18284, 18285, 18286, 18287, 18288, 18289, 18290, 18291, 18292, 18293, 18294, 18295, 18296, 18297, 18298, 18299, 18300, 18301, 18302, 18303, 18304 },245,56
+    };
+    mavlink_vk_bms_status_t packet1, packet2;
+        memset(&packet1, 0, sizeof(packet1));
+        packet1.time_boot_ms = packet_in.time_boot_ms;
+        packet1.voltage = packet_in.voltage;
+        packet1.err_code = packet_in.err_code;
+        packet1.current = packet_in.current;
+        packet1.cyc_cnt = packet_in.cyc_cnt;
+        packet1.temperature = packet_in.temperature;
+        packet1.cell_num = packet_in.cell_num;
+        packet1.cap_percent = packet_in.cap_percent;
+        packet1.bat_id = packet_in.bat_id;
+        
+        mav_array_memcpy(packet1.cell_volt, packet_in.cell_volt, sizeof(uint16_t)*30);
+        
+#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
+        if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
+           // cope with extensions
+           memset(MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN);
+        }
+#endif
+        memset(&packet2, 0, sizeof(packet2));
+    mavlink_msg_vk_bms_status_encode(system_id, component_id, &msg, &packet1);
+    mavlink_msg_vk_bms_status_decode(&msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+
+        memset(&packet2, 0, sizeof(packet2));
+    mavlink_msg_vk_bms_status_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.voltage , packet1.current , packet1.cyc_cnt , packet1.temperature , packet1.cap_percent , packet1.bat_id , packet1.err_code , packet1.cell_num , packet1.cell_volt );
+    mavlink_msg_vk_bms_status_decode(&msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+
+        memset(&packet2, 0, sizeof(packet2));
+    mavlink_msg_vk_bms_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.voltage , packet1.current , packet1.cyc_cnt , packet1.temperature , packet1.cap_percent , packet1.bat_id , packet1.err_code , packet1.cell_num , packet1.cell_volt );
+    mavlink_msg_vk_bms_status_decode(&msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+
+        memset(&packet2, 0, sizeof(packet2));
+        mavlink_msg_to_send_buffer(buffer, &msg);
+        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
+            comm_send_ch(MAVLINK_COMM_0, buffer[i]);
+        }
+    mavlink_msg_vk_bms_status_decode(last_msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+        
+        memset(&packet2, 0, sizeof(packet2));
+    mavlink_msg_vk_bms_status_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.voltage , packet1.current , packet1.cyc_cnt , packet1.temperature , packet1.cap_percent , packet1.bat_id , packet1.err_code , packet1.cell_num , packet1.cell_volt );
+    mavlink_msg_vk_bms_status_decode(last_msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+
+#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO
+    MAVLINK_ASSERT(mavlink_get_message_info_by_name("VK_BMS_STATUS") != NULL);
+    MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_VK_BMS_STATUS) != NULL);
+#endif
+}
+
+static void mavlink_test_vk_bms_info(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
+{
+#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
+    mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
+        if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VK_BMS_INFO >= 256) {
+            return;
+        }
+#endif
+    mavlink_message_t msg;
+        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
+        uint16_t i;
+    mavlink_vk_bms_info_t packet_in = {
+        963497464,{ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 },{ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 },{ 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156 },{ 197, 198, 199, 200, 201, 202, 203, 204, 205, 206 },{ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108 }
+    };
+    mavlink_vk_bms_info_t packet1, packet2;
+        memset(&packet1, 0, sizeof(packet1));
+        packet1.time_boot_ms = packet_in.time_boot_ms;
+        
+        mav_array_memcpy(packet1.man_name, packet_in.man_name, sizeof(uint8_t)*20);
+        mav_array_memcpy(packet1.model_name, packet_in.model_name, sizeof(uint8_t)*20);
+        mav_array_memcpy(packet1.sn_id, packet_in.sn_id, sizeof(uint8_t)*20);
+        mav_array_memcpy(packet1.hw_ver, packet_in.hw_ver, sizeof(uint8_t)*10);
+        mav_array_memcpy(packet1.fw_ver, packet_in.fw_ver, sizeof(uint8_t)*10);
+        
+#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
+        if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
+           // cope with extensions
+           memset(MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN);
+        }
+#endif
+        memset(&packet2, 0, sizeof(packet2));
+    mavlink_msg_vk_bms_info_encode(system_id, component_id, &msg, &packet1);
+    mavlink_msg_vk_bms_info_decode(&msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+
+        memset(&packet2, 0, sizeof(packet2));
+    mavlink_msg_vk_bms_info_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.man_name , packet1.model_name , packet1.sn_id , packet1.hw_ver , packet1.fw_ver );
+    mavlink_msg_vk_bms_info_decode(&msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+
+        memset(&packet2, 0, sizeof(packet2));
+    mavlink_msg_vk_bms_info_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.man_name , packet1.model_name , packet1.sn_id , packet1.hw_ver , packet1.fw_ver );
+    mavlink_msg_vk_bms_info_decode(&msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+
+        memset(&packet2, 0, sizeof(packet2));
+        mavlink_msg_to_send_buffer(buffer, &msg);
+        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
+            comm_send_ch(MAVLINK_COMM_0, buffer[i]);
+        }
+    mavlink_msg_vk_bms_info_decode(last_msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+        
+        memset(&packet2, 0, sizeof(packet2));
+    mavlink_msg_vk_bms_info_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.man_name , packet1.model_name , packet1.sn_id , packet1.hw_ver , packet1.fw_ver );
+    mavlink_msg_vk_bms_info_decode(last_msg, &packet2);
+        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
+
+#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO
+    MAVLINK_ASSERT(mavlink_get_message_info_by_name("VK_BMS_INFO") != NULL);
+    MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_VK_BMS_INFO) != NULL);
+#endif
+}
+
 static void mavlink_test_vk_fw_update_begin(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
 {
 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
@@ -536,6 +668,8 @@ static void mavlink_test_VKFly(uint8_t system_id, uint8_t component_id, mavlink_
     mavlink_test_vkins_status(system_id, component_id, last_msg);
     mavlink_test_vkfmu_status(system_id, component_id, last_msg);
     mavlink_test_vk_roi_target(system_id, component_id, last_msg);
+    mavlink_test_vk_bms_status(system_id, component_id, last_msg);
+    mavlink_test_vk_bms_info(system_id, component_id, last_msg);
     mavlink_test_vk_fw_update_begin(system_id, component_id, last_msg);
     mavlink_test_vk_fw_update_ack(system_id, component_id, last_msg);
     mavlink_test_vk_fw_update_data_request(system_id, component_id, last_msg);

+ 1 - 1
v2.0/VKFly/version.h

@@ -7,7 +7,7 @@
 #ifndef MAVLINK_VERSION_H
 #define MAVLINK_VERSION_H
 
-#define MAVLINK_BUILD_DATE "Tue Jun 04 2024"
+#define MAVLINK_BUILD_DATE "Tue Jun 18 2024"
 #define MAVLINK_WIRE_PROTOCOL_VERSION "2.0"
 #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
  

+ 1 - 1
v2.0/common/common.h

@@ -10,7 +10,7 @@
     #error Wrong include order: MAVLINK_COMMON.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call.
 #endif
 
-#define MAVLINK_COMMON_XML_HASH 3557628105774713632
+#define MAVLINK_COMMON_XML_HASH 106691953288040693
 
 #ifdef __cplusplus
 extern "C" {

+ 1 - 1
v2.0/common/mavlink.h

@@ -6,7 +6,7 @@
 #ifndef MAVLINK_H
 #define MAVLINK_H
 
-#define MAVLINK_PRIMARY_XML_HASH 3557628105774713632
+#define MAVLINK_PRIMARY_XML_HASH 106691953288040693
 
 #ifndef MAVLINK_STX
 #define MAVLINK_STX 253

+ 1 - 1
v2.0/common/version.h

@@ -7,7 +7,7 @@
 #ifndef MAVLINK_VERSION_H
 #define MAVLINK_VERSION_H
 
-#define MAVLINK_BUILD_DATE "Tue Jun 04 2024"
+#define MAVLINK_BUILD_DATE "Tue Jun 18 2024"
 #define MAVLINK_WIRE_PROTOCOL_VERSION "2.0"
 #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
  

+ 1 - 1
v2.0/minimal/mavlink.h

@@ -6,7 +6,7 @@
 #ifndef MAVLINK_H
 #define MAVLINK_H
 
-#define MAVLINK_PRIMARY_XML_HASH -1202384784193353241
+#define MAVLINK_PRIMARY_XML_HASH -1082902482250457618
 
 #ifndef MAVLINK_STX
 #define MAVLINK_STX 253

+ 1 - 1
v2.0/minimal/minimal.h

@@ -10,7 +10,7 @@
     #error Wrong include order: MAVLINK_MINIMAL.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call.
 #endif
 
-#define MAVLINK_MINIMAL_XML_HASH -1202384784193353241
+#define MAVLINK_MINIMAL_XML_HASH -1082902482250457618
 
 #ifdef __cplusplus
 extern "C" {

+ 1 - 1
v2.0/minimal/version.h

@@ -7,7 +7,7 @@
 #ifndef MAVLINK_VERSION_H
 #define MAVLINK_VERSION_H
 
-#define MAVLINK_BUILD_DATE "Tue Jun 04 2024"
+#define MAVLINK_BUILD_DATE "Tue Jun 18 2024"
 #define MAVLINK_WIRE_PROTOCOL_VERSION "2.0"
 #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 22
  

+ 1 - 1
v2.0/standard/mavlink.h

@@ -6,7 +6,7 @@
 #ifndef MAVLINK_H
 #define MAVLINK_H
 
-#define MAVLINK_PRIMARY_XML_HASH -3564793849385641896
+#define MAVLINK_PRIMARY_XML_HASH 1746884185192019578
 
 #ifndef MAVLINK_STX
 #define MAVLINK_STX 253

+ 1 - 1
v2.0/standard/standard.h

@@ -10,7 +10,7 @@
     #error Wrong include order: MAVLINK_STANDARD.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call.
 #endif
 
-#define MAVLINK_STANDARD_XML_HASH -3564793849385641896
+#define MAVLINK_STANDARD_XML_HASH 1746884185192019578
 
 #ifdef __cplusplus
 extern "C" {

+ 1 - 1
v2.0/standard/version.h

@@ -7,7 +7,7 @@
 #ifndef MAVLINK_VERSION_H
 #define MAVLINK_VERSION_H
 
-#define MAVLINK_BUILD_DATE "Tue Jun 04 2024"
+#define MAVLINK_BUILD_DATE "Tue Jun 18 2024"
 #define MAVLINK_WIRE_PROTOCOL_VERSION "2.0"
 #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 22
  

Some files were not shown because too many files changed in this diff