|
|
@@ -0,0 +1,512 @@
|
|
|
+#pragma once
|
|
|
+// MESSAGE VK_ADC_EXT_STATUS PACKING
|
|
|
+
|
|
|
+#define MAVLINK_MSG_ID_VK_ADC_EXT_STATUS 53031
|
|
|
+
|
|
|
+
|
|
|
+typedef struct __mavlink_vk_adc_ext_status_t {
|
|
|
+ uint32_t time_boot_ms; /*< [ms] Timestamp in ms from system boot.*/
|
|
|
+ float raw_voltage; /*< [V] Calibrated ADC_EX voltage.*/
|
|
|
+ float voltage_ratio; /*< ADC_EXT_V_DIV ratio applied to raw_voltage.*/
|
|
|
+ float voltage; /*< [V] Voltage mode value.*/
|
|
|
+ float current; /*< [A] Current mode value.*/
|
|
|
+ float fuel_percent; /*< [%] Fuel mode value.*/
|
|
|
+ uint8_t type; /*< 0:disable, 1:voltage, 2:current, 3:fuel*/
|
|
|
+ uint8_t valid; /*< 0:invalid, 1:valid*/
|
|
|
+ uint8_t fuel_low1; /*< 0:normal, 1:below ADC_EXT_FUEL_LOW1*/
|
|
|
+ uint8_t fuel_low2; /*< 0:normal, 1:below ADC_EXT_FUEL_LOW2*/
|
|
|
+} mavlink_vk_adc_ext_status_t;
|
|
|
+
|
|
|
+#define MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN 28
|
|
|
+#define MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN 28
|
|
|
+#define MAVLINK_MSG_ID_53031_LEN 28
|
|
|
+#define MAVLINK_MSG_ID_53031_MIN_LEN 28
|
|
|
+
|
|
|
+#define MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC 39
|
|
|
+#define MAVLINK_MSG_ID_53031_CRC 39
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+#if MAVLINK_COMMAND_24BIT
|
|
|
+#define MAVLINK_MESSAGE_INFO_VK_ADC_EXT_STATUS { \
|
|
|
+ 53031, \
|
|
|
+ "VK_ADC_EXT_STATUS", \
|
|
|
+ 10, \
|
|
|
+ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_adc_ext_status_t, time_boot_ms) }, \
|
|
|
+ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_vk_adc_ext_status_t, type) }, \
|
|
|
+ { "valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_vk_adc_ext_status_t, valid) }, \
|
|
|
+ { "raw_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_vk_adc_ext_status_t, raw_voltage) }, \
|
|
|
+ { "voltage_ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vk_adc_ext_status_t, voltage_ratio) }, \
|
|
|
+ { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vk_adc_ext_status_t, voltage) }, \
|
|
|
+ { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vk_adc_ext_status_t, current) }, \
|
|
|
+ { "fuel_percent", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_vk_adc_ext_status_t, fuel_percent) }, \
|
|
|
+ { "fuel_low1", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_vk_adc_ext_status_t, fuel_low1) }, \
|
|
|
+ { "fuel_low2", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_vk_adc_ext_status_t, fuel_low2) }, \
|
|
|
+ } \
|
|
|
+}
|
|
|
+#else
|
|
|
+#define MAVLINK_MESSAGE_INFO_VK_ADC_EXT_STATUS { \
|
|
|
+ "VK_ADC_EXT_STATUS", \
|
|
|
+ 10, \
|
|
|
+ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_adc_ext_status_t, time_boot_ms) }, \
|
|
|
+ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_vk_adc_ext_status_t, type) }, \
|
|
|
+ { "valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_vk_adc_ext_status_t, valid) }, \
|
|
|
+ { "raw_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_vk_adc_ext_status_t, raw_voltage) }, \
|
|
|
+ { "voltage_ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vk_adc_ext_status_t, voltage_ratio) }, \
|
|
|
+ { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vk_adc_ext_status_t, voltage) }, \
|
|
|
+ { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vk_adc_ext_status_t, current) }, \
|
|
|
+ { "fuel_percent", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_vk_adc_ext_status_t, fuel_percent) }, \
|
|
|
+ { "fuel_low1", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_vk_adc_ext_status_t, fuel_low1) }, \
|
|
|
+ { "fuel_low2", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_vk_adc_ext_status_t, fuel_low2) }, \
|
|
|
+ } \
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Pack a vk_adc_ext_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 type 0:disable, 1:voltage, 2:current, 3:fuel
|
|
|
+ * @param valid 0:invalid, 1:valid
|
|
|
+ * @param raw_voltage [V] Calibrated ADC_EX voltage.
|
|
|
+ * @param voltage_ratio ADC_EXT_V_DIV ratio applied to raw_voltage.
|
|
|
+ * @param voltage [V] Voltage mode value.
|
|
|
+ * @param current [A] Current mode value.
|
|
|
+ * @param fuel_percent [%] Fuel mode value.
|
|
|
+ * @param fuel_low1 0:normal, 1:below ADC_EXT_FUEL_LOW1
|
|
|
+ * @param fuel_low2 0:normal, 1:below ADC_EXT_FUEL_LOW2
|
|
|
+ * @return length of the message in bytes (excluding serial stream start sign)
|
|
|
+ */
|
|
|
+static inline uint16_t mavlink_msg_vk_adc_ext_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
|
|
+ uint32_t time_boot_ms, uint8_t type, uint8_t valid, float raw_voltage, float voltage_ratio, float voltage, float current, float fuel_percent, uint8_t fuel_low1, uint8_t fuel_low2)
|
|
|
+{
|
|
|
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
+ char buf[MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN];
|
|
|
+ _mav_put_uint32_t(buf, 0, time_boot_ms);
|
|
|
+ _mav_put_float(buf, 4, raw_voltage);
|
|
|
+ _mav_put_float(buf, 8, voltage_ratio);
|
|
|
+ _mav_put_float(buf, 12, voltage);
|
|
|
+ _mav_put_float(buf, 16, current);
|
|
|
+ _mav_put_float(buf, 20, fuel_percent);
|
|
|
+ _mav_put_uint8_t(buf, 24, type);
|
|
|
+ _mav_put_uint8_t(buf, 25, valid);
|
|
|
+ _mav_put_uint8_t(buf, 26, fuel_low1);
|
|
|
+ _mav_put_uint8_t(buf, 27, fuel_low2);
|
|
|
+
|
|
|
+ memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN);
|
|
|
+#else
|
|
|
+ mavlink_vk_adc_ext_status_t packet;
|
|
|
+ packet.time_boot_ms = time_boot_ms;
|
|
|
+ packet.raw_voltage = raw_voltage;
|
|
|
+ packet.voltage_ratio = voltage_ratio;
|
|
|
+ packet.voltage = voltage;
|
|
|
+ packet.current = current;
|
|
|
+ packet.fuel_percent = fuel_percent;
|
|
|
+ packet.type = type;
|
|
|
+ packet.valid = valid;
|
|
|
+ packet.fuel_low1 = fuel_low1;
|
|
|
+ packet.fuel_low2 = fuel_low2;
|
|
|
+
|
|
|
+ memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN);
|
|
|
+#endif
|
|
|
+
|
|
|
+ msg->msgid = MAVLINK_MSG_ID_VK_ADC_EXT_STATUS;
|
|
|
+ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Pack a vk_adc_ext_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 type 0:disable, 1:voltage, 2:current, 3:fuel
|
|
|
+ * @param valid 0:invalid, 1:valid
|
|
|
+ * @param raw_voltage [V] Calibrated ADC_EX voltage.
|
|
|
+ * @param voltage_ratio ADC_EXT_V_DIV ratio applied to raw_voltage.
|
|
|
+ * @param voltage [V] Voltage mode value.
|
|
|
+ * @param current [A] Current mode value.
|
|
|
+ * @param fuel_percent [%] Fuel mode value.
|
|
|
+ * @param fuel_low1 0:normal, 1:below ADC_EXT_FUEL_LOW1
|
|
|
+ * @param fuel_low2 0:normal, 1:below ADC_EXT_FUEL_LOW2
|
|
|
+ * @return length of the message in bytes (excluding serial stream start sign)
|
|
|
+ */
|
|
|
+static inline uint16_t mavlink_msg_vk_adc_ext_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
|
|
|
+ uint32_t time_boot_ms, uint8_t type, uint8_t valid, float raw_voltage, float voltage_ratio, float voltage, float current, float fuel_percent, uint8_t fuel_low1, uint8_t fuel_low2)
|
|
|
+{
|
|
|
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
+ char buf[MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN];
|
|
|
+ _mav_put_uint32_t(buf, 0, time_boot_ms);
|
|
|
+ _mav_put_float(buf, 4, raw_voltage);
|
|
|
+ _mav_put_float(buf, 8, voltage_ratio);
|
|
|
+ _mav_put_float(buf, 12, voltage);
|
|
|
+ _mav_put_float(buf, 16, current);
|
|
|
+ _mav_put_float(buf, 20, fuel_percent);
|
|
|
+ _mav_put_uint8_t(buf, 24, type);
|
|
|
+ _mav_put_uint8_t(buf, 25, valid);
|
|
|
+ _mav_put_uint8_t(buf, 26, fuel_low1);
|
|
|
+ _mav_put_uint8_t(buf, 27, fuel_low2);
|
|
|
+
|
|
|
+ memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN);
|
|
|
+#else
|
|
|
+ mavlink_vk_adc_ext_status_t packet;
|
|
|
+ packet.time_boot_ms = time_boot_ms;
|
|
|
+ packet.raw_voltage = raw_voltage;
|
|
|
+ packet.voltage_ratio = voltage_ratio;
|
|
|
+ packet.voltage = voltage;
|
|
|
+ packet.current = current;
|
|
|
+ packet.fuel_percent = fuel_percent;
|
|
|
+ packet.type = type;
|
|
|
+ packet.valid = valid;
|
|
|
+ packet.fuel_low1 = fuel_low1;
|
|
|
+ packet.fuel_low2 = fuel_low2;
|
|
|
+
|
|
|
+ memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN);
|
|
|
+#endif
|
|
|
+
|
|
|
+ msg->msgid = MAVLINK_MSG_ID_VK_ADC_EXT_STATUS;
|
|
|
+#if MAVLINK_CRC_EXTRA
|
|
|
+ return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC);
|
|
|
+#else
|
|
|
+ return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Pack a vk_adc_ext_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 type 0:disable, 1:voltage, 2:current, 3:fuel
|
|
|
+ * @param valid 0:invalid, 1:valid
|
|
|
+ * @param raw_voltage [V] Calibrated ADC_EX voltage.
|
|
|
+ * @param voltage_ratio ADC_EXT_V_DIV ratio applied to raw_voltage.
|
|
|
+ * @param voltage [V] Voltage mode value.
|
|
|
+ * @param current [A] Current mode value.
|
|
|
+ * @param fuel_percent [%] Fuel mode value.
|
|
|
+ * @param fuel_low1 0:normal, 1:below ADC_EXT_FUEL_LOW1
|
|
|
+ * @param fuel_low2 0:normal, 1:below ADC_EXT_FUEL_LOW2
|
|
|
+ * @return length of the message in bytes (excluding serial stream start sign)
|
|
|
+ */
|
|
|
+static inline uint16_t mavlink_msg_vk_adc_ext_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
|
|
+ mavlink_message_t* msg,
|
|
|
+ uint32_t time_boot_ms,uint8_t type,uint8_t valid,float raw_voltage,float voltage_ratio,float voltage,float current,float fuel_percent,uint8_t fuel_low1,uint8_t fuel_low2)
|
|
|
+{
|
|
|
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
+ char buf[MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN];
|
|
|
+ _mav_put_uint32_t(buf, 0, time_boot_ms);
|
|
|
+ _mav_put_float(buf, 4, raw_voltage);
|
|
|
+ _mav_put_float(buf, 8, voltage_ratio);
|
|
|
+ _mav_put_float(buf, 12, voltage);
|
|
|
+ _mav_put_float(buf, 16, current);
|
|
|
+ _mav_put_float(buf, 20, fuel_percent);
|
|
|
+ _mav_put_uint8_t(buf, 24, type);
|
|
|
+ _mav_put_uint8_t(buf, 25, valid);
|
|
|
+ _mav_put_uint8_t(buf, 26, fuel_low1);
|
|
|
+ _mav_put_uint8_t(buf, 27, fuel_low2);
|
|
|
+
|
|
|
+ memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN);
|
|
|
+#else
|
|
|
+ mavlink_vk_adc_ext_status_t packet;
|
|
|
+ packet.time_boot_ms = time_boot_ms;
|
|
|
+ packet.raw_voltage = raw_voltage;
|
|
|
+ packet.voltage_ratio = voltage_ratio;
|
|
|
+ packet.voltage = voltage;
|
|
|
+ packet.current = current;
|
|
|
+ packet.fuel_percent = fuel_percent;
|
|
|
+ packet.type = type;
|
|
|
+ packet.valid = valid;
|
|
|
+ packet.fuel_low1 = fuel_low1;
|
|
|
+ packet.fuel_low2 = fuel_low2;
|
|
|
+
|
|
|
+ memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN);
|
|
|
+#endif
|
|
|
+
|
|
|
+ msg->msgid = MAVLINK_MSG_ID_VK_ADC_EXT_STATUS;
|
|
|
+ return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Encode a vk_adc_ext_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_adc_ext_status C-struct to read the message contents from
|
|
|
+ */
|
|
|
+static inline uint16_t mavlink_msg_vk_adc_ext_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vk_adc_ext_status_t* vk_adc_ext_status)
|
|
|
+{
|
|
|
+ return mavlink_msg_vk_adc_ext_status_pack(system_id, component_id, msg, vk_adc_ext_status->time_boot_ms, vk_adc_ext_status->type, vk_adc_ext_status->valid, vk_adc_ext_status->raw_voltage, vk_adc_ext_status->voltage_ratio, vk_adc_ext_status->voltage, vk_adc_ext_status->current, vk_adc_ext_status->fuel_percent, vk_adc_ext_status->fuel_low1, vk_adc_ext_status->fuel_low2);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Encode a vk_adc_ext_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_adc_ext_status C-struct to read the message contents from
|
|
|
+ */
|
|
|
+static inline uint16_t mavlink_msg_vk_adc_ext_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vk_adc_ext_status_t* vk_adc_ext_status)
|
|
|
+{
|
|
|
+ return mavlink_msg_vk_adc_ext_status_pack_chan(system_id, component_id, chan, msg, vk_adc_ext_status->time_boot_ms, vk_adc_ext_status->type, vk_adc_ext_status->valid, vk_adc_ext_status->raw_voltage, vk_adc_ext_status->voltage_ratio, vk_adc_ext_status->voltage, vk_adc_ext_status->current, vk_adc_ext_status->fuel_percent, vk_adc_ext_status->fuel_low1, vk_adc_ext_status->fuel_low2);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Encode a vk_adc_ext_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_adc_ext_status C-struct to read the message contents from
|
|
|
+ */
|
|
|
+static inline uint16_t mavlink_msg_vk_adc_ext_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vk_adc_ext_status_t* vk_adc_ext_status)
|
|
|
+{
|
|
|
+ return mavlink_msg_vk_adc_ext_status_pack_status(system_id, component_id, _status, msg, vk_adc_ext_status->time_boot_ms, vk_adc_ext_status->type, vk_adc_ext_status->valid, vk_adc_ext_status->raw_voltage, vk_adc_ext_status->voltage_ratio, vk_adc_ext_status->voltage, vk_adc_ext_status->current, vk_adc_ext_status->fuel_percent, vk_adc_ext_status->fuel_low1, vk_adc_ext_status->fuel_low2);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Send a vk_adc_ext_status message
|
|
|
+ * @param chan MAVLink channel to send the message
|
|
|
+ *
|
|
|
+ * @param time_boot_ms [ms] Timestamp in ms from system boot.
|
|
|
+ * @param type 0:disable, 1:voltage, 2:current, 3:fuel
|
|
|
+ * @param valid 0:invalid, 1:valid
|
|
|
+ * @param raw_voltage [V] Calibrated ADC_EX voltage.
|
|
|
+ * @param voltage_ratio ADC_EXT_V_DIV ratio applied to raw_voltage.
|
|
|
+ * @param voltage [V] Voltage mode value.
|
|
|
+ * @param current [A] Current mode value.
|
|
|
+ * @param fuel_percent [%] Fuel mode value.
|
|
|
+ * @param fuel_low1 0:normal, 1:below ADC_EXT_FUEL_LOW1
|
|
|
+ * @param fuel_low2 0:normal, 1:below ADC_EXT_FUEL_LOW2
|
|
|
+ */
|
|
|
+#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
|
|
+
|
|
|
+static inline void mavlink_msg_vk_adc_ext_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t type, uint8_t valid, float raw_voltage, float voltage_ratio, float voltage, float current, float fuel_percent, uint8_t fuel_low1, uint8_t fuel_low2)
|
|
|
+{
|
|
|
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
+ char buf[MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN];
|
|
|
+ _mav_put_uint32_t(buf, 0, time_boot_ms);
|
|
|
+ _mav_put_float(buf, 4, raw_voltage);
|
|
|
+ _mav_put_float(buf, 8, voltage_ratio);
|
|
|
+ _mav_put_float(buf, 12, voltage);
|
|
|
+ _mav_put_float(buf, 16, current);
|
|
|
+ _mav_put_float(buf, 20, fuel_percent);
|
|
|
+ _mav_put_uint8_t(buf, 24, type);
|
|
|
+ _mav_put_uint8_t(buf, 25, valid);
|
|
|
+ _mav_put_uint8_t(buf, 26, fuel_low1);
|
|
|
+ _mav_put_uint8_t(buf, 27, fuel_low2);
|
|
|
+
|
|
|
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS, buf, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC);
|
|
|
+#else
|
|
|
+ mavlink_vk_adc_ext_status_t packet;
|
|
|
+ packet.time_boot_ms = time_boot_ms;
|
|
|
+ packet.raw_voltage = raw_voltage;
|
|
|
+ packet.voltage_ratio = voltage_ratio;
|
|
|
+ packet.voltage = voltage;
|
|
|
+ packet.current = current;
|
|
|
+ packet.fuel_percent = fuel_percent;
|
|
|
+ packet.type = type;
|
|
|
+ packet.valid = valid;
|
|
|
+ packet.fuel_low1 = fuel_low1;
|
|
|
+ packet.fuel_low2 = fuel_low2;
|
|
|
+
|
|
|
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Send a vk_adc_ext_status message
|
|
|
+ * @param chan MAVLink channel to send the message
|
|
|
+ * @param struct The MAVLink struct to serialize
|
|
|
+ */
|
|
|
+static inline void mavlink_msg_vk_adc_ext_status_send_struct(mavlink_channel_t chan, const mavlink_vk_adc_ext_status_t* vk_adc_ext_status)
|
|
|
+{
|
|
|
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
+ mavlink_msg_vk_adc_ext_status_send(chan, vk_adc_ext_status->time_boot_ms, vk_adc_ext_status->type, vk_adc_ext_status->valid, vk_adc_ext_status->raw_voltage, vk_adc_ext_status->voltage_ratio, vk_adc_ext_status->voltage, vk_adc_ext_status->current, vk_adc_ext_status->fuel_percent, vk_adc_ext_status->fuel_low1, vk_adc_ext_status->fuel_low2);
|
|
|
+#else
|
|
|
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS, (const char *)vk_adc_ext_status, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+#if MAVLINK_MSG_ID_VK_ADC_EXT_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_adc_ext_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t type, uint8_t valid, float raw_voltage, float voltage_ratio, float voltage, float current, float fuel_percent, uint8_t fuel_low1, uint8_t fuel_low2)
|
|
|
+{
|
|
|
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
+ char *buf = (char *)msgbuf;
|
|
|
+ _mav_put_uint32_t(buf, 0, time_boot_ms);
|
|
|
+ _mav_put_float(buf, 4, raw_voltage);
|
|
|
+ _mav_put_float(buf, 8, voltage_ratio);
|
|
|
+ _mav_put_float(buf, 12, voltage);
|
|
|
+ _mav_put_float(buf, 16, current);
|
|
|
+ _mav_put_float(buf, 20, fuel_percent);
|
|
|
+ _mav_put_uint8_t(buf, 24, type);
|
|
|
+ _mav_put_uint8_t(buf, 25, valid);
|
|
|
+ _mav_put_uint8_t(buf, 26, fuel_low1);
|
|
|
+ _mav_put_uint8_t(buf, 27, fuel_low2);
|
|
|
+
|
|
|
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS, buf, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC);
|
|
|
+#else
|
|
|
+ mavlink_vk_adc_ext_status_t *packet = (mavlink_vk_adc_ext_status_t *)msgbuf;
|
|
|
+ packet->time_boot_ms = time_boot_ms;
|
|
|
+ packet->raw_voltage = raw_voltage;
|
|
|
+ packet->voltage_ratio = voltage_ratio;
|
|
|
+ packet->voltage = voltage;
|
|
|
+ packet->current = current;
|
|
|
+ packet->fuel_percent = fuel_percent;
|
|
|
+ packet->type = type;
|
|
|
+ packet->valid = valid;
|
|
|
+ packet->fuel_low1 = fuel_low1;
|
|
|
+ packet->fuel_low2 = fuel_low2;
|
|
|
+
|
|
|
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS, (const char *)packet, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_CRC);
|
|
|
+#endif
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+// MESSAGE VK_ADC_EXT_STATUS UNPACKING
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field time_boot_ms from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return [ms] Timestamp in ms from system boot.
|
|
|
+ */
|
|
|
+static inline uint32_t mavlink_msg_vk_adc_ext_status_get_time_boot_ms(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_uint32_t(msg, 0);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field type from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return 0:disable, 1:voltage, 2:current, 3:fuel
|
|
|
+ */
|
|
|
+static inline uint8_t mavlink_msg_vk_adc_ext_status_get_type(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_uint8_t(msg, 24);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field valid from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return 0:invalid, 1:valid
|
|
|
+ */
|
|
|
+static inline uint8_t mavlink_msg_vk_adc_ext_status_get_valid(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_uint8_t(msg, 25);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field raw_voltage from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return [V] Calibrated ADC_EX voltage.
|
|
|
+ */
|
|
|
+static inline float mavlink_msg_vk_adc_ext_status_get_raw_voltage(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_float(msg, 4);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field voltage_ratio from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return ADC_EXT_V_DIV ratio applied to raw_voltage.
|
|
|
+ */
|
|
|
+static inline float mavlink_msg_vk_adc_ext_status_get_voltage_ratio(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_float(msg, 8);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field voltage from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return [V] Voltage mode value.
|
|
|
+ */
|
|
|
+static inline float mavlink_msg_vk_adc_ext_status_get_voltage(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_float(msg, 12);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field current from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return [A] Current mode value.
|
|
|
+ */
|
|
|
+static inline float mavlink_msg_vk_adc_ext_status_get_current(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_float(msg, 16);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field fuel_percent from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return [%] Fuel mode value.
|
|
|
+ */
|
|
|
+static inline float mavlink_msg_vk_adc_ext_status_get_fuel_percent(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_float(msg, 20);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field fuel_low1 from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return 0:normal, 1:below ADC_EXT_FUEL_LOW1
|
|
|
+ */
|
|
|
+static inline uint8_t mavlink_msg_vk_adc_ext_status_get_fuel_low1(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_uint8_t(msg, 26);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Get field fuel_low2 from vk_adc_ext_status message
|
|
|
+ *
|
|
|
+ * @return 0:normal, 1:below ADC_EXT_FUEL_LOW2
|
|
|
+ */
|
|
|
+static inline uint8_t mavlink_msg_vk_adc_ext_status_get_fuel_low2(const mavlink_message_t* msg)
|
|
|
+{
|
|
|
+ return _MAV_RETURN_uint8_t(msg, 27);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief Decode a vk_adc_ext_status message into a struct
|
|
|
+ *
|
|
|
+ * @param msg The message to decode
|
|
|
+ * @param vk_adc_ext_status C-struct to decode the message contents into
|
|
|
+ */
|
|
|
+static inline void mavlink_msg_vk_adc_ext_status_decode(const mavlink_message_t* msg, mavlink_vk_adc_ext_status_t* vk_adc_ext_status)
|
|
|
+{
|
|
|
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
+ vk_adc_ext_status->time_boot_ms = mavlink_msg_vk_adc_ext_status_get_time_boot_ms(msg);
|
|
|
+ vk_adc_ext_status->raw_voltage = mavlink_msg_vk_adc_ext_status_get_raw_voltage(msg);
|
|
|
+ vk_adc_ext_status->voltage_ratio = mavlink_msg_vk_adc_ext_status_get_voltage_ratio(msg);
|
|
|
+ vk_adc_ext_status->voltage = mavlink_msg_vk_adc_ext_status_get_voltage(msg);
|
|
|
+ vk_adc_ext_status->current = mavlink_msg_vk_adc_ext_status_get_current(msg);
|
|
|
+ vk_adc_ext_status->fuel_percent = mavlink_msg_vk_adc_ext_status_get_fuel_percent(msg);
|
|
|
+ vk_adc_ext_status->type = mavlink_msg_vk_adc_ext_status_get_type(msg);
|
|
|
+ vk_adc_ext_status->valid = mavlink_msg_vk_adc_ext_status_get_valid(msg);
|
|
|
+ vk_adc_ext_status->fuel_low1 = mavlink_msg_vk_adc_ext_status_get_fuel_low1(msg);
|
|
|
+ vk_adc_ext_status->fuel_low2 = mavlink_msg_vk_adc_ext_status_get_fuel_low2(msg);
|
|
|
+#else
|
|
|
+ uint8_t len = msg->len < MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN? msg->len : MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN;
|
|
|
+ memset(vk_adc_ext_status, 0, MAVLINK_MSG_ID_VK_ADC_EXT_STATUS_LEN);
|
|
|
+ memcpy(vk_adc_ext_status, _MAV_PAYLOAD(msg), len);
|
|
|
+#endif
|
|
|
+}
|