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.

288 lines
12 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE SCALED_PRESSURE2 PACKING
  3. #define MAVLINK_MSG_ID_SCALED_PRESSURE2 137
  4. MAVPACKED(
  5. typedef struct __mavlink_scaled_pressure2_t {
  6. uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
  7. float press_abs; /*< [hPa] Absolute pressure*/
  8. float press_diff; /*< [hPa] Differential pressure*/
  9. int16_t temperature; /*< [cdegC] Temperature measurement*/
  10. }) mavlink_scaled_pressure2_t;
  11. #define MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN 14
  12. #define MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN 14
  13. #define MAVLINK_MSG_ID_137_LEN 14
  14. #define MAVLINK_MSG_ID_137_MIN_LEN 14
  15. #define MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC 195
  16. #define MAVLINK_MSG_ID_137_CRC 195
  17. #if MAVLINK_COMMAND_24BIT
  18. #define MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2 { \
  19. 137, \
  20. "SCALED_PRESSURE2", \
  21. 4, \
  22. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_pressure2_t, time_boot_ms) }, \
  23. { "press_abs", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_scaled_pressure2_t, press_abs) }, \
  24. { "press_diff", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_scaled_pressure2_t, press_diff) }, \
  25. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_pressure2_t, temperature) }, \
  26. } \
  27. }
  28. #else
  29. #define MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2 { \
  30. "SCALED_PRESSURE2", \
  31. 4, \
  32. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_pressure2_t, time_boot_ms) }, \
  33. { "press_abs", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_scaled_pressure2_t, press_abs) }, \
  34. { "press_diff", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_scaled_pressure2_t, press_diff) }, \
  35. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_pressure2_t, temperature) }, \
  36. } \
  37. }
  38. #endif
  39. /**
  40. * @brief Pack a scaled_pressure2 message
  41. * @param system_id ID of this system
  42. * @param component_id ID of this component (e.g. 200 for IMU)
  43. * @param msg The MAVLink message to compress the data into
  44. *
  45. * @param time_boot_ms [ms] Timestamp (time since system boot).
  46. * @param press_abs [hPa] Absolute pressure
  47. * @param press_diff [hPa] Differential pressure
  48. * @param temperature [cdegC] Temperature measurement
  49. * @return length of the message in bytes (excluding serial stream start sign)
  50. */
  51. static inline uint16_t mavlink_msg_scaled_pressure2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  52. uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature)
  53. {
  54. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  55. char buf[MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN];
  56. _mav_put_uint32_t(buf, 0, time_boot_ms);
  57. _mav_put_float(buf, 4, press_abs);
  58. _mav_put_float(buf, 8, press_diff);
  59. _mav_put_int16_t(buf, 12, temperature);
  60. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
  61. #else
  62. mavlink_scaled_pressure2_t packet;
  63. packet.time_boot_ms = time_boot_ms;
  64. packet.press_abs = press_abs;
  65. packet.press_diff = press_diff;
  66. packet.temperature = temperature;
  67. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
  68. #endif
  69. msg->msgid = MAVLINK_MSG_ID_SCALED_PRESSURE2;
  70. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
  71. }
  72. /**
  73. * @brief Pack a scaled_pressure2 message on a channel
  74. * @param system_id ID of this system
  75. * @param component_id ID of this component (e.g. 200 for IMU)
  76. * @param chan The MAVLink channel this message will be sent over
  77. * @param msg The MAVLink message to compress the data into
  78. * @param time_boot_ms [ms] Timestamp (time since system boot).
  79. * @param press_abs [hPa] Absolute pressure
  80. * @param press_diff [hPa] Differential pressure
  81. * @param temperature [cdegC] Temperature measurement
  82. * @return length of the message in bytes (excluding serial stream start sign)
  83. */
  84. static inline uint16_t mavlink_msg_scaled_pressure2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  85. mavlink_message_t* msg,
  86. uint32_t time_boot_ms,float press_abs,float press_diff,int16_t temperature)
  87. {
  88. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  89. char buf[MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN];
  90. _mav_put_uint32_t(buf, 0, time_boot_ms);
  91. _mav_put_float(buf, 4, press_abs);
  92. _mav_put_float(buf, 8, press_diff);
  93. _mav_put_int16_t(buf, 12, temperature);
  94. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
  95. #else
  96. mavlink_scaled_pressure2_t packet;
  97. packet.time_boot_ms = time_boot_ms;
  98. packet.press_abs = press_abs;
  99. packet.press_diff = press_diff;
  100. packet.temperature = temperature;
  101. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
  102. #endif
  103. msg->msgid = MAVLINK_MSG_ID_SCALED_PRESSURE2;
  104. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
  105. }
  106. /**
  107. * @brief Encode a scaled_pressure2 struct
  108. *
  109. * @param system_id ID of this system
  110. * @param component_id ID of this component (e.g. 200 for IMU)
  111. * @param msg The MAVLink message to compress the data into
  112. * @param scaled_pressure2 C-struct to read the message contents from
  113. */
  114. static inline uint16_t mavlink_msg_scaled_pressure2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_scaled_pressure2_t* scaled_pressure2)
  115. {
  116. return mavlink_msg_scaled_pressure2_pack(system_id, component_id, msg, scaled_pressure2->time_boot_ms, scaled_pressure2->press_abs, scaled_pressure2->press_diff, scaled_pressure2->temperature);
  117. }
  118. /**
  119. * @brief Encode a scaled_pressure2 struct on a channel
  120. *
  121. * @param system_id ID of this system
  122. * @param component_id ID of this component (e.g. 200 for IMU)
  123. * @param chan The MAVLink channel this message will be sent over
  124. * @param msg The MAVLink message to compress the data into
  125. * @param scaled_pressure2 C-struct to read the message contents from
  126. */
  127. static inline uint16_t mavlink_msg_scaled_pressure2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_scaled_pressure2_t* scaled_pressure2)
  128. {
  129. return mavlink_msg_scaled_pressure2_pack_chan(system_id, component_id, chan, msg, scaled_pressure2->time_boot_ms, scaled_pressure2->press_abs, scaled_pressure2->press_diff, scaled_pressure2->temperature);
  130. }
  131. /**
  132. * @brief Send a scaled_pressure2 message
  133. * @param chan MAVLink channel to send the message
  134. *
  135. * @param time_boot_ms [ms] Timestamp (time since system boot).
  136. * @param press_abs [hPa] Absolute pressure
  137. * @param press_diff [hPa] Differential pressure
  138. * @param temperature [cdegC] Temperature measurement
  139. */
  140. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  141. static inline void mavlink_msg_scaled_pressure2_send(mavlink_channel_t chan, uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature)
  142. {
  143. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  144. char buf[MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN];
  145. _mav_put_uint32_t(buf, 0, time_boot_ms);
  146. _mav_put_float(buf, 4, press_abs);
  147. _mav_put_float(buf, 8, press_diff);
  148. _mav_put_int16_t(buf, 12, temperature);
  149. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
  150. #else
  151. mavlink_scaled_pressure2_t packet;
  152. packet.time_boot_ms = time_boot_ms;
  153. packet.press_abs = press_abs;
  154. packet.press_diff = press_diff;
  155. packet.temperature = temperature;
  156. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, (const char *)&packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
  157. #endif
  158. }
  159. /**
  160. * @brief Send a scaled_pressure2 message
  161. * @param chan MAVLink channel to send the message
  162. * @param struct The MAVLink struct to serialize
  163. */
  164. static inline void mavlink_msg_scaled_pressure2_send_struct(mavlink_channel_t chan, const mavlink_scaled_pressure2_t* scaled_pressure2)
  165. {
  166. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  167. mavlink_msg_scaled_pressure2_send(chan, scaled_pressure2->time_boot_ms, scaled_pressure2->press_abs, scaled_pressure2->press_diff, scaled_pressure2->temperature);
  168. #else
  169. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, (const char *)scaled_pressure2, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
  170. #endif
  171. }
  172. #if MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  173. /*
  174. This varient of _send() can be used to save stack space by re-using
  175. memory from the receive buffer. The caller provides a
  176. mavlink_message_t which is the size of a full mavlink message. This
  177. is usually the receive buffer for the channel, and allows a reply to an
  178. incoming message with minimum stack space usage.
  179. */
  180. static inline void mavlink_msg_scaled_pressure2_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature)
  181. {
  182. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  183. char *buf = (char *)msgbuf;
  184. _mav_put_uint32_t(buf, 0, time_boot_ms);
  185. _mav_put_float(buf, 4, press_abs);
  186. _mav_put_float(buf, 8, press_diff);
  187. _mav_put_int16_t(buf, 12, temperature);
  188. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
  189. #else
  190. mavlink_scaled_pressure2_t *packet = (mavlink_scaled_pressure2_t *)msgbuf;
  191. packet->time_boot_ms = time_boot_ms;
  192. packet->press_abs = press_abs;
  193. packet->press_diff = press_diff;
  194. packet->temperature = temperature;
  195. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, (const char *)packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
  196. #endif
  197. }
  198. #endif
  199. #endif
  200. // MESSAGE SCALED_PRESSURE2 UNPACKING
  201. /**
  202. * @brief Get field time_boot_ms from scaled_pressure2 message
  203. *
  204. * @return [ms] Timestamp (time since system boot).
  205. */
  206. static inline uint32_t mavlink_msg_scaled_pressure2_get_time_boot_ms(const mavlink_message_t* msg)
  207. {
  208. return _MAV_RETURN_uint32_t(msg, 0);
  209. }
  210. /**
  211. * @brief Get field press_abs from scaled_pressure2 message
  212. *
  213. * @return [hPa] Absolute pressure
  214. */
  215. static inline float mavlink_msg_scaled_pressure2_get_press_abs(const mavlink_message_t* msg)
  216. {
  217. return _MAV_RETURN_float(msg, 4);
  218. }
  219. /**
  220. * @brief Get field press_diff from scaled_pressure2 message
  221. *
  222. * @return [hPa] Differential pressure
  223. */
  224. static inline float mavlink_msg_scaled_pressure2_get_press_diff(const mavlink_message_t* msg)
  225. {
  226. return _MAV_RETURN_float(msg, 8);
  227. }
  228. /**
  229. * @brief Get field temperature from scaled_pressure2 message
  230. *
  231. * @return [cdegC] Temperature measurement
  232. */
  233. static inline int16_t mavlink_msg_scaled_pressure2_get_temperature(const mavlink_message_t* msg)
  234. {
  235. return _MAV_RETURN_int16_t(msg, 12);
  236. }
  237. /**
  238. * @brief Decode a scaled_pressure2 message into a struct
  239. *
  240. * @param msg The message to decode
  241. * @param scaled_pressure2 C-struct to decode the message contents into
  242. */
  243. static inline void mavlink_msg_scaled_pressure2_decode(const mavlink_message_t* msg, mavlink_scaled_pressure2_t* scaled_pressure2)
  244. {
  245. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  246. scaled_pressure2->time_boot_ms = mavlink_msg_scaled_pressure2_get_time_boot_ms(msg);
  247. scaled_pressure2->press_abs = mavlink_msg_scaled_pressure2_get_press_abs(msg);
  248. scaled_pressure2->press_diff = mavlink_msg_scaled_pressure2_get_press_diff(msg);
  249. scaled_pressure2->temperature = mavlink_msg_scaled_pressure2_get_temperature(msg);
  250. #else
  251. uint8_t len = msg->len < MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN? msg->len : MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN;
  252. memset(scaled_pressure2, 0, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
  253. memcpy(scaled_pressure2, _MAV_PAYLOAD(msg), len);
  254. #endif
  255. }