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
15 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE MOUNT_CONTROL PACKING
  3. #define MAVLINK_MSG_ID_MOUNT_CONTROL 157
  4. MAVPACKED(
  5. typedef struct __mavlink_mount_control_t {
  6. int32_t input_a; /*< Pitch (centi-degrees) or lat (degE7), depending on mount mode.*/
  7. int32_t input_b; /*< Roll (centi-degrees) or lon (degE7) depending on mount mode.*/
  8. int32_t input_c; /*< Yaw (centi-degrees) or alt (cm) depending on mount mode.*/
  9. uint8_t target_system; /*< System ID.*/
  10. uint8_t target_component; /*< Component ID.*/
  11. uint8_t save_position; /*< If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING).*/
  12. }) mavlink_mount_control_t;
  13. #define MAVLINK_MSG_ID_MOUNT_CONTROL_LEN 15
  14. #define MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN 15
  15. #define MAVLINK_MSG_ID_157_LEN 15
  16. #define MAVLINK_MSG_ID_157_MIN_LEN 15
  17. #define MAVLINK_MSG_ID_MOUNT_CONTROL_CRC 21
  18. #define MAVLINK_MSG_ID_157_CRC 21
  19. #if MAVLINK_COMMAND_24BIT
  20. #define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \
  21. 157, \
  22. "MOUNT_CONTROL", \
  23. 6, \
  24. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_control_t, target_system) }, \
  25. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_control_t, target_component) }, \
  26. { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_control_t, input_a) }, \
  27. { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_control_t, input_b) }, \
  28. { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_control_t, input_c) }, \
  29. { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \
  30. } \
  31. }
  32. #else
  33. #define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \
  34. "MOUNT_CONTROL", \
  35. 6, \
  36. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_control_t, target_system) }, \
  37. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_control_t, target_component) }, \
  38. { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_control_t, input_a) }, \
  39. { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_control_t, input_b) }, \
  40. { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_control_t, input_c) }, \
  41. { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \
  42. } \
  43. }
  44. #endif
  45. /**
  46. * @brief Pack a mount_control 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 target_system System ID.
  52. * @param target_component Component ID.
  53. * @param input_a Pitch (centi-degrees) or lat (degE7), depending on mount mode.
  54. * @param input_b Roll (centi-degrees) or lon (degE7) depending on mount mode.
  55. * @param input_c Yaw (centi-degrees) or alt (cm) depending on mount mode.
  56. * @param save_position If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING).
  57. * @return length of the message in bytes (excluding serial stream start sign)
  58. */
  59. static inline uint16_t mavlink_msg_mount_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  60. uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
  61. {
  62. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  63. char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN];
  64. _mav_put_int32_t(buf, 0, input_a);
  65. _mav_put_int32_t(buf, 4, input_b);
  66. _mav_put_int32_t(buf, 8, input_c);
  67. _mav_put_uint8_t(buf, 12, target_system);
  68. _mav_put_uint8_t(buf, 13, target_component);
  69. _mav_put_uint8_t(buf, 14, save_position);
  70. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
  71. #else
  72. mavlink_mount_control_t packet;
  73. packet.input_a = input_a;
  74. packet.input_b = input_b;
  75. packet.input_c = input_c;
  76. packet.target_system = target_system;
  77. packet.target_component = target_component;
  78. packet.save_position = save_position;
  79. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
  80. #endif
  81. msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL;
  82. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
  83. }
  84. /**
  85. * @brief Pack a mount_control 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 target_system System ID.
  91. * @param target_component Component ID.
  92. * @param input_a Pitch (centi-degrees) or lat (degE7), depending on mount mode.
  93. * @param input_b Roll (centi-degrees) or lon (degE7) depending on mount mode.
  94. * @param input_c Yaw (centi-degrees) or alt (cm) depending on mount mode.
  95. * @param save_position If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING).
  96. * @return length of the message in bytes (excluding serial stream start sign)
  97. */
  98. static inline uint16_t mavlink_msg_mount_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  99. mavlink_message_t* msg,
  100. uint8_t target_system,uint8_t target_component,int32_t input_a,int32_t input_b,int32_t input_c,uint8_t save_position)
  101. {
  102. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  103. char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN];
  104. _mav_put_int32_t(buf, 0, input_a);
  105. _mav_put_int32_t(buf, 4, input_b);
  106. _mav_put_int32_t(buf, 8, input_c);
  107. _mav_put_uint8_t(buf, 12, target_system);
  108. _mav_put_uint8_t(buf, 13, target_component);
  109. _mav_put_uint8_t(buf, 14, save_position);
  110. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
  111. #else
  112. mavlink_mount_control_t packet;
  113. packet.input_a = input_a;
  114. packet.input_b = input_b;
  115. packet.input_c = input_c;
  116. packet.target_system = target_system;
  117. packet.target_component = target_component;
  118. packet.save_position = save_position;
  119. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
  120. #endif
  121. msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL;
  122. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
  123. }
  124. /**
  125. * @brief Encode a mount_control 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 mount_control C-struct to read the message contents from
  131. */
  132. static inline uint16_t mavlink_msg_mount_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control)
  133. {
  134. return mavlink_msg_mount_control_pack(system_id, component_id, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
  135. }
  136. /**
  137. * @brief Encode a mount_control 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 mount_control C-struct to read the message contents from
  144. */
  145. static inline uint16_t mavlink_msg_mount_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control)
  146. {
  147. return mavlink_msg_mount_control_pack_chan(system_id, component_id, chan, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
  148. }
  149. /**
  150. * @brief Send a mount_control message
  151. * @param chan MAVLink channel to send the message
  152. *
  153. * @param target_system System ID.
  154. * @param target_component Component ID.
  155. * @param input_a Pitch (centi-degrees) or lat (degE7), depending on mount mode.
  156. * @param input_b Roll (centi-degrees) or lon (degE7) depending on mount mode.
  157. * @param input_c Yaw (centi-degrees) or alt (cm) depending on mount mode.
  158. * @param save_position If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING).
  159. */
  160. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  161. static inline void mavlink_msg_mount_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
  162. {
  163. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  164. char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN];
  165. _mav_put_int32_t(buf, 0, input_a);
  166. _mav_put_int32_t(buf, 4, input_b);
  167. _mav_put_int32_t(buf, 8, input_c);
  168. _mav_put_uint8_t(buf, 12, target_system);
  169. _mav_put_uint8_t(buf, 13, target_component);
  170. _mav_put_uint8_t(buf, 14, save_position);
  171. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
  172. #else
  173. mavlink_mount_control_t packet;
  174. packet.input_a = input_a;
  175. packet.input_b = input_b;
  176. packet.input_c = input_c;
  177. packet.target_system = target_system;
  178. packet.target_component = target_component;
  179. packet.save_position = save_position;
  180. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
  181. #endif
  182. }
  183. /**
  184. * @brief Send a mount_control 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_mount_control_send_struct(mavlink_channel_t chan, const mavlink_mount_control_t* mount_control)
  189. {
  190. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  191. mavlink_msg_mount_control_send(chan, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
  192. #else
  193. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)mount_control, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
  194. #endif
  195. }
  196. #if MAVLINK_MSG_ID_MOUNT_CONTROL_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_mount_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
  205. {
  206. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  207. char *buf = (char *)msgbuf;
  208. _mav_put_int32_t(buf, 0, input_a);
  209. _mav_put_int32_t(buf, 4, input_b);
  210. _mav_put_int32_t(buf, 8, input_c);
  211. _mav_put_uint8_t(buf, 12, target_system);
  212. _mav_put_uint8_t(buf, 13, target_component);
  213. _mav_put_uint8_t(buf, 14, save_position);
  214. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
  215. #else
  216. mavlink_mount_control_t *packet = (mavlink_mount_control_t *)msgbuf;
  217. packet->input_a = input_a;
  218. packet->input_b = input_b;
  219. packet->input_c = input_c;
  220. packet->target_system = target_system;
  221. packet->target_component = target_component;
  222. packet->save_position = save_position;
  223. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
  224. #endif
  225. }
  226. #endif
  227. #endif
  228. // MESSAGE MOUNT_CONTROL UNPACKING
  229. /**
  230. * @brief Get field target_system from mount_control message
  231. *
  232. * @return System ID.
  233. */
  234. static inline uint8_t mavlink_msg_mount_control_get_target_system(const mavlink_message_t* msg)
  235. {
  236. return _MAV_RETURN_uint8_t(msg, 12);
  237. }
  238. /**
  239. * @brief Get field target_component from mount_control message
  240. *
  241. * @return Component ID.
  242. */
  243. static inline uint8_t mavlink_msg_mount_control_get_target_component(const mavlink_message_t* msg)
  244. {
  245. return _MAV_RETURN_uint8_t(msg, 13);
  246. }
  247. /**
  248. * @brief Get field input_a from mount_control message
  249. *
  250. * @return Pitch (centi-degrees) or lat (degE7), depending on mount mode.
  251. */
  252. static inline int32_t mavlink_msg_mount_control_get_input_a(const mavlink_message_t* msg)
  253. {
  254. return _MAV_RETURN_int32_t(msg, 0);
  255. }
  256. /**
  257. * @brief Get field input_b from mount_control message
  258. *
  259. * @return Roll (centi-degrees) or lon (degE7) depending on mount mode.
  260. */
  261. static inline int32_t mavlink_msg_mount_control_get_input_b(const mavlink_message_t* msg)
  262. {
  263. return _MAV_RETURN_int32_t(msg, 4);
  264. }
  265. /**
  266. * @brief Get field input_c from mount_control message
  267. *
  268. * @return Yaw (centi-degrees) or alt (cm) depending on mount mode.
  269. */
  270. static inline int32_t mavlink_msg_mount_control_get_input_c(const mavlink_message_t* msg)
  271. {
  272. return _MAV_RETURN_int32_t(msg, 8);
  273. }
  274. /**
  275. * @brief Get field save_position from mount_control message
  276. *
  277. * @return If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING).
  278. */
  279. static inline uint8_t mavlink_msg_mount_control_get_save_position(const mavlink_message_t* msg)
  280. {
  281. return _MAV_RETURN_uint8_t(msg, 14);
  282. }
  283. /**
  284. * @brief Decode a mount_control message into a struct
  285. *
  286. * @param msg The message to decode
  287. * @param mount_control C-struct to decode the message contents into
  288. */
  289. static inline void mavlink_msg_mount_control_decode(const mavlink_message_t* msg, mavlink_mount_control_t* mount_control)
  290. {
  291. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  292. mount_control->input_a = mavlink_msg_mount_control_get_input_a(msg);
  293. mount_control->input_b = mavlink_msg_mount_control_get_input_b(msg);
  294. mount_control->input_c = mavlink_msg_mount_control_get_input_c(msg);
  295. mount_control->target_system = mavlink_msg_mount_control_get_target_system(msg);
  296. mount_control->target_component = mavlink_msg_mount_control_get_target_component(msg);
  297. mount_control->save_position = mavlink_msg_mount_control_get_save_position(msg);
  298. #else
  299. uint8_t len = msg->len < MAVLINK_MSG_ID_MOUNT_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_MOUNT_CONTROL_LEN;
  300. memset(mount_control, 0, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
  301. memcpy(mount_control, _MAV_PAYLOAD(msg), len);
  302. #endif
  303. }