mavlink_msg_vk_digi_esc_status.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. #pragma once
  2. // MESSAGE VK_DIGI_ESC_STATUS PACKING
  3. #define MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS 53008
  4. typedef struct __mavlink_vk_digi_esc_status_t {
  5. uint32_t timestamp; /*< [ms] Timestamp from system boot.*/
  6. int32_t rpm[4]; /*< [rpm] Reported motor RPM from each ESC (negative for
  7. reverse rotation).*/
  8. float voltage[4]; /*< [V] Voltage measured from each ESC.*/
  9. float current[4]; /*< [A] Current measured from each ESC.*/
  10. uint32_t status[4]; /*< Status data from each ESC.*/
  11. int16_t temperature[4]; /*< [degC] Temperature measured from each ESC.*/
  12. uint8_t index; /*< Index of the first ESC in this message.
  13. minValue = 0, maxValue = 60, increment = 4.*/
  14. } mavlink_vk_digi_esc_status_t;
  15. #define MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN 77
  16. #define MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN 77
  17. #define MAVLINK_MSG_ID_53008_LEN 77
  18. #define MAVLINK_MSG_ID_53008_MIN_LEN 77
  19. #define MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC 110
  20. #define MAVLINK_MSG_ID_53008_CRC 110
  21. #define MAVLINK_MSG_VK_DIGI_ESC_STATUS_FIELD_RPM_LEN 4
  22. #define MAVLINK_MSG_VK_DIGI_ESC_STATUS_FIELD_VOLTAGE_LEN 4
  23. #define MAVLINK_MSG_VK_DIGI_ESC_STATUS_FIELD_CURRENT_LEN 4
  24. #define MAVLINK_MSG_VK_DIGI_ESC_STATUS_FIELD_STATUS_LEN 4
  25. #define MAVLINK_MSG_VK_DIGI_ESC_STATUS_FIELD_TEMPERATURE_LEN 4
  26. #if MAVLINK_COMMAND_24BIT
  27. #define MAVLINK_MESSAGE_INFO_VK_DIGI_ESC_STATUS { \
  28. 53008, \
  29. "VK_DIGI_ESC_STATUS", \
  30. 7, \
  31. { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 76, offsetof(mavlink_vk_digi_esc_status_t, index) }, \
  32. { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_digi_esc_status_t, timestamp) }, \
  33. { "rpm", NULL, MAVLINK_TYPE_INT32_T, 4, 4, offsetof(mavlink_vk_digi_esc_status_t, rpm) }, \
  34. { "voltage", NULL, MAVLINK_TYPE_FLOAT, 4, 20, offsetof(mavlink_vk_digi_esc_status_t, voltage) }, \
  35. { "current", NULL, MAVLINK_TYPE_FLOAT, 4, 36, offsetof(mavlink_vk_digi_esc_status_t, current) }, \
  36. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 4, 68, offsetof(mavlink_vk_digi_esc_status_t, temperature) }, \
  37. { "status", NULL, MAVLINK_TYPE_UINT32_T, 4, 52, offsetof(mavlink_vk_digi_esc_status_t, status) }, \
  38. } \
  39. }
  40. #else
  41. #define MAVLINK_MESSAGE_INFO_VK_DIGI_ESC_STATUS { \
  42. "VK_DIGI_ESC_STATUS", \
  43. 7, \
  44. { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 76, offsetof(mavlink_vk_digi_esc_status_t, index) }, \
  45. { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_digi_esc_status_t, timestamp) }, \
  46. { "rpm", NULL, MAVLINK_TYPE_INT32_T, 4, 4, offsetof(mavlink_vk_digi_esc_status_t, rpm) }, \
  47. { "voltage", NULL, MAVLINK_TYPE_FLOAT, 4, 20, offsetof(mavlink_vk_digi_esc_status_t, voltage) }, \
  48. { "current", NULL, MAVLINK_TYPE_FLOAT, 4, 36, offsetof(mavlink_vk_digi_esc_status_t, current) }, \
  49. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 4, 68, offsetof(mavlink_vk_digi_esc_status_t, temperature) }, \
  50. { "status", NULL, MAVLINK_TYPE_UINT32_T, 4, 52, offsetof(mavlink_vk_digi_esc_status_t, status) }, \
  51. } \
  52. }
  53. #endif
  54. /**
  55. * @brief Pack a vk_digi_esc_status message
  56. * @param system_id ID of this system
  57. * @param component_id ID of this component (e.g. 200 for IMU)
  58. * @param msg The MAVLink message to compress the data into
  59. *
  60. * @param index Index of the first ESC in this message.
  61. minValue = 0, maxValue = 60, increment = 4.
  62. * @param timestamp [ms] Timestamp from system boot.
  63. * @param rpm [rpm] Reported motor RPM from each ESC (negative for
  64. reverse rotation).
  65. * @param voltage [V] Voltage measured from each ESC.
  66. * @param current [A] Current measured from each ESC.
  67. * @param temperature [degC] Temperature measured from each ESC.
  68. * @param status Status data from each ESC.
  69. * @return length of the message in bytes (excluding serial stream start sign)
  70. */
  71. static inline uint16_t mavlink_msg_vk_digi_esc_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  72. uint8_t index, uint32_t timestamp, const int32_t *rpm, const float *voltage, const float *current, const int16_t *temperature, const uint32_t *status)
  73. {
  74. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  75. char buf[MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN];
  76. _mav_put_uint32_t(buf, 0, timestamp);
  77. _mav_put_uint8_t(buf, 76, index);
  78. _mav_put_int32_t_array(buf, 4, rpm, 4);
  79. _mav_put_float_array(buf, 20, voltage, 4);
  80. _mav_put_float_array(buf, 36, current, 4);
  81. _mav_put_uint32_t_array(buf, 52, status, 4);
  82. _mav_put_int16_t_array(buf, 68, temperature, 4);
  83. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN);
  84. #else
  85. mavlink_vk_digi_esc_status_t packet;
  86. packet.timestamp = timestamp;
  87. packet.index = index;
  88. mav_array_memcpy(packet.rpm, rpm, sizeof(int32_t)*4);
  89. mav_array_memcpy(packet.voltage, voltage, sizeof(float)*4);
  90. mav_array_memcpy(packet.current, current, sizeof(float)*4);
  91. mav_array_memcpy(packet.status, status, sizeof(uint32_t)*4);
  92. mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
  93. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN);
  94. #endif
  95. msg->msgid = MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS;
  96. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC);
  97. }
  98. /**
  99. * @brief Pack a vk_digi_esc_status message
  100. * @param system_id ID of this system
  101. * @param component_id ID of this component (e.g. 200 for IMU)
  102. * @param status MAVLink status structure
  103. * @param msg The MAVLink message to compress the data into
  104. *
  105. * @param index Index of the first ESC in this message.
  106. minValue = 0, maxValue = 60, increment = 4.
  107. * @param timestamp [ms] Timestamp from system boot.
  108. * @param rpm [rpm] Reported motor RPM from each ESC (negative for
  109. reverse rotation).
  110. * @param voltage [V] Voltage measured from each ESC.
  111. * @param current [A] Current measured from each ESC.
  112. * @param temperature [degC] Temperature measured from each ESC.
  113. * @param status Status data from each ESC.
  114. * @return length of the message in bytes (excluding serial stream start sign)
  115. */
  116. static inline uint16_t mavlink_msg_vk_digi_esc_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  117. uint8_t index, uint32_t timestamp, const int32_t *rpm, const float *voltage, const float *current, const int16_t *temperature, const uint32_t *status)
  118. {
  119. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  120. char buf[MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN];
  121. _mav_put_uint32_t(buf, 0, timestamp);
  122. _mav_put_uint8_t(buf, 76, index);
  123. _mav_put_int32_t_array(buf, 4, rpm, 4);
  124. _mav_put_float_array(buf, 20, voltage, 4);
  125. _mav_put_float_array(buf, 36, current, 4);
  126. _mav_put_uint32_t_array(buf, 52, status, 4);
  127. _mav_put_int16_t_array(buf, 68, temperature, 4);
  128. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN);
  129. #else
  130. mavlink_vk_digi_esc_status_t packet;
  131. packet.timestamp = timestamp;
  132. packet.index = index;
  133. mav_array_memcpy(packet.rpm, rpm, sizeof(int32_t)*4);
  134. mav_array_memcpy(packet.voltage, voltage, sizeof(float)*4);
  135. mav_array_memcpy(packet.current, current, sizeof(float)*4);
  136. mav_array_memcpy(packet.status, status, sizeof(uint32_t)*4);
  137. mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
  138. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN);
  139. #endif
  140. msg->msgid = MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS;
  141. #if MAVLINK_CRC_EXTRA
  142. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC);
  143. #else
  144. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN);
  145. #endif
  146. }
  147. /**
  148. * @brief Pack a vk_digi_esc_status message on a channel
  149. * @param system_id ID of this system
  150. * @param component_id ID of this component (e.g. 200 for IMU)
  151. * @param chan The MAVLink channel this message will be sent over
  152. * @param msg The MAVLink message to compress the data into
  153. * @param index Index of the first ESC in this message.
  154. minValue = 0, maxValue = 60, increment = 4.
  155. * @param timestamp [ms] Timestamp from system boot.
  156. * @param rpm [rpm] Reported motor RPM from each ESC (negative for
  157. reverse rotation).
  158. * @param voltage [V] Voltage measured from each ESC.
  159. * @param current [A] Current measured from each ESC.
  160. * @param temperature [degC] Temperature measured from each ESC.
  161. * @param status Status data from each ESC.
  162. * @return length of the message in bytes (excluding serial stream start sign)
  163. */
  164. static inline uint16_t mavlink_msg_vk_digi_esc_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  165. mavlink_message_t* msg,
  166. uint8_t index,uint32_t timestamp,const int32_t *rpm,const float *voltage,const float *current,const int16_t *temperature,const uint32_t *status)
  167. {
  168. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  169. char buf[MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN];
  170. _mav_put_uint32_t(buf, 0, timestamp);
  171. _mav_put_uint8_t(buf, 76, index);
  172. _mav_put_int32_t_array(buf, 4, rpm, 4);
  173. _mav_put_float_array(buf, 20, voltage, 4);
  174. _mav_put_float_array(buf, 36, current, 4);
  175. _mav_put_uint32_t_array(buf, 52, status, 4);
  176. _mav_put_int16_t_array(buf, 68, temperature, 4);
  177. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN);
  178. #else
  179. mavlink_vk_digi_esc_status_t packet;
  180. packet.timestamp = timestamp;
  181. packet.index = index;
  182. mav_array_memcpy(packet.rpm, rpm, sizeof(int32_t)*4);
  183. mav_array_memcpy(packet.voltage, voltage, sizeof(float)*4);
  184. mav_array_memcpy(packet.current, current, sizeof(float)*4);
  185. mav_array_memcpy(packet.status, status, sizeof(uint32_t)*4);
  186. mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
  187. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN);
  188. #endif
  189. msg->msgid = MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS;
  190. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC);
  191. }
  192. /**
  193. * @brief Encode a vk_digi_esc_status struct
  194. *
  195. * @param system_id ID of this system
  196. * @param component_id ID of this component (e.g. 200 for IMU)
  197. * @param msg The MAVLink message to compress the data into
  198. * @param vk_digi_esc_status C-struct to read the message contents from
  199. */
  200. static inline uint16_t mavlink_msg_vk_digi_esc_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vk_digi_esc_status_t* vk_digi_esc_status)
  201. {
  202. return mavlink_msg_vk_digi_esc_status_pack(system_id, component_id, msg, vk_digi_esc_status->index, vk_digi_esc_status->timestamp, vk_digi_esc_status->rpm, vk_digi_esc_status->voltage, vk_digi_esc_status->current, vk_digi_esc_status->temperature, vk_digi_esc_status->status);
  203. }
  204. /**
  205. * @brief Encode a vk_digi_esc_status struct on a channel
  206. *
  207. * @param system_id ID of this system
  208. * @param component_id ID of this component (e.g. 200 for IMU)
  209. * @param chan The MAVLink channel this message will be sent over
  210. * @param msg The MAVLink message to compress the data into
  211. * @param vk_digi_esc_status C-struct to read the message contents from
  212. */
  213. static inline uint16_t mavlink_msg_vk_digi_esc_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vk_digi_esc_status_t* vk_digi_esc_status)
  214. {
  215. return mavlink_msg_vk_digi_esc_status_pack_chan(system_id, component_id, chan, msg, vk_digi_esc_status->index, vk_digi_esc_status->timestamp, vk_digi_esc_status->rpm, vk_digi_esc_status->voltage, vk_digi_esc_status->current, vk_digi_esc_status->temperature, vk_digi_esc_status->status);
  216. }
  217. /**
  218. * @brief Encode a vk_digi_esc_status struct with provided status structure
  219. *
  220. * @param system_id ID of this system
  221. * @param component_id ID of this component (e.g. 200 for IMU)
  222. * @param status MAVLink status structure
  223. * @param msg The MAVLink message to compress the data into
  224. * @param vk_digi_esc_status C-struct to read the message contents from
  225. */
  226. static inline uint16_t mavlink_msg_vk_digi_esc_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vk_digi_esc_status_t* vk_digi_esc_status)
  227. {
  228. return mavlink_msg_vk_digi_esc_status_pack_status(system_id, component_id, _status, msg, vk_digi_esc_status->index, vk_digi_esc_status->timestamp, vk_digi_esc_status->rpm, vk_digi_esc_status->voltage, vk_digi_esc_status->current, vk_digi_esc_status->temperature, vk_digi_esc_status->status);
  229. }
  230. /**
  231. * @brief Send a vk_digi_esc_status message
  232. * @param chan MAVLink channel to send the message
  233. *
  234. * @param index Index of the first ESC in this message.
  235. minValue = 0, maxValue = 60, increment = 4.
  236. * @param timestamp [ms] Timestamp from system boot.
  237. * @param rpm [rpm] Reported motor RPM from each ESC (negative for
  238. reverse rotation).
  239. * @param voltage [V] Voltage measured from each ESC.
  240. * @param current [A] Current measured from each ESC.
  241. * @param temperature [degC] Temperature measured from each ESC.
  242. * @param status Status data from each ESC.
  243. */
  244. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  245. static inline void mavlink_msg_vk_digi_esc_status_send(mavlink_channel_t chan, uint8_t index, uint32_t timestamp, const int32_t *rpm, const float *voltage, const float *current, const int16_t *temperature, const uint32_t *status)
  246. {
  247. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  248. char buf[MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN];
  249. _mav_put_uint32_t(buf, 0, timestamp);
  250. _mav_put_uint8_t(buf, 76, index);
  251. _mav_put_int32_t_array(buf, 4, rpm, 4);
  252. _mav_put_float_array(buf, 20, voltage, 4);
  253. _mav_put_float_array(buf, 36, current, 4);
  254. _mav_put_uint32_t_array(buf, 52, status, 4);
  255. _mav_put_int16_t_array(buf, 68, temperature, 4);
  256. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS, buf, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC);
  257. #else
  258. mavlink_vk_digi_esc_status_t packet;
  259. packet.timestamp = timestamp;
  260. packet.index = index;
  261. mav_array_memcpy(packet.rpm, rpm, sizeof(int32_t)*4);
  262. mav_array_memcpy(packet.voltage, voltage, sizeof(float)*4);
  263. mav_array_memcpy(packet.current, current, sizeof(float)*4);
  264. mav_array_memcpy(packet.status, status, sizeof(uint32_t)*4);
  265. mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
  266. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS, (const char *)&packet, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC);
  267. #endif
  268. }
  269. /**
  270. * @brief Send a vk_digi_esc_status message
  271. * @param chan MAVLink channel to send the message
  272. * @param struct The MAVLink struct to serialize
  273. */
  274. static inline void mavlink_msg_vk_digi_esc_status_send_struct(mavlink_channel_t chan, const mavlink_vk_digi_esc_status_t* vk_digi_esc_status)
  275. {
  276. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  277. mavlink_msg_vk_digi_esc_status_send(chan, vk_digi_esc_status->index, vk_digi_esc_status->timestamp, vk_digi_esc_status->rpm, vk_digi_esc_status->voltage, vk_digi_esc_status->current, vk_digi_esc_status->temperature, vk_digi_esc_status->status);
  278. #else
  279. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS, (const char *)vk_digi_esc_status, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC);
  280. #endif
  281. }
  282. #if MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  283. /*
  284. This variant of _send() can be used to save stack space by re-using
  285. memory from the receive buffer. The caller provides a
  286. mavlink_message_t which is the size of a full mavlink message. This
  287. is usually the receive buffer for the channel, and allows a reply to an
  288. incoming message with minimum stack space usage.
  289. */
  290. static inline void mavlink_msg_vk_digi_esc_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t index, uint32_t timestamp, const int32_t *rpm, const float *voltage, const float *current, const int16_t *temperature, const uint32_t *status)
  291. {
  292. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  293. char *buf = (char *)msgbuf;
  294. _mav_put_uint32_t(buf, 0, timestamp);
  295. _mav_put_uint8_t(buf, 76, index);
  296. _mav_put_int32_t_array(buf, 4, rpm, 4);
  297. _mav_put_float_array(buf, 20, voltage, 4);
  298. _mav_put_float_array(buf, 36, current, 4);
  299. _mav_put_uint32_t_array(buf, 52, status, 4);
  300. _mav_put_int16_t_array(buf, 68, temperature, 4);
  301. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS, buf, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC);
  302. #else
  303. mavlink_vk_digi_esc_status_t *packet = (mavlink_vk_digi_esc_status_t *)msgbuf;
  304. packet->timestamp = timestamp;
  305. packet->index = index;
  306. mav_array_memcpy(packet->rpm, rpm, sizeof(int32_t)*4);
  307. mav_array_memcpy(packet->voltage, voltage, sizeof(float)*4);
  308. mav_array_memcpy(packet->current, current, sizeof(float)*4);
  309. mav_array_memcpy(packet->status, status, sizeof(uint32_t)*4);
  310. mav_array_memcpy(packet->temperature, temperature, sizeof(int16_t)*4);
  311. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS, (const char *)packet, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_CRC);
  312. #endif
  313. }
  314. #endif
  315. #endif
  316. // MESSAGE VK_DIGI_ESC_STATUS UNPACKING
  317. /**
  318. * @brief Get field index from vk_digi_esc_status message
  319. *
  320. * @return Index of the first ESC in this message.
  321. minValue = 0, maxValue = 60, increment = 4.
  322. */
  323. static inline uint8_t mavlink_msg_vk_digi_esc_status_get_index(const mavlink_message_t* msg)
  324. {
  325. return _MAV_RETURN_uint8_t(msg, 76);
  326. }
  327. /**
  328. * @brief Get field timestamp from vk_digi_esc_status message
  329. *
  330. * @return [ms] Timestamp from system boot.
  331. */
  332. static inline uint32_t mavlink_msg_vk_digi_esc_status_get_timestamp(const mavlink_message_t* msg)
  333. {
  334. return _MAV_RETURN_uint32_t(msg, 0);
  335. }
  336. /**
  337. * @brief Get field rpm from vk_digi_esc_status message
  338. *
  339. * @return [rpm] Reported motor RPM from each ESC (negative for
  340. reverse rotation).
  341. */
  342. static inline uint16_t mavlink_msg_vk_digi_esc_status_get_rpm(const mavlink_message_t* msg, int32_t *rpm)
  343. {
  344. return _MAV_RETURN_int32_t_array(msg, rpm, 4, 4);
  345. }
  346. /**
  347. * @brief Get field voltage from vk_digi_esc_status message
  348. *
  349. * @return [V] Voltage measured from each ESC.
  350. */
  351. static inline uint16_t mavlink_msg_vk_digi_esc_status_get_voltage(const mavlink_message_t* msg, float *voltage)
  352. {
  353. return _MAV_RETURN_float_array(msg, voltage, 4, 20);
  354. }
  355. /**
  356. * @brief Get field current from vk_digi_esc_status message
  357. *
  358. * @return [A] Current measured from each ESC.
  359. */
  360. static inline uint16_t mavlink_msg_vk_digi_esc_status_get_current(const mavlink_message_t* msg, float *current)
  361. {
  362. return _MAV_RETURN_float_array(msg, current, 4, 36);
  363. }
  364. /**
  365. * @brief Get field temperature from vk_digi_esc_status message
  366. *
  367. * @return [degC] Temperature measured from each ESC.
  368. */
  369. static inline uint16_t mavlink_msg_vk_digi_esc_status_get_temperature(const mavlink_message_t* msg, int16_t *temperature)
  370. {
  371. return _MAV_RETURN_int16_t_array(msg, temperature, 4, 68);
  372. }
  373. /**
  374. * @brief Get field status from vk_digi_esc_status message
  375. *
  376. * @return Status data from each ESC.
  377. */
  378. static inline uint16_t mavlink_msg_vk_digi_esc_status_get_status(const mavlink_message_t* msg, uint32_t *status)
  379. {
  380. return _MAV_RETURN_uint32_t_array(msg, status, 4, 52);
  381. }
  382. /**
  383. * @brief Decode a vk_digi_esc_status message into a struct
  384. *
  385. * @param msg The message to decode
  386. * @param vk_digi_esc_status C-struct to decode the message contents into
  387. */
  388. static inline void mavlink_msg_vk_digi_esc_status_decode(const mavlink_message_t* msg, mavlink_vk_digi_esc_status_t* vk_digi_esc_status)
  389. {
  390. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  391. vk_digi_esc_status->timestamp = mavlink_msg_vk_digi_esc_status_get_timestamp(msg);
  392. mavlink_msg_vk_digi_esc_status_get_rpm(msg, vk_digi_esc_status->rpm);
  393. mavlink_msg_vk_digi_esc_status_get_voltage(msg, vk_digi_esc_status->voltage);
  394. mavlink_msg_vk_digi_esc_status_get_current(msg, vk_digi_esc_status->current);
  395. mavlink_msg_vk_digi_esc_status_get_status(msg, vk_digi_esc_status->status);
  396. mavlink_msg_vk_digi_esc_status_get_temperature(msg, vk_digi_esc_status->temperature);
  397. vk_digi_esc_status->index = mavlink_msg_vk_digi_esc_status_get_index(msg);
  398. #else
  399. uint8_t len = msg->len < MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN? msg->len : MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN;
  400. memset(vk_digi_esc_status, 0, MAVLINK_MSG_ID_VK_DIGI_ESC_STATUS_LEN);
  401. memcpy(vk_digi_esc_status, _MAV_PAYLOAD(msg), len);
  402. #endif
  403. }