|
@@ -14,18 +14,20 @@ typedef struct __mavlink_vk_bms_status_t {
|
|
|
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*/
|
|
|
+ uint16_t cyc_cnt; /*< charge and discharge times */
|
|
|
int8_t cap_percent; /*< [%] BMS remaining power in percentage*/
|
|
|
uint8_t bat_id; /*< BMS id, start from
|
|
|
0*/
|
|
|
+ uint8_t health; /*< battery healthiness in percentage*/
|
|
|
} mavlink_vk_bms_status_t;
|
|
|
|
|
|
-#define MAVLINK_MSG_ID_VK_BMS_STATUS_LEN 80
|
|
|
-#define MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN 80
|
|
|
-#define MAVLINK_MSG_ID_53003_LEN 80
|
|
|
-#define MAVLINK_MSG_ID_53003_MIN_LEN 80
|
|
|
+#define MAVLINK_MSG_ID_VK_BMS_STATUS_LEN 83
|
|
|
+#define MAVLINK_MSG_ID_VK_BMS_STATUS_MIN_LEN 83
|
|
|
+#define MAVLINK_MSG_ID_53003_LEN 83
|
|
|
+#define MAVLINK_MSG_ID_53003_MIN_LEN 83
|
|
|
|
|
|
-#define MAVLINK_MSG_ID_VK_BMS_STATUS_CRC 43
|
|
|
-#define MAVLINK_MSG_ID_53003_CRC 43
|
|
|
+#define MAVLINK_MSG_ID_VK_BMS_STATUS_CRC 200
|
|
|
+#define MAVLINK_MSG_ID_53003_CRC 200
|
|
|
|
|
|
#define MAVLINK_MSG_VK_BMS_STATUS_FIELD_CELL_VOLT_LEN 30
|
|
|
|
|
@@ -33,31 +35,35 @@ typedef struct __mavlink_vk_bms_status_t {
|
|
|
#define MAVLINK_MESSAGE_INFO_VK_BMS_STATUS { \
|
|
|
53003, \
|
|
|
"VK_BMS_STATUS", \
|
|
|
- 9, \
|
|
|
+ 11, \
|
|
|
{ { "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) }, \
|
|
|
{ "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_vk_bms_status_t, temperature) }, \
|
|
|
- { "cap_percent", NULL, MAVLINK_TYPE_INT8_T, 0, 78, offsetof(mavlink_vk_bms_status_t, cap_percent) }, \
|
|
|
- { "bat_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 79, offsetof(mavlink_vk_bms_status_t, bat_id) }, \
|
|
|
+ { "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, 16, offsetof(mavlink_vk_bms_status_t, cell_num) }, \
|
|
|
{ "cell_volt", NULL, MAVLINK_TYPE_UINT16_T, 30, 18, offsetof(mavlink_vk_bms_status_t, cell_volt) }, \
|
|
|
+ { "cyc_cnt", NULL, MAVLINK_TYPE_UINT16_T, 0, 78, offsetof(mavlink_vk_bms_status_t, cyc_cnt) }, \
|
|
|
+ { "health", NULL, MAVLINK_TYPE_UINT8_T, 0, 82, offsetof(mavlink_vk_bms_status_t, health) }, \
|
|
|
} \
|
|
|
}
|
|
|
#else
|
|
|
#define MAVLINK_MESSAGE_INFO_VK_BMS_STATUS { \
|
|
|
"VK_BMS_STATUS", \
|
|
|
- 9, \
|
|
|
+ 11, \
|
|
|
{ { "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) }, \
|
|
|
{ "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_vk_bms_status_t, temperature) }, \
|
|
|
- { "cap_percent", NULL, MAVLINK_TYPE_INT8_T, 0, 78, offsetof(mavlink_vk_bms_status_t, cap_percent) }, \
|
|
|
- { "bat_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 79, offsetof(mavlink_vk_bms_status_t, bat_id) }, \
|
|
|
+ { "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, 16, offsetof(mavlink_vk_bms_status_t, cell_num) }, \
|
|
|
{ "cell_volt", NULL, MAVLINK_TYPE_UINT16_T, 30, 18, offsetof(mavlink_vk_bms_status_t, cell_volt) }, \
|
|
|
+ { "cyc_cnt", NULL, MAVLINK_TYPE_UINT16_T, 0, 78, offsetof(mavlink_vk_bms_status_t, cyc_cnt) }, \
|
|
|
+ { "health", NULL, MAVLINK_TYPE_UINT8_T, 0, 82, offsetof(mavlink_vk_bms_status_t, health) }, \
|
|
|
} \
|
|
|
}
|
|
|
#endif
|
|
@@ -80,10 +86,12 @@ typedef struct __mavlink_vk_bms_status_t {
|
|
|
0 means no error
|
|
|
* @param cell_num BMS cell numbers
|
|
|
* @param cell_volt [mV] BMS cell voltage in mV
|
|
|
+ * @param cyc_cnt charge and discharge times
|
|
|
+ * @param health battery healthiness in percentage
|
|
|
* @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, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt)
|
|
|
+ uint32_t time_boot_ms, uint32_t voltage, int16_t current, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt, uint16_t cyc_cnt, uint8_t health)
|
|
|
{
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
char buf[MAVLINK_MSG_ID_VK_BMS_STATUS_LEN];
|
|
@@ -93,8 +101,10 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack(uint8_t system_id, uint8_t
|
|
|
_mav_put_int16_t(buf, 12, current);
|
|
|
_mav_put_int16_t(buf, 14, temperature);
|
|
|
_mav_put_uint16_t(buf, 16, cell_num);
|
|
|
- _mav_put_int8_t(buf, 78, cap_percent);
|
|
|
- _mav_put_uint8_t(buf, 79, bat_id);
|
|
|
+ _mav_put_uint16_t(buf, 78, cyc_cnt);
|
|
|
+ _mav_put_int8_t(buf, 80, cap_percent);
|
|
|
+ _mav_put_uint8_t(buf, 81, bat_id);
|
|
|
+ _mav_put_uint8_t(buf, 82, health);
|
|
|
_mav_put_uint16_t_array(buf, 18, cell_volt, 30);
|
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
|
|
|
#else
|
|
@@ -105,8 +115,10 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack(uint8_t system_id, uint8_t
|
|
|
packet.current = current;
|
|
|
packet.temperature = temperature;
|
|
|
packet.cell_num = cell_num;
|
|
|
+ packet.cyc_cnt = cyc_cnt;
|
|
|
packet.cap_percent = cap_percent;
|
|
|
packet.bat_id = bat_id;
|
|
|
+ packet.health = health;
|
|
|
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
|
|
@@ -134,10 +146,12 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack(uint8_t system_id, uint8_t
|
|
|
0 means no error
|
|
|
* @param cell_num BMS cell numbers
|
|
|
* @param cell_volt [mV] BMS cell voltage in mV
|
|
|
+ * @param cyc_cnt charge and discharge times
|
|
|
+ * @param health battery healthiness in percentage
|
|
|
* @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, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt)
|
|
|
+ uint32_t time_boot_ms, uint32_t voltage, int16_t current, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt, uint16_t cyc_cnt, uint8_t health)
|
|
|
{
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
char buf[MAVLINK_MSG_ID_VK_BMS_STATUS_LEN];
|
|
@@ -147,8 +161,10 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack_status(uint8_t system_id,
|
|
|
_mav_put_int16_t(buf, 12, current);
|
|
|
_mav_put_int16_t(buf, 14, temperature);
|
|
|
_mav_put_uint16_t(buf, 16, cell_num);
|
|
|
- _mav_put_int8_t(buf, 78, cap_percent);
|
|
|
- _mav_put_uint8_t(buf, 79, bat_id);
|
|
|
+ _mav_put_uint16_t(buf, 78, cyc_cnt);
|
|
|
+ _mav_put_int8_t(buf, 80, cap_percent);
|
|
|
+ _mav_put_uint8_t(buf, 81, bat_id);
|
|
|
+ _mav_put_uint8_t(buf, 82, health);
|
|
|
_mav_put_uint16_t_array(buf, 18, cell_volt, 30);
|
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
|
|
|
#else
|
|
@@ -159,8 +175,10 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack_status(uint8_t system_id,
|
|
|
packet.current = current;
|
|
|
packet.temperature = temperature;
|
|
|
packet.cell_num = cell_num;
|
|
|
+ packet.cyc_cnt = cyc_cnt;
|
|
|
packet.cap_percent = cap_percent;
|
|
|
packet.bat_id = bat_id;
|
|
|
+ packet.health = health;
|
|
|
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
|
|
@@ -191,11 +209,13 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack_status(uint8_t system_id,
|
|
|
0 means no error
|
|
|
* @param cell_num BMS cell numbers
|
|
|
* @param cell_volt [mV] BMS cell voltage in mV
|
|
|
+ * @param cyc_cnt charge and discharge times
|
|
|
+ * @param health battery healthiness in percentage
|
|
|
* @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,int16_t temperature,int8_t cap_percent,uint8_t bat_id,uint32_t err_code,uint16_t cell_num,const uint16_t *cell_volt)
|
|
|
+ uint32_t time_boot_ms,uint32_t voltage,int16_t current,int16_t temperature,int8_t cap_percent,uint8_t bat_id,uint32_t err_code,uint16_t cell_num,const uint16_t *cell_volt,uint16_t cyc_cnt,uint8_t health)
|
|
|
{
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
char buf[MAVLINK_MSG_ID_VK_BMS_STATUS_LEN];
|
|
@@ -205,8 +225,10 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack_chan(uint8_t system_id, ui
|
|
|
_mav_put_int16_t(buf, 12, current);
|
|
|
_mav_put_int16_t(buf, 14, temperature);
|
|
|
_mav_put_uint16_t(buf, 16, cell_num);
|
|
|
- _mav_put_int8_t(buf, 78, cap_percent);
|
|
|
- _mav_put_uint8_t(buf, 79, bat_id);
|
|
|
+ _mav_put_uint16_t(buf, 78, cyc_cnt);
|
|
|
+ _mav_put_int8_t(buf, 80, cap_percent);
|
|
|
+ _mav_put_uint8_t(buf, 81, bat_id);
|
|
|
+ _mav_put_uint8_t(buf, 82, health);
|
|
|
_mav_put_uint16_t_array(buf, 18, cell_volt, 30);
|
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_STATUS_LEN);
|
|
|
#else
|
|
@@ -217,8 +239,10 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack_chan(uint8_t system_id, ui
|
|
|
packet.current = current;
|
|
|
packet.temperature = temperature;
|
|
|
packet.cell_num = cell_num;
|
|
|
+ packet.cyc_cnt = cyc_cnt;
|
|
|
packet.cap_percent = cap_percent;
|
|
|
packet.bat_id = bat_id;
|
|
|
+ packet.health = health;
|
|
|
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
|
|
@@ -237,7 +261,7 @@ static inline uint16_t mavlink_msg_vk_bms_status_pack_chan(uint8_t system_id, ui
|
|
|
*/
|
|
|
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->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);
|
|
|
+ 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->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, vk_bms_status->cyc_cnt, vk_bms_status->health);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -251,7 +275,7 @@ static inline uint16_t mavlink_msg_vk_bms_status_encode(uint8_t system_id, uint8
|
|
|
*/
|
|
|
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->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);
|
|
|
+ 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->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, vk_bms_status->cyc_cnt, vk_bms_status->health);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -265,7 +289,7 @@ static inline uint16_t mavlink_msg_vk_bms_status_encode_chan(uint8_t system_id,
|
|
|
*/
|
|
|
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->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);
|
|
|
+ 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->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, vk_bms_status->cyc_cnt, vk_bms_status->health);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -284,10 +308,12 @@ static inline uint16_t mavlink_msg_vk_bms_status_encode_status(uint8_t system_id
|
|
|
0 means no error
|
|
|
* @param cell_num BMS cell numbers
|
|
|
* @param cell_volt [mV] BMS cell voltage in mV
|
|
|
+ * @param cyc_cnt charge and discharge times
|
|
|
+ * @param health battery healthiness in percentage
|
|
|
*/
|
|
|
#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, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt)
|
|
|
+static inline void mavlink_msg_vk_bms_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t voltage, int16_t current, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt, uint16_t cyc_cnt, uint8_t health)
|
|
|
{
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
char buf[MAVLINK_MSG_ID_VK_BMS_STATUS_LEN];
|
|
@@ -297,8 +323,10 @@ static inline void mavlink_msg_vk_bms_status_send(mavlink_channel_t chan, uint32
|
|
|
_mav_put_int16_t(buf, 12, current);
|
|
|
_mav_put_int16_t(buf, 14, temperature);
|
|
|
_mav_put_uint16_t(buf, 16, cell_num);
|
|
|
- _mav_put_int8_t(buf, 78, cap_percent);
|
|
|
- _mav_put_uint8_t(buf, 79, bat_id);
|
|
|
+ _mav_put_uint16_t(buf, 78, cyc_cnt);
|
|
|
+ _mav_put_int8_t(buf, 80, cap_percent);
|
|
|
+ _mav_put_uint8_t(buf, 81, bat_id);
|
|
|
+ _mav_put_uint8_t(buf, 82, health);
|
|
|
_mav_put_uint16_t_array(buf, 18, 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
|
|
@@ -309,8 +337,10 @@ static inline void mavlink_msg_vk_bms_status_send(mavlink_channel_t chan, uint32
|
|
|
packet.current = current;
|
|
|
packet.temperature = temperature;
|
|
|
packet.cell_num = cell_num;
|
|
|
+ packet.cyc_cnt = cyc_cnt;
|
|
|
packet.cap_percent = cap_percent;
|
|
|
packet.bat_id = bat_id;
|
|
|
+ packet.health = health;
|
|
|
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
|
|
@@ -324,7 +354,7 @@ static inline void mavlink_msg_vk_bms_status_send(mavlink_channel_t chan, uint32
|
|
|
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->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);
|
|
|
+ mavlink_msg_vk_bms_status_send(chan, vk_bms_status->time_boot_ms, vk_bms_status->voltage, vk_bms_status->current, 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, vk_bms_status->cyc_cnt, vk_bms_status->health);
|
|
|
#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
|
|
@@ -338,7 +368,7 @@ static inline void mavlink_msg_vk_bms_status_send_struct(mavlink_channel_t chan,
|
|
|
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, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt)
|
|
|
+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, int16_t temperature, int8_t cap_percent, uint8_t bat_id, uint32_t err_code, uint16_t cell_num, const uint16_t *cell_volt, uint16_t cyc_cnt, uint8_t health)
|
|
|
{
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
char *buf = (char *)msgbuf;
|
|
@@ -348,8 +378,10 @@ static inline void mavlink_msg_vk_bms_status_send_buf(mavlink_message_t *msgbuf,
|
|
|
_mav_put_int16_t(buf, 12, current);
|
|
|
_mav_put_int16_t(buf, 14, temperature);
|
|
|
_mav_put_uint16_t(buf, 16, cell_num);
|
|
|
- _mav_put_int8_t(buf, 78, cap_percent);
|
|
|
- _mav_put_uint8_t(buf, 79, bat_id);
|
|
|
+ _mav_put_uint16_t(buf, 78, cyc_cnt);
|
|
|
+ _mav_put_int8_t(buf, 80, cap_percent);
|
|
|
+ _mav_put_uint8_t(buf, 81, bat_id);
|
|
|
+ _mav_put_uint8_t(buf, 82, health);
|
|
|
_mav_put_uint16_t_array(buf, 18, 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
|
|
@@ -360,8 +392,10 @@ static inline void mavlink_msg_vk_bms_status_send_buf(mavlink_message_t *msgbuf,
|
|
|
packet->current = current;
|
|
|
packet->temperature = temperature;
|
|
|
packet->cell_num = cell_num;
|
|
|
+ packet->cyc_cnt = cyc_cnt;
|
|
|
packet->cap_percent = cap_percent;
|
|
|
packet->bat_id = bat_id;
|
|
|
+ packet->health = health;
|
|
|
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
|
|
@@ -421,7 +455,7 @@ static inline int16_t mavlink_msg_vk_bms_status_get_temperature(const mavlink_me
|
|
|
*/
|
|
|
static inline int8_t mavlink_msg_vk_bms_status_get_cap_percent(const mavlink_message_t* msg)
|
|
|
{
|
|
|
- return _MAV_RETURN_int8_t(msg, 78);
|
|
|
+ return _MAV_RETURN_int8_t(msg, 80);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -432,7 +466,7 @@ static inline int8_t mavlink_msg_vk_bms_status_get_cap_percent(const mavlink_mes
|
|
|
*/
|
|
|
static inline uint8_t mavlink_msg_vk_bms_status_get_bat_id(const mavlink_message_t* msg)
|
|
|
{
|
|
|
- return _MAV_RETURN_uint8_t(msg, 79);
|
|
|
+ return _MAV_RETURN_uint8_t(msg, 81);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -466,6 +500,26 @@ static inline uint16_t mavlink_msg_vk_bms_status_get_cell_volt(const mavlink_mes
|
|
|
return _MAV_RETURN_uint16_t_array(msg, cell_volt, 30, 18);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @brief Get field cyc_cnt from vk_bms_status message
|
|
|
+ *
|
|
|
+ * @return charge and discharge times
|
|
|
+ */
|
|
|
+static inline uint16_t mavlink_msg_vk_bms_status_get_cyc_cnt(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_uint16_t(msg, 78);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field health from vk_bms_status message
|
|
|
+ *
|
|
|
+ * @return battery healthiness in percentage
|
|
|
+ */
|
|
|
+static inline uint8_t mavlink_msg_vk_bms_status_get_health(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_uint8_t(msg, 82);
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* @brief Decode a vk_bms_status message into a struct
|
|
|
*
|
|
@@ -482,8 +536,10 @@ static inline void mavlink_msg_vk_bms_status_decode(const mavlink_message_t* 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->cyc_cnt = mavlink_msg_vk_bms_status_get_cyc_cnt(msg);
|
|
|
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);
|
|
|
+ vk_bms_status->health = mavlink_msg_vk_bms_status_get_health(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);
|