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.

788 lines
36 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE HIGH_LATENCY PACKING
  3. #define MAVLINK_MSG_ID_HIGH_LATENCY 234
  4. MAVPACKED(
  5. typedef struct __mavlink_high_latency_t {
  6. uint32_t custom_mode; /*< A bitfield for use for autopilot-specific flags.*/
  7. int32_t latitude; /*< [degE7] Latitude*/
  8. int32_t longitude; /*< [degE7] Longitude*/
  9. int16_t roll; /*< [cdeg] roll*/
  10. int16_t pitch; /*< [cdeg] pitch*/
  11. uint16_t heading; /*< [cdeg] heading*/
  12. int16_t heading_sp; /*< [cdeg] heading setpoint*/
  13. int16_t altitude_amsl; /*< [m] Altitude above mean sea level*/
  14. int16_t altitude_sp; /*< [m] Altitude setpoint relative to the home position*/
  15. uint16_t wp_distance; /*< [m] distance to target*/
  16. uint8_t base_mode; /*< Bitmap of enabled system modes.*/
  17. uint8_t landed_state; /*< The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.*/
  18. int8_t throttle; /*< [%] throttle (percentage)*/
  19. uint8_t airspeed; /*< [m/s] airspeed*/
  20. uint8_t airspeed_sp; /*< [m/s] airspeed setpoint*/
  21. uint8_t groundspeed; /*< [m/s] groundspeed*/
  22. int8_t climb_rate; /*< [m/s] climb rate*/
  23. uint8_t gps_nsat; /*< Number of satellites visible. If unknown, set to 255*/
  24. uint8_t gps_fix_type; /*< GPS Fix type.*/
  25. uint8_t battery_remaining; /*< [%] Remaining battery (percentage)*/
  26. int8_t temperature; /*< [degC] Autopilot temperature (degrees C)*/
  27. int8_t temperature_air; /*< [degC] Air temperature (degrees C) from airspeed sensor*/
  28. uint8_t failsafe; /*< failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)*/
  29. uint8_t wp_num; /*< current waypoint number*/
  30. }) mavlink_high_latency_t;
  31. #define MAVLINK_MSG_ID_HIGH_LATENCY_LEN 40
  32. #define MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN 40
  33. #define MAVLINK_MSG_ID_234_LEN 40
  34. #define MAVLINK_MSG_ID_234_MIN_LEN 40
  35. #define MAVLINK_MSG_ID_HIGH_LATENCY_CRC 150
  36. #define MAVLINK_MSG_ID_234_CRC 150
  37. #if MAVLINK_COMMAND_24BIT
  38. #define MAVLINK_MESSAGE_INFO_HIGH_LATENCY { \
  39. 234, \
  40. "HIGH_LATENCY", \
  41. 24, \
  42. { { "base_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency_t, base_mode) }, \
  43. { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency_t, custom_mode) }, \
  44. { "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency_t, landed_state) }, \
  45. { "roll", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_high_latency_t, roll) }, \
  46. { "pitch", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency_t, pitch) }, \
  47. { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_high_latency_t, heading) }, \
  48. { "throttle", NULL, MAVLINK_TYPE_INT8_T, 0, 28, offsetof(mavlink_high_latency_t, throttle) }, \
  49. { "heading_sp", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_high_latency_t, heading_sp) }, \
  50. { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency_t, latitude) }, \
  51. { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency_t, longitude) }, \
  52. { "altitude_amsl", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_high_latency_t, altitude_amsl) }, \
  53. { "altitude_sp", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_high_latency_t, altitude_sp) }, \
  54. { "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency_t, airspeed) }, \
  55. { "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency_t, airspeed_sp) }, \
  56. { "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency_t, groundspeed) }, \
  57. { "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 32, offsetof(mavlink_high_latency_t, climb_rate) }, \
  58. { "gps_nsat", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency_t, gps_nsat) }, \
  59. { "gps_fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency_t, gps_fix_type) }, \
  60. { "battery_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency_t, battery_remaining) }, \
  61. { "temperature", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency_t, temperature) }, \
  62. { "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency_t, temperature_air) }, \
  63. { "failsafe", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_high_latency_t, failsafe) }, \
  64. { "wp_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_high_latency_t, wp_num) }, \
  65. { "wp_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_high_latency_t, wp_distance) }, \
  66. } \
  67. }
  68. #else
  69. #define MAVLINK_MESSAGE_INFO_HIGH_LATENCY { \
  70. "HIGH_LATENCY", \
  71. 24, \
  72. { { "base_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency_t, base_mode) }, \
  73. { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency_t, custom_mode) }, \
  74. { "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency_t, landed_state) }, \
  75. { "roll", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_high_latency_t, roll) }, \
  76. { "pitch", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency_t, pitch) }, \
  77. { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_high_latency_t, heading) }, \
  78. { "throttle", NULL, MAVLINK_TYPE_INT8_T, 0, 28, offsetof(mavlink_high_latency_t, throttle) }, \
  79. { "heading_sp", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_high_latency_t, heading_sp) }, \
  80. { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency_t, latitude) }, \
  81. { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency_t, longitude) }, \
  82. { "altitude_amsl", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_high_latency_t, altitude_amsl) }, \
  83. { "altitude_sp", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_high_latency_t, altitude_sp) }, \
  84. { "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency_t, airspeed) }, \
  85. { "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency_t, airspeed_sp) }, \
  86. { "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency_t, groundspeed) }, \
  87. { "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 32, offsetof(mavlink_high_latency_t, climb_rate) }, \
  88. { "gps_nsat", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency_t, gps_nsat) }, \
  89. { "gps_fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency_t, gps_fix_type) }, \
  90. { "battery_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency_t, battery_remaining) }, \
  91. { "temperature", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency_t, temperature) }, \
  92. { "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency_t, temperature_air) }, \
  93. { "failsafe", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_high_latency_t, failsafe) }, \
  94. { "wp_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_high_latency_t, wp_num) }, \
  95. { "wp_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_high_latency_t, wp_distance) }, \
  96. } \
  97. }
  98. #endif
  99. /**
  100. * @brief Pack a high_latency message
  101. * @param system_id ID of this system
  102. * @param component_id ID of this component (e.g. 200 for IMU)
  103. * @param msg The MAVLink message to compress the data into
  104. *
  105. * @param base_mode Bitmap of enabled system modes.
  106. * @param custom_mode A bitfield for use for autopilot-specific flags.
  107. * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
  108. * @param roll [cdeg] roll
  109. * @param pitch [cdeg] pitch
  110. * @param heading [cdeg] heading
  111. * @param throttle [%] throttle (percentage)
  112. * @param heading_sp [cdeg] heading setpoint
  113. * @param latitude [degE7] Latitude
  114. * @param longitude [degE7] Longitude
  115. * @param altitude_amsl [m] Altitude above mean sea level
  116. * @param altitude_sp [m] Altitude setpoint relative to the home position
  117. * @param airspeed [m/s] airspeed
  118. * @param airspeed_sp [m/s] airspeed setpoint
  119. * @param groundspeed [m/s] groundspeed
  120. * @param climb_rate [m/s] climb rate
  121. * @param gps_nsat Number of satellites visible. If unknown, set to 255
  122. * @param gps_fix_type GPS Fix type.
  123. * @param battery_remaining [%] Remaining battery (percentage)
  124. * @param temperature [degC] Autopilot temperature (degrees C)
  125. * @param temperature_air [degC] Air temperature (degrees C) from airspeed sensor
  126. * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
  127. * @param wp_num current waypoint number
  128. * @param wp_distance [m] distance to target
  129. * @return length of the message in bytes (excluding serial stream start sign)
  130. */
  131. static inline uint16_t mavlink_msg_high_latency_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  132. uint8_t base_mode, uint32_t custom_mode, uint8_t landed_state, int16_t roll, int16_t pitch, uint16_t heading, int8_t throttle, int16_t heading_sp, int32_t latitude, int32_t longitude, int16_t altitude_amsl, int16_t altitude_sp, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, int8_t climb_rate, uint8_t gps_nsat, uint8_t gps_fix_type, uint8_t battery_remaining, int8_t temperature, int8_t temperature_air, uint8_t failsafe, uint8_t wp_num, uint16_t wp_distance)
  133. {
  134. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  135. char buf[MAVLINK_MSG_ID_HIGH_LATENCY_LEN];
  136. _mav_put_uint32_t(buf, 0, custom_mode);
  137. _mav_put_int32_t(buf, 4, latitude);
  138. _mav_put_int32_t(buf, 8, longitude);
  139. _mav_put_int16_t(buf, 12, roll);
  140. _mav_put_int16_t(buf, 14, pitch);
  141. _mav_put_uint16_t(buf, 16, heading);
  142. _mav_put_int16_t(buf, 18, heading_sp);
  143. _mav_put_int16_t(buf, 20, altitude_amsl);
  144. _mav_put_int16_t(buf, 22, altitude_sp);
  145. _mav_put_uint16_t(buf, 24, wp_distance);
  146. _mav_put_uint8_t(buf, 26, base_mode);
  147. _mav_put_uint8_t(buf, 27, landed_state);
  148. _mav_put_int8_t(buf, 28, throttle);
  149. _mav_put_uint8_t(buf, 29, airspeed);
  150. _mav_put_uint8_t(buf, 30, airspeed_sp);
  151. _mav_put_uint8_t(buf, 31, groundspeed);
  152. _mav_put_int8_t(buf, 32, climb_rate);
  153. _mav_put_uint8_t(buf, 33, gps_nsat);
  154. _mav_put_uint8_t(buf, 34, gps_fix_type);
  155. _mav_put_uint8_t(buf, 35, battery_remaining);
  156. _mav_put_int8_t(buf, 36, temperature);
  157. _mav_put_int8_t(buf, 37, temperature_air);
  158. _mav_put_uint8_t(buf, 38, failsafe);
  159. _mav_put_uint8_t(buf, 39, wp_num);
  160. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
  161. #else
  162. mavlink_high_latency_t packet;
  163. packet.custom_mode = custom_mode;
  164. packet.latitude = latitude;
  165. packet.longitude = longitude;
  166. packet.roll = roll;
  167. packet.pitch = pitch;
  168. packet.heading = heading;
  169. packet.heading_sp = heading_sp;
  170. packet.altitude_amsl = altitude_amsl;
  171. packet.altitude_sp = altitude_sp;
  172. packet.wp_distance = wp_distance;
  173. packet.base_mode = base_mode;
  174. packet.landed_state = landed_state;
  175. packet.throttle = throttle;
  176. packet.airspeed = airspeed;
  177. packet.airspeed_sp = airspeed_sp;
  178. packet.groundspeed = groundspeed;
  179. packet.climb_rate = climb_rate;
  180. packet.gps_nsat = gps_nsat;
  181. packet.gps_fix_type = gps_fix_type;
  182. packet.battery_remaining = battery_remaining;
  183. packet.temperature = temperature;
  184. packet.temperature_air = temperature_air;
  185. packet.failsafe = failsafe;
  186. packet.wp_num = wp_num;
  187. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
  188. #endif
  189. msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY;
  190. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
  191. }
  192. /**
  193. * @brief Pack a high_latency message on a channel
  194. * @param system_id ID of this system
  195. * @param component_id ID of this component (e.g. 200 for IMU)
  196. * @param chan The MAVLink channel this message will be sent over
  197. * @param msg The MAVLink message to compress the data into
  198. * @param base_mode Bitmap of enabled system modes.
  199. * @param custom_mode A bitfield for use for autopilot-specific flags.
  200. * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
  201. * @param roll [cdeg] roll
  202. * @param pitch [cdeg] pitch
  203. * @param heading [cdeg] heading
  204. * @param throttle [%] throttle (percentage)
  205. * @param heading_sp [cdeg] heading setpoint
  206. * @param latitude [degE7] Latitude
  207. * @param longitude [degE7] Longitude
  208. * @param altitude_amsl [m] Altitude above mean sea level
  209. * @param altitude_sp [m] Altitude setpoint relative to the home position
  210. * @param airspeed [m/s] airspeed
  211. * @param airspeed_sp [m/s] airspeed setpoint
  212. * @param groundspeed [m/s] groundspeed
  213. * @param climb_rate [m/s] climb rate
  214. * @param gps_nsat Number of satellites visible. If unknown, set to 255
  215. * @param gps_fix_type GPS Fix type.
  216. * @param battery_remaining [%] Remaining battery (percentage)
  217. * @param temperature [degC] Autopilot temperature (degrees C)
  218. * @param temperature_air [degC] Air temperature (degrees C) from airspeed sensor
  219. * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
  220. * @param wp_num current waypoint number
  221. * @param wp_distance [m] distance to target
  222. * @return length of the message in bytes (excluding serial stream start sign)
  223. */
  224. static inline uint16_t mavlink_msg_high_latency_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  225. mavlink_message_t* msg,
  226. uint8_t base_mode,uint32_t custom_mode,uint8_t landed_state,int16_t roll,int16_t pitch,uint16_t heading,int8_t throttle,int16_t heading_sp,int32_t latitude,int32_t longitude,int16_t altitude_amsl,int16_t altitude_sp,uint8_t airspeed,uint8_t airspeed_sp,uint8_t groundspeed,int8_t climb_rate,uint8_t gps_nsat,uint8_t gps_fix_type,uint8_t battery_remaining,int8_t temperature,int8_t temperature_air,uint8_t failsafe,uint8_t wp_num,uint16_t wp_distance)
  227. {
  228. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  229. char buf[MAVLINK_MSG_ID_HIGH_LATENCY_LEN];
  230. _mav_put_uint32_t(buf, 0, custom_mode);
  231. _mav_put_int32_t(buf, 4, latitude);
  232. _mav_put_int32_t(buf, 8, longitude);
  233. _mav_put_int16_t(buf, 12, roll);
  234. _mav_put_int16_t(buf, 14, pitch);
  235. _mav_put_uint16_t(buf, 16, heading);
  236. _mav_put_int16_t(buf, 18, heading_sp);
  237. _mav_put_int16_t(buf, 20, altitude_amsl);
  238. _mav_put_int16_t(buf, 22, altitude_sp);
  239. _mav_put_uint16_t(buf, 24, wp_distance);
  240. _mav_put_uint8_t(buf, 26, base_mode);
  241. _mav_put_uint8_t(buf, 27, landed_state);
  242. _mav_put_int8_t(buf, 28, throttle);
  243. _mav_put_uint8_t(buf, 29, airspeed);
  244. _mav_put_uint8_t(buf, 30, airspeed_sp);
  245. _mav_put_uint8_t(buf, 31, groundspeed);
  246. _mav_put_int8_t(buf, 32, climb_rate);
  247. _mav_put_uint8_t(buf, 33, gps_nsat);
  248. _mav_put_uint8_t(buf, 34, gps_fix_type);
  249. _mav_put_uint8_t(buf, 35, battery_remaining);
  250. _mav_put_int8_t(buf, 36, temperature);
  251. _mav_put_int8_t(buf, 37, temperature_air);
  252. _mav_put_uint8_t(buf, 38, failsafe);
  253. _mav_put_uint8_t(buf, 39, wp_num);
  254. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
  255. #else
  256. mavlink_high_latency_t packet;
  257. packet.custom_mode = custom_mode;
  258. packet.latitude = latitude;
  259. packet.longitude = longitude;
  260. packet.roll = roll;
  261. packet.pitch = pitch;
  262. packet.heading = heading;
  263. packet.heading_sp = heading_sp;
  264. packet.altitude_amsl = altitude_amsl;
  265. packet.altitude_sp = altitude_sp;
  266. packet.wp_distance = wp_distance;
  267. packet.base_mode = base_mode;
  268. packet.landed_state = landed_state;
  269. packet.throttle = throttle;
  270. packet.airspeed = airspeed;
  271. packet.airspeed_sp = airspeed_sp;
  272. packet.groundspeed = groundspeed;
  273. packet.climb_rate = climb_rate;
  274. packet.gps_nsat = gps_nsat;
  275. packet.gps_fix_type = gps_fix_type;
  276. packet.battery_remaining = battery_remaining;
  277. packet.temperature = temperature;
  278. packet.temperature_air = temperature_air;
  279. packet.failsafe = failsafe;
  280. packet.wp_num = wp_num;
  281. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
  282. #endif
  283. msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY;
  284. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
  285. }
  286. /**
  287. * @brief Encode a high_latency struct
  288. *
  289. * @param system_id ID of this system
  290. * @param component_id ID of this component (e.g. 200 for IMU)
  291. * @param msg The MAVLink message to compress the data into
  292. * @param high_latency C-struct to read the message contents from
  293. */
  294. static inline uint16_t mavlink_msg_high_latency_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_high_latency_t* high_latency)
  295. {
  296. return mavlink_msg_high_latency_pack(system_id, component_id, msg, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance);
  297. }
  298. /**
  299. * @brief Encode a high_latency struct on a channel
  300. *
  301. * @param system_id ID of this system
  302. * @param component_id ID of this component (e.g. 200 for IMU)
  303. * @param chan The MAVLink channel this message will be sent over
  304. * @param msg The MAVLink message to compress the data into
  305. * @param high_latency C-struct to read the message contents from
  306. */
  307. static inline uint16_t mavlink_msg_high_latency_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_high_latency_t* high_latency)
  308. {
  309. return mavlink_msg_high_latency_pack_chan(system_id, component_id, chan, msg, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance);
  310. }
  311. /**
  312. * @brief Send a high_latency message
  313. * @param chan MAVLink channel to send the message
  314. *
  315. * @param base_mode Bitmap of enabled system modes.
  316. * @param custom_mode A bitfield for use for autopilot-specific flags.
  317. * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
  318. * @param roll [cdeg] roll
  319. * @param pitch [cdeg] pitch
  320. * @param heading [cdeg] heading
  321. * @param throttle [%] throttle (percentage)
  322. * @param heading_sp [cdeg] heading setpoint
  323. * @param latitude [degE7] Latitude
  324. * @param longitude [degE7] Longitude
  325. * @param altitude_amsl [m] Altitude above mean sea level
  326. * @param altitude_sp [m] Altitude setpoint relative to the home position
  327. * @param airspeed [m/s] airspeed
  328. * @param airspeed_sp [m/s] airspeed setpoint
  329. * @param groundspeed [m/s] groundspeed
  330. * @param climb_rate [m/s] climb rate
  331. * @param gps_nsat Number of satellites visible. If unknown, set to 255
  332. * @param gps_fix_type GPS Fix type.
  333. * @param battery_remaining [%] Remaining battery (percentage)
  334. * @param temperature [degC] Autopilot temperature (degrees C)
  335. * @param temperature_air [degC] Air temperature (degrees C) from airspeed sensor
  336. * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
  337. * @param wp_num current waypoint number
  338. * @param wp_distance [m] distance to target
  339. */
  340. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  341. static inline void mavlink_msg_high_latency_send(mavlink_channel_t chan, uint8_t base_mode, uint32_t custom_mode, uint8_t landed_state, int16_t roll, int16_t pitch, uint16_t heading, int8_t throttle, int16_t heading_sp, int32_t latitude, int32_t longitude, int16_t altitude_amsl, int16_t altitude_sp, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, int8_t climb_rate, uint8_t gps_nsat, uint8_t gps_fix_type, uint8_t battery_remaining, int8_t temperature, int8_t temperature_air, uint8_t failsafe, uint8_t wp_num, uint16_t wp_distance)
  342. {
  343. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  344. char buf[MAVLINK_MSG_ID_HIGH_LATENCY_LEN];
  345. _mav_put_uint32_t(buf, 0, custom_mode);
  346. _mav_put_int32_t(buf, 4, latitude);
  347. _mav_put_int32_t(buf, 8, longitude);
  348. _mav_put_int16_t(buf, 12, roll);
  349. _mav_put_int16_t(buf, 14, pitch);
  350. _mav_put_uint16_t(buf, 16, heading);
  351. _mav_put_int16_t(buf, 18, heading_sp);
  352. _mav_put_int16_t(buf, 20, altitude_amsl);
  353. _mav_put_int16_t(buf, 22, altitude_sp);
  354. _mav_put_uint16_t(buf, 24, wp_distance);
  355. _mav_put_uint8_t(buf, 26, base_mode);
  356. _mav_put_uint8_t(buf, 27, landed_state);
  357. _mav_put_int8_t(buf, 28, throttle);
  358. _mav_put_uint8_t(buf, 29, airspeed);
  359. _mav_put_uint8_t(buf, 30, airspeed_sp);
  360. _mav_put_uint8_t(buf, 31, groundspeed);
  361. _mav_put_int8_t(buf, 32, climb_rate);
  362. _mav_put_uint8_t(buf, 33, gps_nsat);
  363. _mav_put_uint8_t(buf, 34, gps_fix_type);
  364. _mav_put_uint8_t(buf, 35, battery_remaining);
  365. _mav_put_int8_t(buf, 36, temperature);
  366. _mav_put_int8_t(buf, 37, temperature_air);
  367. _mav_put_uint8_t(buf, 38, failsafe);
  368. _mav_put_uint8_t(buf, 39, wp_num);
  369. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, buf, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
  370. #else
  371. mavlink_high_latency_t packet;
  372. packet.custom_mode = custom_mode;
  373. packet.latitude = latitude;
  374. packet.longitude = longitude;
  375. packet.roll = roll;
  376. packet.pitch = pitch;
  377. packet.heading = heading;
  378. packet.heading_sp = heading_sp;
  379. packet.altitude_amsl = altitude_amsl;
  380. packet.altitude_sp = altitude_sp;
  381. packet.wp_distance = wp_distance;
  382. packet.base_mode = base_mode;
  383. packet.landed_state = landed_state;
  384. packet.throttle = throttle;
  385. packet.airspeed = airspeed;
  386. packet.airspeed_sp = airspeed_sp;
  387. packet.groundspeed = groundspeed;
  388. packet.climb_rate = climb_rate;
  389. packet.gps_nsat = gps_nsat;
  390. packet.gps_fix_type = gps_fix_type;
  391. packet.battery_remaining = battery_remaining;
  392. packet.temperature = temperature;
  393. packet.temperature_air = temperature_air;
  394. packet.failsafe = failsafe;
  395. packet.wp_num = wp_num;
  396. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, (const char *)&packet, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
  397. #endif
  398. }
  399. /**
  400. * @brief Send a high_latency message
  401. * @param chan MAVLink channel to send the message
  402. * @param struct The MAVLink struct to serialize
  403. */
  404. static inline void mavlink_msg_high_latency_send_struct(mavlink_channel_t chan, const mavlink_high_latency_t* high_latency)
  405. {
  406. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  407. mavlink_msg_high_latency_send(chan, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance);
  408. #else
  409. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, (const char *)high_latency, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
  410. #endif
  411. }
  412. #if MAVLINK_MSG_ID_HIGH_LATENCY_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  413. /*
  414. This varient of _send() can be used to save stack space by re-using
  415. memory from the receive buffer. The caller provides a
  416. mavlink_message_t which is the size of a full mavlink message. This
  417. is usually the receive buffer for the channel, and allows a reply to an
  418. incoming message with minimum stack space usage.
  419. */
  420. static inline void mavlink_msg_high_latency_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t base_mode, uint32_t custom_mode, uint8_t landed_state, int16_t roll, int16_t pitch, uint16_t heading, int8_t throttle, int16_t heading_sp, int32_t latitude, int32_t longitude, int16_t altitude_amsl, int16_t altitude_sp, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, int8_t climb_rate, uint8_t gps_nsat, uint8_t gps_fix_type, uint8_t battery_remaining, int8_t temperature, int8_t temperature_air, uint8_t failsafe, uint8_t wp_num, uint16_t wp_distance)
  421. {
  422. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  423. char *buf = (char *)msgbuf;
  424. _mav_put_uint32_t(buf, 0, custom_mode);
  425. _mav_put_int32_t(buf, 4, latitude);
  426. _mav_put_int32_t(buf, 8, longitude);
  427. _mav_put_int16_t(buf, 12, roll);
  428. _mav_put_int16_t(buf, 14, pitch);
  429. _mav_put_uint16_t(buf, 16, heading);
  430. _mav_put_int16_t(buf, 18, heading_sp);
  431. _mav_put_int16_t(buf, 20, altitude_amsl);
  432. _mav_put_int16_t(buf, 22, altitude_sp);
  433. _mav_put_uint16_t(buf, 24, wp_distance);
  434. _mav_put_uint8_t(buf, 26, base_mode);
  435. _mav_put_uint8_t(buf, 27, landed_state);
  436. _mav_put_int8_t(buf, 28, throttle);
  437. _mav_put_uint8_t(buf, 29, airspeed);
  438. _mav_put_uint8_t(buf, 30, airspeed_sp);
  439. _mav_put_uint8_t(buf, 31, groundspeed);
  440. _mav_put_int8_t(buf, 32, climb_rate);
  441. _mav_put_uint8_t(buf, 33, gps_nsat);
  442. _mav_put_uint8_t(buf, 34, gps_fix_type);
  443. _mav_put_uint8_t(buf, 35, battery_remaining);
  444. _mav_put_int8_t(buf, 36, temperature);
  445. _mav_put_int8_t(buf, 37, temperature_air);
  446. _mav_put_uint8_t(buf, 38, failsafe);
  447. _mav_put_uint8_t(buf, 39, wp_num);
  448. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, buf, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
  449. #else
  450. mavlink_high_latency_t *packet = (mavlink_high_latency_t *)msgbuf;
  451. packet->custom_mode = custom_mode;
  452. packet->latitude = latitude;
  453. packet->longitude = longitude;
  454. packet->roll = roll;
  455. packet->pitch = pitch;
  456. packet->heading = heading;
  457. packet->heading_sp = heading_sp;
  458. packet->altitude_amsl = altitude_amsl;
  459. packet->altitude_sp = altitude_sp;
  460. packet->wp_distance = wp_distance;
  461. packet->base_mode = base_mode;
  462. packet->landed_state = landed_state;
  463. packet->throttle = throttle;
  464. packet->airspeed = airspeed;
  465. packet->airspeed_sp = airspeed_sp;
  466. packet->groundspeed = groundspeed;
  467. packet->climb_rate = climb_rate;
  468. packet->gps_nsat = gps_nsat;
  469. packet->gps_fix_type = gps_fix_type;
  470. packet->battery_remaining = battery_remaining;
  471. packet->temperature = temperature;
  472. packet->temperature_air = temperature_air;
  473. packet->failsafe = failsafe;
  474. packet->wp_num = wp_num;
  475. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, (const char *)packet, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
  476. #endif
  477. }
  478. #endif
  479. #endif
  480. // MESSAGE HIGH_LATENCY UNPACKING
  481. /**
  482. * @brief Get field base_mode from high_latency message
  483. *
  484. * @return Bitmap of enabled system modes.
  485. */
  486. static inline uint8_t mavlink_msg_high_latency_get_base_mode(const mavlink_message_t* msg)
  487. {
  488. return _MAV_RETURN_uint8_t(msg, 26);
  489. }
  490. /**
  491. * @brief Get field custom_mode from high_latency message
  492. *
  493. * @return A bitfield for use for autopilot-specific flags.
  494. */
  495. static inline uint32_t mavlink_msg_high_latency_get_custom_mode(const mavlink_message_t* msg)
  496. {
  497. return _MAV_RETURN_uint32_t(msg, 0);
  498. }
  499. /**
  500. * @brief Get field landed_state from high_latency message
  501. *
  502. * @return The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
  503. */
  504. static inline uint8_t mavlink_msg_high_latency_get_landed_state(const mavlink_message_t* msg)
  505. {
  506. return _MAV_RETURN_uint8_t(msg, 27);
  507. }
  508. /**
  509. * @brief Get field roll from high_latency message
  510. *
  511. * @return [cdeg] roll
  512. */
  513. static inline int16_t mavlink_msg_high_latency_get_roll(const mavlink_message_t* msg)
  514. {
  515. return _MAV_RETURN_int16_t(msg, 12);
  516. }
  517. /**
  518. * @brief Get field pitch from high_latency message
  519. *
  520. * @return [cdeg] pitch
  521. */
  522. static inline int16_t mavlink_msg_high_latency_get_pitch(const mavlink_message_t* msg)
  523. {
  524. return _MAV_RETURN_int16_t(msg, 14);
  525. }
  526. /**
  527. * @brief Get field heading from high_latency message
  528. *
  529. * @return [cdeg] heading
  530. */
  531. static inline uint16_t mavlink_msg_high_latency_get_heading(const mavlink_message_t* msg)
  532. {
  533. return _MAV_RETURN_uint16_t(msg, 16);
  534. }
  535. /**
  536. * @brief Get field throttle from high_latency message
  537. *
  538. * @return [%] throttle (percentage)
  539. */
  540. static inline int8_t mavlink_msg_high_latency_get_throttle(const mavlink_message_t* msg)
  541. {
  542. return _MAV_RETURN_int8_t(msg, 28);
  543. }
  544. /**
  545. * @brief Get field heading_sp from high_latency message
  546. *
  547. * @return [cdeg] heading setpoint
  548. */
  549. static inline int16_t mavlink_msg_high_latency_get_heading_sp(const mavlink_message_t* msg)
  550. {
  551. return _MAV_RETURN_int16_t(msg, 18);
  552. }
  553. /**
  554. * @brief Get field latitude from high_latency message
  555. *
  556. * @return [degE7] Latitude
  557. */
  558. static inline int32_t mavlink_msg_high_latency_get_latitude(const mavlink_message_t* msg)
  559. {
  560. return _MAV_RETURN_int32_t(msg, 4);
  561. }
  562. /**
  563. * @brief Get field longitude from high_latency message
  564. *
  565. * @return [degE7] Longitude
  566. */
  567. static inline int32_t mavlink_msg_high_latency_get_longitude(const mavlink_message_t* msg)
  568. {
  569. return _MAV_RETURN_int32_t(msg, 8);
  570. }
  571. /**
  572. * @brief Get field altitude_amsl from high_latency message
  573. *
  574. * @return [m] Altitude above mean sea level
  575. */
  576. static inline int16_t mavlink_msg_high_latency_get_altitude_amsl(const mavlink_message_t* msg)
  577. {
  578. return _MAV_RETURN_int16_t(msg, 20);
  579. }
  580. /**
  581. * @brief Get field altitude_sp from high_latency message
  582. *
  583. * @return [m] Altitude setpoint relative to the home position
  584. */
  585. static inline int16_t mavlink_msg_high_latency_get_altitude_sp(const mavlink_message_t* msg)
  586. {
  587. return _MAV_RETURN_int16_t(msg, 22);
  588. }
  589. /**
  590. * @brief Get field airspeed from high_latency message
  591. *
  592. * @return [m/s] airspeed
  593. */
  594. static inline uint8_t mavlink_msg_high_latency_get_airspeed(const mavlink_message_t* msg)
  595. {
  596. return _MAV_RETURN_uint8_t(msg, 29);
  597. }
  598. /**
  599. * @brief Get field airspeed_sp from high_latency message
  600. *
  601. * @return [m/s] airspeed setpoint
  602. */
  603. static inline uint8_t mavlink_msg_high_latency_get_airspeed_sp(const mavlink_message_t* msg)
  604. {
  605. return _MAV_RETURN_uint8_t(msg, 30);
  606. }
  607. /**
  608. * @brief Get field groundspeed from high_latency message
  609. *
  610. * @return [m/s] groundspeed
  611. */
  612. static inline uint8_t mavlink_msg_high_latency_get_groundspeed(const mavlink_message_t* msg)
  613. {
  614. return _MAV_RETURN_uint8_t(msg, 31);
  615. }
  616. /**
  617. * @brief Get field climb_rate from high_latency message
  618. *
  619. * @return [m/s] climb rate
  620. */
  621. static inline int8_t mavlink_msg_high_latency_get_climb_rate(const mavlink_message_t* msg)
  622. {
  623. return _MAV_RETURN_int8_t(msg, 32);
  624. }
  625. /**
  626. * @brief Get field gps_nsat from high_latency message
  627. *
  628. * @return Number of satellites visible. If unknown, set to 255
  629. */
  630. static inline uint8_t mavlink_msg_high_latency_get_gps_nsat(const mavlink_message_t* msg)
  631. {
  632. return _MAV_RETURN_uint8_t(msg, 33);
  633. }
  634. /**
  635. * @brief Get field gps_fix_type from high_latency message
  636. *
  637. * @return GPS Fix type.
  638. */
  639. static inline uint8_t mavlink_msg_high_latency_get_gps_fix_type(const mavlink_message_t* msg)
  640. {
  641. return _MAV_RETURN_uint8_t(msg, 34);
  642. }
  643. /**
  644. * @brief Get field battery_remaining from high_latency message
  645. *
  646. * @return [%] Remaining battery (percentage)
  647. */
  648. static inline uint8_t mavlink_msg_high_latency_get_battery_remaining(const mavlink_message_t* msg)
  649. {
  650. return _MAV_RETURN_uint8_t(msg, 35);
  651. }
  652. /**
  653. * @brief Get field temperature from high_latency message
  654. *
  655. * @return [degC] Autopilot temperature (degrees C)
  656. */
  657. static inline int8_t mavlink_msg_high_latency_get_temperature(const mavlink_message_t* msg)
  658. {
  659. return _MAV_RETURN_int8_t(msg, 36);
  660. }
  661. /**
  662. * @brief Get field temperature_air from high_latency message
  663. *
  664. * @return [degC] Air temperature (degrees C) from airspeed sensor
  665. */
  666. static inline int8_t mavlink_msg_high_latency_get_temperature_air(const mavlink_message_t* msg)
  667. {
  668. return _MAV_RETURN_int8_t(msg, 37);
  669. }
  670. /**
  671. * @brief Get field failsafe from high_latency message
  672. *
  673. * @return failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
  674. */
  675. static inline uint8_t mavlink_msg_high_latency_get_failsafe(const mavlink_message_t* msg)
  676. {
  677. return _MAV_RETURN_uint8_t(msg, 38);
  678. }
  679. /**
  680. * @brief Get field wp_num from high_latency message
  681. *
  682. * @return current waypoint number
  683. */
  684. static inline uint8_t mavlink_msg_high_latency_get_wp_num(const mavlink_message_t* msg)
  685. {
  686. return _MAV_RETURN_uint8_t(msg, 39);
  687. }
  688. /**
  689. * @brief Get field wp_distance from high_latency message
  690. *
  691. * @return [m] distance to target
  692. */
  693. static inline uint16_t mavlink_msg_high_latency_get_wp_distance(const mavlink_message_t* msg)
  694. {
  695. return _MAV_RETURN_uint16_t(msg, 24);
  696. }
  697. /**
  698. * @brief Decode a high_latency message into a struct
  699. *
  700. * @param msg The message to decode
  701. * @param high_latency C-struct to decode the message contents into
  702. */
  703. static inline void mavlink_msg_high_latency_decode(const mavlink_message_t* msg, mavlink_high_latency_t* high_latency)
  704. {
  705. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  706. high_latency->custom_mode = mavlink_msg_high_latency_get_custom_mode(msg);
  707. high_latency->latitude = mavlink_msg_high_latency_get_latitude(msg);
  708. high_latency->longitude = mavlink_msg_high_latency_get_longitude(msg);
  709. high_latency->roll = mavlink_msg_high_latency_get_roll(msg);
  710. high_latency->pitch = mavlink_msg_high_latency_get_pitch(msg);
  711. high_latency->heading = mavlink_msg_high_latency_get_heading(msg);
  712. high_latency->heading_sp = mavlink_msg_high_latency_get_heading_sp(msg);
  713. high_latency->altitude_amsl = mavlink_msg_high_latency_get_altitude_amsl(msg);
  714. high_latency->altitude_sp = mavlink_msg_high_latency_get_altitude_sp(msg);
  715. high_latency->wp_distance = mavlink_msg_high_latency_get_wp_distance(msg);
  716. high_latency->base_mode = mavlink_msg_high_latency_get_base_mode(msg);
  717. high_latency->landed_state = mavlink_msg_high_latency_get_landed_state(msg);
  718. high_latency->throttle = mavlink_msg_high_latency_get_throttle(msg);
  719. high_latency->airspeed = mavlink_msg_high_latency_get_airspeed(msg);
  720. high_latency->airspeed_sp = mavlink_msg_high_latency_get_airspeed_sp(msg);
  721. high_latency->groundspeed = mavlink_msg_high_latency_get_groundspeed(msg);
  722. high_latency->climb_rate = mavlink_msg_high_latency_get_climb_rate(msg);
  723. high_latency->gps_nsat = mavlink_msg_high_latency_get_gps_nsat(msg);
  724. high_latency->gps_fix_type = mavlink_msg_high_latency_get_gps_fix_type(msg);
  725. high_latency->battery_remaining = mavlink_msg_high_latency_get_battery_remaining(msg);
  726. high_latency->temperature = mavlink_msg_high_latency_get_temperature(msg);
  727. high_latency->temperature_air = mavlink_msg_high_latency_get_temperature_air(msg);
  728. high_latency->failsafe = mavlink_msg_high_latency_get_failsafe(msg);
  729. high_latency->wp_num = mavlink_msg_high_latency_get_wp_num(msg);
  730. #else
  731. uint8_t len = msg->len < MAVLINK_MSG_ID_HIGH_LATENCY_LEN? msg->len : MAVLINK_MSG_ID_HIGH_LATENCY_LEN;
  732. memset(high_latency, 0, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
  733. memcpy(high_latency, _MAV_PAYLOAD(msg), len);
  734. #endif
  735. }