1
0

mavlink_msg_vk_digi_esc_status.h 26 KB

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