You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

338 lines
14 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE COMPASSMOT_STATUS PACKING
  3. #define MAVLINK_MSG_ID_COMPASSMOT_STATUS 177
  4. MAVPACKED(
  5. typedef struct __mavlink_compassmot_status_t {
  6. float current; /*< [A] Current.*/
  7. float CompensationX; /*< Motor Compensation X.*/
  8. float CompensationY; /*< Motor Compensation Y.*/
  9. float CompensationZ; /*< Motor Compensation Z.*/
  10. uint16_t throttle; /*< [d%] Throttle.*/
  11. uint16_t interference; /*< [%] Interference.*/
  12. }) mavlink_compassmot_status_t;
  13. #define MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN 20
  14. #define MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN 20
  15. #define MAVLINK_MSG_ID_177_LEN 20
  16. #define MAVLINK_MSG_ID_177_MIN_LEN 20
  17. #define MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC 240
  18. #define MAVLINK_MSG_ID_177_CRC 240
  19. #if MAVLINK_COMMAND_24BIT
  20. #define MAVLINK_MESSAGE_INFO_COMPASSMOT_STATUS { \
  21. 177, \
  22. "COMPASSMOT_STATUS", \
  23. 6, \
  24. { { "throttle", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_compassmot_status_t, throttle) }, \
  25. { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_compassmot_status_t, current) }, \
  26. { "interference", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_compassmot_status_t, interference) }, \
  27. { "CompensationX", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_compassmot_status_t, CompensationX) }, \
  28. { "CompensationY", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_compassmot_status_t, CompensationY) }, \
  29. { "CompensationZ", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_compassmot_status_t, CompensationZ) }, \
  30. } \
  31. }
  32. #else
  33. #define MAVLINK_MESSAGE_INFO_COMPASSMOT_STATUS { \
  34. "COMPASSMOT_STATUS", \
  35. 6, \
  36. { { "throttle", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_compassmot_status_t, throttle) }, \
  37. { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_compassmot_status_t, current) }, \
  38. { "interference", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_compassmot_status_t, interference) }, \
  39. { "CompensationX", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_compassmot_status_t, CompensationX) }, \
  40. { "CompensationY", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_compassmot_status_t, CompensationY) }, \
  41. { "CompensationZ", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_compassmot_status_t, CompensationZ) }, \
  42. } \
  43. }
  44. #endif
  45. /**
  46. * @brief Pack a compassmot_status message
  47. * @param system_id ID of this system
  48. * @param component_id ID of this component (e.g. 200 for IMU)
  49. * @param msg The MAVLink message to compress the data into
  50. *
  51. * @param throttle [d%] Throttle.
  52. * @param current [A] Current.
  53. * @param interference [%] Interference.
  54. * @param CompensationX Motor Compensation X.
  55. * @param CompensationY Motor Compensation Y.
  56. * @param CompensationZ Motor Compensation Z.
  57. * @return length of the message in bytes (excluding serial stream start sign)
  58. */
  59. static inline uint16_t mavlink_msg_compassmot_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  60. uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ)
  61. {
  62. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  63. char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN];
  64. _mav_put_float(buf, 0, current);
  65. _mav_put_float(buf, 4, CompensationX);
  66. _mav_put_float(buf, 8, CompensationY);
  67. _mav_put_float(buf, 12, CompensationZ);
  68. _mav_put_uint16_t(buf, 16, throttle);
  69. _mav_put_uint16_t(buf, 18, interference);
  70. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
  71. #else
  72. mavlink_compassmot_status_t packet;
  73. packet.current = current;
  74. packet.CompensationX = CompensationX;
  75. packet.CompensationY = CompensationY;
  76. packet.CompensationZ = CompensationZ;
  77. packet.throttle = throttle;
  78. packet.interference = interference;
  79. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
  80. #endif
  81. msg->msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS;
  82. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
  83. }
  84. /**
  85. * @brief Pack a compassmot_status message on a channel
  86. * @param system_id ID of this system
  87. * @param component_id ID of this component (e.g. 200 for IMU)
  88. * @param chan The MAVLink channel this message will be sent over
  89. * @param msg The MAVLink message to compress the data into
  90. * @param throttle [d%] Throttle.
  91. * @param current [A] Current.
  92. * @param interference [%] Interference.
  93. * @param CompensationX Motor Compensation X.
  94. * @param CompensationY Motor Compensation Y.
  95. * @param CompensationZ Motor Compensation Z.
  96. * @return length of the message in bytes (excluding serial stream start sign)
  97. */
  98. static inline uint16_t mavlink_msg_compassmot_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  99. mavlink_message_t* msg,
  100. uint16_t throttle,float current,uint16_t interference,float CompensationX,float CompensationY,float CompensationZ)
  101. {
  102. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  103. char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN];
  104. _mav_put_float(buf, 0, current);
  105. _mav_put_float(buf, 4, CompensationX);
  106. _mav_put_float(buf, 8, CompensationY);
  107. _mav_put_float(buf, 12, CompensationZ);
  108. _mav_put_uint16_t(buf, 16, throttle);
  109. _mav_put_uint16_t(buf, 18, interference);
  110. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
  111. #else
  112. mavlink_compassmot_status_t packet;
  113. packet.current = current;
  114. packet.CompensationX = CompensationX;
  115. packet.CompensationY = CompensationY;
  116. packet.CompensationZ = CompensationZ;
  117. packet.throttle = throttle;
  118. packet.interference = interference;
  119. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
  120. #endif
  121. msg->msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS;
  122. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
  123. }
  124. /**
  125. * @brief Encode a compassmot_status struct
  126. *
  127. * @param system_id ID of this system
  128. * @param component_id ID of this component (e.g. 200 for IMU)
  129. * @param msg The MAVLink message to compress the data into
  130. * @param compassmot_status C-struct to read the message contents from
  131. */
  132. static inline uint16_t mavlink_msg_compassmot_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_compassmot_status_t* compassmot_status)
  133. {
  134. return mavlink_msg_compassmot_status_pack(system_id, component_id, msg, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ);
  135. }
  136. /**
  137. * @brief Encode a compassmot_status struct on a channel
  138. *
  139. * @param system_id ID of this system
  140. * @param component_id ID of this component (e.g. 200 for IMU)
  141. * @param chan The MAVLink channel this message will be sent over
  142. * @param msg The MAVLink message to compress the data into
  143. * @param compassmot_status C-struct to read the message contents from
  144. */
  145. static inline uint16_t mavlink_msg_compassmot_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_compassmot_status_t* compassmot_status)
  146. {
  147. return mavlink_msg_compassmot_status_pack_chan(system_id, component_id, chan, msg, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ);
  148. }
  149. /**
  150. * @brief Send a compassmot_status message
  151. * @param chan MAVLink channel to send the message
  152. *
  153. * @param throttle [d%] Throttle.
  154. * @param current [A] Current.
  155. * @param interference [%] Interference.
  156. * @param CompensationX Motor Compensation X.
  157. * @param CompensationY Motor Compensation Y.
  158. * @param CompensationZ Motor Compensation Z.
  159. */
  160. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  161. static inline void mavlink_msg_compassmot_status_send(mavlink_channel_t chan, uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ)
  162. {
  163. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  164. char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN];
  165. _mav_put_float(buf, 0, current);
  166. _mav_put_float(buf, 4, CompensationX);
  167. _mav_put_float(buf, 8, CompensationY);
  168. _mav_put_float(buf, 12, CompensationZ);
  169. _mav_put_uint16_t(buf, 16, throttle);
  170. _mav_put_uint16_t(buf, 18, interference);
  171. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
  172. #else
  173. mavlink_compassmot_status_t packet;
  174. packet.current = current;
  175. packet.CompensationX = CompensationX;
  176. packet.CompensationY = CompensationY;
  177. packet.CompensationZ = CompensationZ;
  178. packet.throttle = throttle;
  179. packet.interference = interference;
  180. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
  181. #endif
  182. }
  183. /**
  184. * @brief Send a compassmot_status message
  185. * @param chan MAVLink channel to send the message
  186. * @param struct The MAVLink struct to serialize
  187. */
  188. static inline void mavlink_msg_compassmot_status_send_struct(mavlink_channel_t chan, const mavlink_compassmot_status_t* compassmot_status)
  189. {
  190. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  191. mavlink_msg_compassmot_status_send(chan, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ);
  192. #else
  193. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)compassmot_status, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
  194. #endif
  195. }
  196. #if MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  197. /*
  198. This varient of _send() can be used to save stack space by re-using
  199. memory from the receive buffer. The caller provides a
  200. mavlink_message_t which is the size of a full mavlink message. This
  201. is usually the receive buffer for the channel, and allows a reply to an
  202. incoming message with minimum stack space usage.
  203. */
  204. static inline void mavlink_msg_compassmot_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ)
  205. {
  206. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  207. char *buf = (char *)msgbuf;
  208. _mav_put_float(buf, 0, current);
  209. _mav_put_float(buf, 4, CompensationX);
  210. _mav_put_float(buf, 8, CompensationY);
  211. _mav_put_float(buf, 12, CompensationZ);
  212. _mav_put_uint16_t(buf, 16, throttle);
  213. _mav_put_uint16_t(buf, 18, interference);
  214. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
  215. #else
  216. mavlink_compassmot_status_t *packet = (mavlink_compassmot_status_t *)msgbuf;
  217. packet->current = current;
  218. packet->CompensationX = CompensationX;
  219. packet->CompensationY = CompensationY;
  220. packet->CompensationZ = CompensationZ;
  221. packet->throttle = throttle;
  222. packet->interference = interference;
  223. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
  224. #endif
  225. }
  226. #endif
  227. #endif
  228. // MESSAGE COMPASSMOT_STATUS UNPACKING
  229. /**
  230. * @brief Get field throttle from compassmot_status message
  231. *
  232. * @return [d%] Throttle.
  233. */
  234. static inline uint16_t mavlink_msg_compassmot_status_get_throttle(const mavlink_message_t* msg)
  235. {
  236. return _MAV_RETURN_uint16_t(msg, 16);
  237. }
  238. /**
  239. * @brief Get field current from compassmot_status message
  240. *
  241. * @return [A] Current.
  242. */
  243. static inline float mavlink_msg_compassmot_status_get_current(const mavlink_message_t* msg)
  244. {
  245. return _MAV_RETURN_float(msg, 0);
  246. }
  247. /**
  248. * @brief Get field interference from compassmot_status message
  249. *
  250. * @return [%] Interference.
  251. */
  252. static inline uint16_t mavlink_msg_compassmot_status_get_interference(const mavlink_message_t* msg)
  253. {
  254. return _MAV_RETURN_uint16_t(msg, 18);
  255. }
  256. /**
  257. * @brief Get field CompensationX from compassmot_status message
  258. *
  259. * @return Motor Compensation X.
  260. */
  261. static inline float mavlink_msg_compassmot_status_get_CompensationX(const mavlink_message_t* msg)
  262. {
  263. return _MAV_RETURN_float(msg, 4);
  264. }
  265. /**
  266. * @brief Get field CompensationY from compassmot_status message
  267. *
  268. * @return Motor Compensation Y.
  269. */
  270. static inline float mavlink_msg_compassmot_status_get_CompensationY(const mavlink_message_t* msg)
  271. {
  272. return _MAV_RETURN_float(msg, 8);
  273. }
  274. /**
  275. * @brief Get field CompensationZ from compassmot_status message
  276. *
  277. * @return Motor Compensation Z.
  278. */
  279. static inline float mavlink_msg_compassmot_status_get_CompensationZ(const mavlink_message_t* msg)
  280. {
  281. return _MAV_RETURN_float(msg, 12);
  282. }
  283. /**
  284. * @brief Decode a compassmot_status message into a struct
  285. *
  286. * @param msg The message to decode
  287. * @param compassmot_status C-struct to decode the message contents into
  288. */
  289. static inline void mavlink_msg_compassmot_status_decode(const mavlink_message_t* msg, mavlink_compassmot_status_t* compassmot_status)
  290. {
  291. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  292. compassmot_status->current = mavlink_msg_compassmot_status_get_current(msg);
  293. compassmot_status->CompensationX = mavlink_msg_compassmot_status_get_CompensationX(msg);
  294. compassmot_status->CompensationY = mavlink_msg_compassmot_status_get_CompensationY(msg);
  295. compassmot_status->CompensationZ = mavlink_msg_compassmot_status_get_CompensationZ(msg);
  296. compassmot_status->throttle = mavlink_msg_compassmot_status_get_throttle(msg);
  297. compassmot_status->interference = mavlink_msg_compassmot_status_get_interference(msg);
  298. #else
  299. uint8_t len = msg->len < MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN? msg->len : MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN;
  300. memset(compassmot_status, 0, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
  301. memcpy(compassmot_status, _MAV_PAYLOAD(msg), len);
  302. #endif
  303. }