mavlink_msg_high_latency2.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. #pragma once
  2. // MESSAGE HIGH_LATENCY2 PACKING
  3. #define MAVLINK_MSG_ID_HIGH_LATENCY2 235
  4. typedef struct __mavlink_high_latency2_t {
  5. uint32_t timestamp; /*< [ms] Timestamp (milliseconds since boot or Unix epoch)*/
  6. int32_t latitude; /*< [degE7] Latitude*/
  7. int32_t longitude; /*< [degE7] Longitude*/
  8. uint16_t custom_mode; /*< A bitfield for use for autopilot-specific flags (2 byte version).*/
  9. int16_t altitude; /*< [m] Altitude above mean sea level*/
  10. int16_t target_altitude; /*< [m] Altitude setpoint*/
  11. uint16_t target_distance; /*< [dam] Distance to target waypoint or position*/
  12. uint16_t wp_num; /*< Current waypoint number*/
  13. uint16_t failure_flags; /*< Bitmap of failure flags.*/
  14. uint8_t type; /*< Type of the MAV (quadrotor, helicopter, etc.)*/
  15. uint8_t autopilot; /*< Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.*/
  16. uint8_t heading; /*< [deg/2] Heading*/
  17. uint8_t target_heading; /*< [deg/2] Heading setpoint*/
  18. uint8_t throttle; /*< [%] Throttle*/
  19. uint8_t airspeed; /*< [m/s*5] Airspeed*/
  20. uint8_t airspeed_sp; /*< [m/s*5] Airspeed setpoint*/
  21. uint8_t groundspeed; /*< [m/s*5] Groundspeed*/
  22. uint8_t windspeed; /*< [m/s*5] Windspeed*/
  23. uint8_t wind_heading; /*< [deg/2] Wind heading*/
  24. uint8_t eph; /*< [dm] Maximum error horizontal position since last message*/
  25. uint8_t epv; /*< [dm] Maximum error vertical position since last message*/
  26. int8_t temperature_air; /*< [degC] Air temperature from airspeed sensor*/
  27. int8_t climb_rate; /*< [dm/s] Maximum climb rate magnitude since last message*/
  28. int8_t battery; /*< [%] Battery level (-1 if field not provided).*/
  29. int8_t custom0; /*< Field for custom payload.*/
  30. int8_t custom1; /*< Field for custom payload.*/
  31. int8_t custom2; /*< Field for custom payload.*/
  32. } mavlink_high_latency2_t;
  33. #define MAVLINK_MSG_ID_HIGH_LATENCY2_LEN 42
  34. #define MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN 42
  35. #define MAVLINK_MSG_ID_235_LEN 42
  36. #define MAVLINK_MSG_ID_235_MIN_LEN 42
  37. #define MAVLINK_MSG_ID_HIGH_LATENCY2_CRC 179
  38. #define MAVLINK_MSG_ID_235_CRC 179
  39. #if MAVLINK_COMMAND_24BIT
  40. #define MAVLINK_MESSAGE_INFO_HIGH_LATENCY2 { \
  41. 235, \
  42. "HIGH_LATENCY2", \
  43. 27, \
  44. { { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency2_t, timestamp) }, \
  45. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_high_latency2_t, type) }, \
  46. { "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_high_latency2_t, autopilot) }, \
  47. { "custom_mode", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_high_latency2_t, custom_mode) }, \
  48. { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency2_t, latitude) }, \
  49. { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency2_t, longitude) }, \
  50. { "altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency2_t, altitude) }, \
  51. { "target_altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_high_latency2_t, target_altitude) }, \
  52. { "heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency2_t, heading) }, \
  53. { "target_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency2_t, target_heading) }, \
  54. { "target_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_high_latency2_t, target_distance) }, \
  55. { "throttle", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_high_latency2_t, throttle) }, \
  56. { "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency2_t, airspeed) }, \
  57. { "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency2_t, airspeed_sp) }, \
  58. { "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency2_t, groundspeed) }, \
  59. { "windspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_high_latency2_t, windspeed) }, \
  60. { "wind_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency2_t, wind_heading) }, \
  61. { "eph", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency2_t, eph) }, \
  62. { "epv", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency2_t, epv) }, \
  63. { "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency2_t, temperature_air) }, \
  64. { "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency2_t, climb_rate) }, \
  65. { "battery", NULL, MAVLINK_TYPE_INT8_T, 0, 38, offsetof(mavlink_high_latency2_t, battery) }, \
  66. { "wp_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_high_latency2_t, wp_num) }, \
  67. { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_high_latency2_t, failure_flags) }, \
  68. { "custom0", NULL, MAVLINK_TYPE_INT8_T, 0, 39, offsetof(mavlink_high_latency2_t, custom0) }, \
  69. { "custom1", NULL, MAVLINK_TYPE_INT8_T, 0, 40, offsetof(mavlink_high_latency2_t, custom1) }, \
  70. { "custom2", NULL, MAVLINK_TYPE_INT8_T, 0, 41, offsetof(mavlink_high_latency2_t, custom2) }, \
  71. } \
  72. }
  73. #else
  74. #define MAVLINK_MESSAGE_INFO_HIGH_LATENCY2 { \
  75. "HIGH_LATENCY2", \
  76. 27, \
  77. { { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency2_t, timestamp) }, \
  78. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_high_latency2_t, type) }, \
  79. { "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_high_latency2_t, autopilot) }, \
  80. { "custom_mode", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_high_latency2_t, custom_mode) }, \
  81. { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency2_t, latitude) }, \
  82. { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency2_t, longitude) }, \
  83. { "altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency2_t, altitude) }, \
  84. { "target_altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_high_latency2_t, target_altitude) }, \
  85. { "heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency2_t, heading) }, \
  86. { "target_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency2_t, target_heading) }, \
  87. { "target_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_high_latency2_t, target_distance) }, \
  88. { "throttle", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_high_latency2_t, throttle) }, \
  89. { "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency2_t, airspeed) }, \
  90. { "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency2_t, airspeed_sp) }, \
  91. { "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency2_t, groundspeed) }, \
  92. { "windspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_high_latency2_t, windspeed) }, \
  93. { "wind_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency2_t, wind_heading) }, \
  94. { "eph", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency2_t, eph) }, \
  95. { "epv", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency2_t, epv) }, \
  96. { "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency2_t, temperature_air) }, \
  97. { "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency2_t, climb_rate) }, \
  98. { "battery", NULL, MAVLINK_TYPE_INT8_T, 0, 38, offsetof(mavlink_high_latency2_t, battery) }, \
  99. { "wp_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_high_latency2_t, wp_num) }, \
  100. { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_high_latency2_t, failure_flags) }, \
  101. { "custom0", NULL, MAVLINK_TYPE_INT8_T, 0, 39, offsetof(mavlink_high_latency2_t, custom0) }, \
  102. { "custom1", NULL, MAVLINK_TYPE_INT8_T, 0, 40, offsetof(mavlink_high_latency2_t, custom1) }, \
  103. { "custom2", NULL, MAVLINK_TYPE_INT8_T, 0, 41, offsetof(mavlink_high_latency2_t, custom2) }, \
  104. } \
  105. }
  106. #endif
  107. /**
  108. * @brief Pack a high_latency2 message
  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. *
  113. * @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
  114. * @param type Type of the MAV (quadrotor, helicopter, etc.)
  115. * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  116. * @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
  117. * @param latitude [degE7] Latitude
  118. * @param longitude [degE7] Longitude
  119. * @param altitude [m] Altitude above mean sea level
  120. * @param target_altitude [m] Altitude setpoint
  121. * @param heading [deg/2] Heading
  122. * @param target_heading [deg/2] Heading setpoint
  123. * @param target_distance [dam] Distance to target waypoint or position
  124. * @param throttle [%] Throttle
  125. * @param airspeed [m/s*5] Airspeed
  126. * @param airspeed_sp [m/s*5] Airspeed setpoint
  127. * @param groundspeed [m/s*5] Groundspeed
  128. * @param windspeed [m/s*5] Windspeed
  129. * @param wind_heading [deg/2] Wind heading
  130. * @param eph [dm] Maximum error horizontal position since last message
  131. * @param epv [dm] Maximum error vertical position since last message
  132. * @param temperature_air [degC] Air temperature from airspeed sensor
  133. * @param climb_rate [dm/s] Maximum climb rate magnitude since last message
  134. * @param battery [%] Battery level (-1 if field not provided).
  135. * @param wp_num Current waypoint number
  136. * @param failure_flags Bitmap of failure flags.
  137. * @param custom0 Field for custom payload.
  138. * @param custom1 Field for custom payload.
  139. * @param custom2 Field for custom payload.
  140. * @return length of the message in bytes (excluding serial stream start sign)
  141. */
  142. static inline uint16_t mavlink_msg_high_latency2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  143. uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
  144. {
  145. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  146. char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
  147. _mav_put_uint32_t(buf, 0, timestamp);
  148. _mav_put_int32_t(buf, 4, latitude);
  149. _mav_put_int32_t(buf, 8, longitude);
  150. _mav_put_uint16_t(buf, 12, custom_mode);
  151. _mav_put_int16_t(buf, 14, altitude);
  152. _mav_put_int16_t(buf, 16, target_altitude);
  153. _mav_put_uint16_t(buf, 18, target_distance);
  154. _mav_put_uint16_t(buf, 20, wp_num);
  155. _mav_put_uint16_t(buf, 22, failure_flags);
  156. _mav_put_uint8_t(buf, 24, type);
  157. _mav_put_uint8_t(buf, 25, autopilot);
  158. _mav_put_uint8_t(buf, 26, heading);
  159. _mav_put_uint8_t(buf, 27, target_heading);
  160. _mav_put_uint8_t(buf, 28, throttle);
  161. _mav_put_uint8_t(buf, 29, airspeed);
  162. _mav_put_uint8_t(buf, 30, airspeed_sp);
  163. _mav_put_uint8_t(buf, 31, groundspeed);
  164. _mav_put_uint8_t(buf, 32, windspeed);
  165. _mav_put_uint8_t(buf, 33, wind_heading);
  166. _mav_put_uint8_t(buf, 34, eph);
  167. _mav_put_uint8_t(buf, 35, epv);
  168. _mav_put_int8_t(buf, 36, temperature_air);
  169. _mav_put_int8_t(buf, 37, climb_rate);
  170. _mav_put_int8_t(buf, 38, battery);
  171. _mav_put_int8_t(buf, 39, custom0);
  172. _mav_put_int8_t(buf, 40, custom1);
  173. _mav_put_int8_t(buf, 41, custom2);
  174. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  175. #else
  176. mavlink_high_latency2_t packet;
  177. packet.timestamp = timestamp;
  178. packet.latitude = latitude;
  179. packet.longitude = longitude;
  180. packet.custom_mode = custom_mode;
  181. packet.altitude = altitude;
  182. packet.target_altitude = target_altitude;
  183. packet.target_distance = target_distance;
  184. packet.wp_num = wp_num;
  185. packet.failure_flags = failure_flags;
  186. packet.type = type;
  187. packet.autopilot = autopilot;
  188. packet.heading = heading;
  189. packet.target_heading = target_heading;
  190. packet.throttle = throttle;
  191. packet.airspeed = airspeed;
  192. packet.airspeed_sp = airspeed_sp;
  193. packet.groundspeed = groundspeed;
  194. packet.windspeed = windspeed;
  195. packet.wind_heading = wind_heading;
  196. packet.eph = eph;
  197. packet.epv = epv;
  198. packet.temperature_air = temperature_air;
  199. packet.climb_rate = climb_rate;
  200. packet.battery = battery;
  201. packet.custom0 = custom0;
  202. packet.custom1 = custom1;
  203. packet.custom2 = custom2;
  204. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  205. #endif
  206. msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY2;
  207. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  208. }
  209. /**
  210. * @brief Pack a high_latency2 message on a channel
  211. * @param system_id ID of this system
  212. * @param component_id ID of this component (e.g. 200 for IMU)
  213. * @param chan The MAVLink channel this message will be sent over
  214. * @param msg The MAVLink message to compress the data into
  215. * @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
  216. * @param type Type of the MAV (quadrotor, helicopter, etc.)
  217. * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  218. * @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
  219. * @param latitude [degE7] Latitude
  220. * @param longitude [degE7] Longitude
  221. * @param altitude [m] Altitude above mean sea level
  222. * @param target_altitude [m] Altitude setpoint
  223. * @param heading [deg/2] Heading
  224. * @param target_heading [deg/2] Heading setpoint
  225. * @param target_distance [dam] Distance to target waypoint or position
  226. * @param throttle [%] Throttle
  227. * @param airspeed [m/s*5] Airspeed
  228. * @param airspeed_sp [m/s*5] Airspeed setpoint
  229. * @param groundspeed [m/s*5] Groundspeed
  230. * @param windspeed [m/s*5] Windspeed
  231. * @param wind_heading [deg/2] Wind heading
  232. * @param eph [dm] Maximum error horizontal position since last message
  233. * @param epv [dm] Maximum error vertical position since last message
  234. * @param temperature_air [degC] Air temperature from airspeed sensor
  235. * @param climb_rate [dm/s] Maximum climb rate magnitude since last message
  236. * @param battery [%] Battery level (-1 if field not provided).
  237. * @param wp_num Current waypoint number
  238. * @param failure_flags Bitmap of failure flags.
  239. * @param custom0 Field for custom payload.
  240. * @param custom1 Field for custom payload.
  241. * @param custom2 Field for custom payload.
  242. * @return length of the message in bytes (excluding serial stream start sign)
  243. */
  244. static inline uint16_t mavlink_msg_high_latency2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  245. mavlink_message_t* msg,
  246. uint32_t timestamp,uint8_t type,uint8_t autopilot,uint16_t custom_mode,int32_t latitude,int32_t longitude,int16_t altitude,int16_t target_altitude,uint8_t heading,uint8_t target_heading,uint16_t target_distance,uint8_t throttle,uint8_t airspeed,uint8_t airspeed_sp,uint8_t groundspeed,uint8_t windspeed,uint8_t wind_heading,uint8_t eph,uint8_t epv,int8_t temperature_air,int8_t climb_rate,int8_t battery,uint16_t wp_num,uint16_t failure_flags,int8_t custom0,int8_t custom1,int8_t custom2)
  247. {
  248. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  249. char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
  250. _mav_put_uint32_t(buf, 0, timestamp);
  251. _mav_put_int32_t(buf, 4, latitude);
  252. _mav_put_int32_t(buf, 8, longitude);
  253. _mav_put_uint16_t(buf, 12, custom_mode);
  254. _mav_put_int16_t(buf, 14, altitude);
  255. _mav_put_int16_t(buf, 16, target_altitude);
  256. _mav_put_uint16_t(buf, 18, target_distance);
  257. _mav_put_uint16_t(buf, 20, wp_num);
  258. _mav_put_uint16_t(buf, 22, failure_flags);
  259. _mav_put_uint8_t(buf, 24, type);
  260. _mav_put_uint8_t(buf, 25, autopilot);
  261. _mav_put_uint8_t(buf, 26, heading);
  262. _mav_put_uint8_t(buf, 27, target_heading);
  263. _mav_put_uint8_t(buf, 28, throttle);
  264. _mav_put_uint8_t(buf, 29, airspeed);
  265. _mav_put_uint8_t(buf, 30, airspeed_sp);
  266. _mav_put_uint8_t(buf, 31, groundspeed);
  267. _mav_put_uint8_t(buf, 32, windspeed);
  268. _mav_put_uint8_t(buf, 33, wind_heading);
  269. _mav_put_uint8_t(buf, 34, eph);
  270. _mav_put_uint8_t(buf, 35, epv);
  271. _mav_put_int8_t(buf, 36, temperature_air);
  272. _mav_put_int8_t(buf, 37, climb_rate);
  273. _mav_put_int8_t(buf, 38, battery);
  274. _mav_put_int8_t(buf, 39, custom0);
  275. _mav_put_int8_t(buf, 40, custom1);
  276. _mav_put_int8_t(buf, 41, custom2);
  277. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  278. #else
  279. mavlink_high_latency2_t packet;
  280. packet.timestamp = timestamp;
  281. packet.latitude = latitude;
  282. packet.longitude = longitude;
  283. packet.custom_mode = custom_mode;
  284. packet.altitude = altitude;
  285. packet.target_altitude = target_altitude;
  286. packet.target_distance = target_distance;
  287. packet.wp_num = wp_num;
  288. packet.failure_flags = failure_flags;
  289. packet.type = type;
  290. packet.autopilot = autopilot;
  291. packet.heading = heading;
  292. packet.target_heading = target_heading;
  293. packet.throttle = throttle;
  294. packet.airspeed = airspeed;
  295. packet.airspeed_sp = airspeed_sp;
  296. packet.groundspeed = groundspeed;
  297. packet.windspeed = windspeed;
  298. packet.wind_heading = wind_heading;
  299. packet.eph = eph;
  300. packet.epv = epv;
  301. packet.temperature_air = temperature_air;
  302. packet.climb_rate = climb_rate;
  303. packet.battery = battery;
  304. packet.custom0 = custom0;
  305. packet.custom1 = custom1;
  306. packet.custom2 = custom2;
  307. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  308. #endif
  309. msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY2;
  310. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  311. }
  312. /**
  313. * @brief Encode a high_latency2 struct
  314. *
  315. * @param system_id ID of this system
  316. * @param component_id ID of this component (e.g. 200 for IMU)
  317. * @param msg The MAVLink message to compress the data into
  318. * @param high_latency2 C-struct to read the message contents from
  319. */
  320. static inline uint16_t mavlink_msg_high_latency2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_high_latency2_t* high_latency2)
  321. {
  322. return mavlink_msg_high_latency2_pack(system_id, component_id, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
  323. }
  324. /**
  325. * @brief Encode a high_latency2 struct on a channel
  326. *
  327. * @param system_id ID of this system
  328. * @param component_id ID of this component (e.g. 200 for IMU)
  329. * @param chan The MAVLink channel this message will be sent over
  330. * @param msg The MAVLink message to compress the data into
  331. * @param high_latency2 C-struct to read the message contents from
  332. */
  333. static inline uint16_t mavlink_msg_high_latency2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_high_latency2_t* high_latency2)
  334. {
  335. return mavlink_msg_high_latency2_pack_chan(system_id, component_id, chan, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
  336. }
  337. /**
  338. * @brief Send a high_latency2 message
  339. * @param chan MAVLink channel to send the message
  340. *
  341. * @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
  342. * @param type Type of the MAV (quadrotor, helicopter, etc.)
  343. * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  344. * @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
  345. * @param latitude [degE7] Latitude
  346. * @param longitude [degE7] Longitude
  347. * @param altitude [m] Altitude above mean sea level
  348. * @param target_altitude [m] Altitude setpoint
  349. * @param heading [deg/2] Heading
  350. * @param target_heading [deg/2] Heading setpoint
  351. * @param target_distance [dam] Distance to target waypoint or position
  352. * @param throttle [%] Throttle
  353. * @param airspeed [m/s*5] Airspeed
  354. * @param airspeed_sp [m/s*5] Airspeed setpoint
  355. * @param groundspeed [m/s*5] Groundspeed
  356. * @param windspeed [m/s*5] Windspeed
  357. * @param wind_heading [deg/2] Wind heading
  358. * @param eph [dm] Maximum error horizontal position since last message
  359. * @param epv [dm] Maximum error vertical position since last message
  360. * @param temperature_air [degC] Air temperature from airspeed sensor
  361. * @param climb_rate [dm/s] Maximum climb rate magnitude since last message
  362. * @param battery [%] Battery level (-1 if field not provided).
  363. * @param wp_num Current waypoint number
  364. * @param failure_flags Bitmap of failure flags.
  365. * @param custom0 Field for custom payload.
  366. * @param custom1 Field for custom payload.
  367. * @param custom2 Field for custom payload.
  368. */
  369. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  370. static inline void mavlink_msg_high_latency2_send(mavlink_channel_t chan, uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
  371. {
  372. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  373. char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
  374. _mav_put_uint32_t(buf, 0, timestamp);
  375. _mav_put_int32_t(buf, 4, latitude);
  376. _mav_put_int32_t(buf, 8, longitude);
  377. _mav_put_uint16_t(buf, 12, custom_mode);
  378. _mav_put_int16_t(buf, 14, altitude);
  379. _mav_put_int16_t(buf, 16, target_altitude);
  380. _mav_put_uint16_t(buf, 18, target_distance);
  381. _mav_put_uint16_t(buf, 20, wp_num);
  382. _mav_put_uint16_t(buf, 22, failure_flags);
  383. _mav_put_uint8_t(buf, 24, type);
  384. _mav_put_uint8_t(buf, 25, autopilot);
  385. _mav_put_uint8_t(buf, 26, heading);
  386. _mav_put_uint8_t(buf, 27, target_heading);
  387. _mav_put_uint8_t(buf, 28, throttle);
  388. _mav_put_uint8_t(buf, 29, airspeed);
  389. _mav_put_uint8_t(buf, 30, airspeed_sp);
  390. _mav_put_uint8_t(buf, 31, groundspeed);
  391. _mav_put_uint8_t(buf, 32, windspeed);
  392. _mav_put_uint8_t(buf, 33, wind_heading);
  393. _mav_put_uint8_t(buf, 34, eph);
  394. _mav_put_uint8_t(buf, 35, epv);
  395. _mav_put_int8_t(buf, 36, temperature_air);
  396. _mav_put_int8_t(buf, 37, climb_rate);
  397. _mav_put_int8_t(buf, 38, battery);
  398. _mav_put_int8_t(buf, 39, custom0);
  399. _mav_put_int8_t(buf, 40, custom1);
  400. _mav_put_int8_t(buf, 41, custom2);
  401. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, buf, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  402. #else
  403. mavlink_high_latency2_t packet;
  404. packet.timestamp = timestamp;
  405. packet.latitude = latitude;
  406. packet.longitude = longitude;
  407. packet.custom_mode = custom_mode;
  408. packet.altitude = altitude;
  409. packet.target_altitude = target_altitude;
  410. packet.target_distance = target_distance;
  411. packet.wp_num = wp_num;
  412. packet.failure_flags = failure_flags;
  413. packet.type = type;
  414. packet.autopilot = autopilot;
  415. packet.heading = heading;
  416. packet.target_heading = target_heading;
  417. packet.throttle = throttle;
  418. packet.airspeed = airspeed;
  419. packet.airspeed_sp = airspeed_sp;
  420. packet.groundspeed = groundspeed;
  421. packet.windspeed = windspeed;
  422. packet.wind_heading = wind_heading;
  423. packet.eph = eph;
  424. packet.epv = epv;
  425. packet.temperature_air = temperature_air;
  426. packet.climb_rate = climb_rate;
  427. packet.battery = battery;
  428. packet.custom0 = custom0;
  429. packet.custom1 = custom1;
  430. packet.custom2 = custom2;
  431. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char *)&packet, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  432. #endif
  433. }
  434. /**
  435. * @brief Send a high_latency2 message
  436. * @param chan MAVLink channel to send the message
  437. * @param struct The MAVLink struct to serialize
  438. */
  439. static inline void mavlink_msg_high_latency2_send_struct(mavlink_channel_t chan, const mavlink_high_latency2_t* high_latency2)
  440. {
  441. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  442. mavlink_msg_high_latency2_send(chan, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
  443. #else
  444. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char *)high_latency2, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  445. #endif
  446. }
  447. #if MAVLINK_MSG_ID_HIGH_LATENCY2_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  448. /*
  449. This variant of _send() can be used to save stack space by re-using
  450. memory from the receive buffer. The caller provides a
  451. mavlink_message_t which is the size of a full mavlink message. This
  452. is usually the receive buffer for the channel, and allows a reply to an
  453. incoming message with minimum stack space usage.
  454. */
  455. static inline void mavlink_msg_high_latency2_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
  456. {
  457. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  458. char *buf = (char *)msgbuf;
  459. _mav_put_uint32_t(buf, 0, timestamp);
  460. _mav_put_int32_t(buf, 4, latitude);
  461. _mav_put_int32_t(buf, 8, longitude);
  462. _mav_put_uint16_t(buf, 12, custom_mode);
  463. _mav_put_int16_t(buf, 14, altitude);
  464. _mav_put_int16_t(buf, 16, target_altitude);
  465. _mav_put_uint16_t(buf, 18, target_distance);
  466. _mav_put_uint16_t(buf, 20, wp_num);
  467. _mav_put_uint16_t(buf, 22, failure_flags);
  468. _mav_put_uint8_t(buf, 24, type);
  469. _mav_put_uint8_t(buf, 25, autopilot);
  470. _mav_put_uint8_t(buf, 26, heading);
  471. _mav_put_uint8_t(buf, 27, target_heading);
  472. _mav_put_uint8_t(buf, 28, throttle);
  473. _mav_put_uint8_t(buf, 29, airspeed);
  474. _mav_put_uint8_t(buf, 30, airspeed_sp);
  475. _mav_put_uint8_t(buf, 31, groundspeed);
  476. _mav_put_uint8_t(buf, 32, windspeed);
  477. _mav_put_uint8_t(buf, 33, wind_heading);
  478. _mav_put_uint8_t(buf, 34, eph);
  479. _mav_put_uint8_t(buf, 35, epv);
  480. _mav_put_int8_t(buf, 36, temperature_air);
  481. _mav_put_int8_t(buf, 37, climb_rate);
  482. _mav_put_int8_t(buf, 38, battery);
  483. _mav_put_int8_t(buf, 39, custom0);
  484. _mav_put_int8_t(buf, 40, custom1);
  485. _mav_put_int8_t(buf, 41, custom2);
  486. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, buf, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  487. #else
  488. mavlink_high_latency2_t *packet = (mavlink_high_latency2_t *)msgbuf;
  489. packet->timestamp = timestamp;
  490. packet->latitude = latitude;
  491. packet->longitude = longitude;
  492. packet->custom_mode = custom_mode;
  493. packet->altitude = altitude;
  494. packet->target_altitude = target_altitude;
  495. packet->target_distance = target_distance;
  496. packet->wp_num = wp_num;
  497. packet->failure_flags = failure_flags;
  498. packet->type = type;
  499. packet->autopilot = autopilot;
  500. packet->heading = heading;
  501. packet->target_heading = target_heading;
  502. packet->throttle = throttle;
  503. packet->airspeed = airspeed;
  504. packet->airspeed_sp = airspeed_sp;
  505. packet->groundspeed = groundspeed;
  506. packet->windspeed = windspeed;
  507. packet->wind_heading = wind_heading;
  508. packet->eph = eph;
  509. packet->epv = epv;
  510. packet->temperature_air = temperature_air;
  511. packet->climb_rate = climb_rate;
  512. packet->battery = battery;
  513. packet->custom0 = custom0;
  514. packet->custom1 = custom1;
  515. packet->custom2 = custom2;
  516. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char *)packet, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  517. #endif
  518. }
  519. #endif
  520. #endif
  521. // MESSAGE HIGH_LATENCY2 UNPACKING
  522. /**
  523. * @brief Get field timestamp from high_latency2 message
  524. *
  525. * @return [ms] Timestamp (milliseconds since boot or Unix epoch)
  526. */
  527. static inline uint32_t mavlink_msg_high_latency2_get_timestamp(const mavlink_message_t* msg)
  528. {
  529. return _MAV_RETURN_uint32_t(msg, 0);
  530. }
  531. /**
  532. * @brief Get field type from high_latency2 message
  533. *
  534. * @return Type of the MAV (quadrotor, helicopter, etc.)
  535. */
  536. static inline uint8_t mavlink_msg_high_latency2_get_type(const mavlink_message_t* msg)
  537. {
  538. return _MAV_RETURN_uint8_t(msg, 24);
  539. }
  540. /**
  541. * @brief Get field autopilot from high_latency2 message
  542. *
  543. * @return Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  544. */
  545. static inline uint8_t mavlink_msg_high_latency2_get_autopilot(const mavlink_message_t* msg)
  546. {
  547. return _MAV_RETURN_uint8_t(msg, 25);
  548. }
  549. /**
  550. * @brief Get field custom_mode from high_latency2 message
  551. *
  552. * @return A bitfield for use for autopilot-specific flags (2 byte version).
  553. */
  554. static inline uint16_t mavlink_msg_high_latency2_get_custom_mode(const mavlink_message_t* msg)
  555. {
  556. return _MAV_RETURN_uint16_t(msg, 12);
  557. }
  558. /**
  559. * @brief Get field latitude from high_latency2 message
  560. *
  561. * @return [degE7] Latitude
  562. */
  563. static inline int32_t mavlink_msg_high_latency2_get_latitude(const mavlink_message_t* msg)
  564. {
  565. return _MAV_RETURN_int32_t(msg, 4);
  566. }
  567. /**
  568. * @brief Get field longitude from high_latency2 message
  569. *
  570. * @return [degE7] Longitude
  571. */
  572. static inline int32_t mavlink_msg_high_latency2_get_longitude(const mavlink_message_t* msg)
  573. {
  574. return _MAV_RETURN_int32_t(msg, 8);
  575. }
  576. /**
  577. * @brief Get field altitude from high_latency2 message
  578. *
  579. * @return [m] Altitude above mean sea level
  580. */
  581. static inline int16_t mavlink_msg_high_latency2_get_altitude(const mavlink_message_t* msg)
  582. {
  583. return _MAV_RETURN_int16_t(msg, 14);
  584. }
  585. /**
  586. * @brief Get field target_altitude from high_latency2 message
  587. *
  588. * @return [m] Altitude setpoint
  589. */
  590. static inline int16_t mavlink_msg_high_latency2_get_target_altitude(const mavlink_message_t* msg)
  591. {
  592. return _MAV_RETURN_int16_t(msg, 16);
  593. }
  594. /**
  595. * @brief Get field heading from high_latency2 message
  596. *
  597. * @return [deg/2] Heading
  598. */
  599. static inline uint8_t mavlink_msg_high_latency2_get_heading(const mavlink_message_t* msg)
  600. {
  601. return _MAV_RETURN_uint8_t(msg, 26);
  602. }
  603. /**
  604. * @brief Get field target_heading from high_latency2 message
  605. *
  606. * @return [deg/2] Heading setpoint
  607. */
  608. static inline uint8_t mavlink_msg_high_latency2_get_target_heading(const mavlink_message_t* msg)
  609. {
  610. return _MAV_RETURN_uint8_t(msg, 27);
  611. }
  612. /**
  613. * @brief Get field target_distance from high_latency2 message
  614. *
  615. * @return [dam] Distance to target waypoint or position
  616. */
  617. static inline uint16_t mavlink_msg_high_latency2_get_target_distance(const mavlink_message_t* msg)
  618. {
  619. return _MAV_RETURN_uint16_t(msg, 18);
  620. }
  621. /**
  622. * @brief Get field throttle from high_latency2 message
  623. *
  624. * @return [%] Throttle
  625. */
  626. static inline uint8_t mavlink_msg_high_latency2_get_throttle(const mavlink_message_t* msg)
  627. {
  628. return _MAV_RETURN_uint8_t(msg, 28);
  629. }
  630. /**
  631. * @brief Get field airspeed from high_latency2 message
  632. *
  633. * @return [m/s*5] Airspeed
  634. */
  635. static inline uint8_t mavlink_msg_high_latency2_get_airspeed(const mavlink_message_t* msg)
  636. {
  637. return _MAV_RETURN_uint8_t(msg, 29);
  638. }
  639. /**
  640. * @brief Get field airspeed_sp from high_latency2 message
  641. *
  642. * @return [m/s*5] Airspeed setpoint
  643. */
  644. static inline uint8_t mavlink_msg_high_latency2_get_airspeed_sp(const mavlink_message_t* msg)
  645. {
  646. return _MAV_RETURN_uint8_t(msg, 30);
  647. }
  648. /**
  649. * @brief Get field groundspeed from high_latency2 message
  650. *
  651. * @return [m/s*5] Groundspeed
  652. */
  653. static inline uint8_t mavlink_msg_high_latency2_get_groundspeed(const mavlink_message_t* msg)
  654. {
  655. return _MAV_RETURN_uint8_t(msg, 31);
  656. }
  657. /**
  658. * @brief Get field windspeed from high_latency2 message
  659. *
  660. * @return [m/s*5] Windspeed
  661. */
  662. static inline uint8_t mavlink_msg_high_latency2_get_windspeed(const mavlink_message_t* msg)
  663. {
  664. return _MAV_RETURN_uint8_t(msg, 32);
  665. }
  666. /**
  667. * @brief Get field wind_heading from high_latency2 message
  668. *
  669. * @return [deg/2] Wind heading
  670. */
  671. static inline uint8_t mavlink_msg_high_latency2_get_wind_heading(const mavlink_message_t* msg)
  672. {
  673. return _MAV_RETURN_uint8_t(msg, 33);
  674. }
  675. /**
  676. * @brief Get field eph from high_latency2 message
  677. *
  678. * @return [dm] Maximum error horizontal position since last message
  679. */
  680. static inline uint8_t mavlink_msg_high_latency2_get_eph(const mavlink_message_t* msg)
  681. {
  682. return _MAV_RETURN_uint8_t(msg, 34);
  683. }
  684. /**
  685. * @brief Get field epv from high_latency2 message
  686. *
  687. * @return [dm] Maximum error vertical position since last message
  688. */
  689. static inline uint8_t mavlink_msg_high_latency2_get_epv(const mavlink_message_t* msg)
  690. {
  691. return _MAV_RETURN_uint8_t(msg, 35);
  692. }
  693. /**
  694. * @brief Get field temperature_air from high_latency2 message
  695. *
  696. * @return [degC] Air temperature from airspeed sensor
  697. */
  698. static inline int8_t mavlink_msg_high_latency2_get_temperature_air(const mavlink_message_t* msg)
  699. {
  700. return _MAV_RETURN_int8_t(msg, 36);
  701. }
  702. /**
  703. * @brief Get field climb_rate from high_latency2 message
  704. *
  705. * @return [dm/s] Maximum climb rate magnitude since last message
  706. */
  707. static inline int8_t mavlink_msg_high_latency2_get_climb_rate(const mavlink_message_t* msg)
  708. {
  709. return _MAV_RETURN_int8_t(msg, 37);
  710. }
  711. /**
  712. * @brief Get field battery from high_latency2 message
  713. *
  714. * @return [%] Battery level (-1 if field not provided).
  715. */
  716. static inline int8_t mavlink_msg_high_latency2_get_battery(const mavlink_message_t* msg)
  717. {
  718. return _MAV_RETURN_int8_t(msg, 38);
  719. }
  720. /**
  721. * @brief Get field wp_num from high_latency2 message
  722. *
  723. * @return Current waypoint number
  724. */
  725. static inline uint16_t mavlink_msg_high_latency2_get_wp_num(const mavlink_message_t* msg)
  726. {
  727. return _MAV_RETURN_uint16_t(msg, 20);
  728. }
  729. /**
  730. * @brief Get field failure_flags from high_latency2 message
  731. *
  732. * @return Bitmap of failure flags.
  733. */
  734. static inline uint16_t mavlink_msg_high_latency2_get_failure_flags(const mavlink_message_t* msg)
  735. {
  736. return _MAV_RETURN_uint16_t(msg, 22);
  737. }
  738. /**
  739. * @brief Get field custom0 from high_latency2 message
  740. *
  741. * @return Field for custom payload.
  742. */
  743. static inline int8_t mavlink_msg_high_latency2_get_custom0(const mavlink_message_t* msg)
  744. {
  745. return _MAV_RETURN_int8_t(msg, 39);
  746. }
  747. /**
  748. * @brief Get field custom1 from high_latency2 message
  749. *
  750. * @return Field for custom payload.
  751. */
  752. static inline int8_t mavlink_msg_high_latency2_get_custom1(const mavlink_message_t* msg)
  753. {
  754. return _MAV_RETURN_int8_t(msg, 40);
  755. }
  756. /**
  757. * @brief Get field custom2 from high_latency2 message
  758. *
  759. * @return Field for custom payload.
  760. */
  761. static inline int8_t mavlink_msg_high_latency2_get_custom2(const mavlink_message_t* msg)
  762. {
  763. return _MAV_RETURN_int8_t(msg, 41);
  764. }
  765. /**
  766. * @brief Decode a high_latency2 message into a struct
  767. *
  768. * @param msg The message to decode
  769. * @param high_latency2 C-struct to decode the message contents into
  770. */
  771. static inline void mavlink_msg_high_latency2_decode(const mavlink_message_t* msg, mavlink_high_latency2_t* high_latency2)
  772. {
  773. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  774. high_latency2->timestamp = mavlink_msg_high_latency2_get_timestamp(msg);
  775. high_latency2->latitude = mavlink_msg_high_latency2_get_latitude(msg);
  776. high_latency2->longitude = mavlink_msg_high_latency2_get_longitude(msg);
  777. high_latency2->custom_mode = mavlink_msg_high_latency2_get_custom_mode(msg);
  778. high_latency2->altitude = mavlink_msg_high_latency2_get_altitude(msg);
  779. high_latency2->target_altitude = mavlink_msg_high_latency2_get_target_altitude(msg);
  780. high_latency2->target_distance = mavlink_msg_high_latency2_get_target_distance(msg);
  781. high_latency2->wp_num = mavlink_msg_high_latency2_get_wp_num(msg);
  782. high_latency2->failure_flags = mavlink_msg_high_latency2_get_failure_flags(msg);
  783. high_latency2->type = mavlink_msg_high_latency2_get_type(msg);
  784. high_latency2->autopilot = mavlink_msg_high_latency2_get_autopilot(msg);
  785. high_latency2->heading = mavlink_msg_high_latency2_get_heading(msg);
  786. high_latency2->target_heading = mavlink_msg_high_latency2_get_target_heading(msg);
  787. high_latency2->throttle = mavlink_msg_high_latency2_get_throttle(msg);
  788. high_latency2->airspeed = mavlink_msg_high_latency2_get_airspeed(msg);
  789. high_latency2->airspeed_sp = mavlink_msg_high_latency2_get_airspeed_sp(msg);
  790. high_latency2->groundspeed = mavlink_msg_high_latency2_get_groundspeed(msg);
  791. high_latency2->windspeed = mavlink_msg_high_latency2_get_windspeed(msg);
  792. high_latency2->wind_heading = mavlink_msg_high_latency2_get_wind_heading(msg);
  793. high_latency2->eph = mavlink_msg_high_latency2_get_eph(msg);
  794. high_latency2->epv = mavlink_msg_high_latency2_get_epv(msg);
  795. high_latency2->temperature_air = mavlink_msg_high_latency2_get_temperature_air(msg);
  796. high_latency2->climb_rate = mavlink_msg_high_latency2_get_climb_rate(msg);
  797. high_latency2->battery = mavlink_msg_high_latency2_get_battery(msg);
  798. high_latency2->custom0 = mavlink_msg_high_latency2_get_custom0(msg);
  799. high_latency2->custom1 = mavlink_msg_high_latency2_get_custom1(msg);
  800. high_latency2->custom2 = mavlink_msg_high_latency2_get_custom2(msg);
  801. #else
  802. uint8_t len = msg->len < MAVLINK_MSG_ID_HIGH_LATENCY2_LEN? msg->len : MAVLINK_MSG_ID_HIGH_LATENCY2_LEN;
  803. memset(high_latency2, 0, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  804. memcpy(high_latency2, _MAV_PAYLOAD(msg), len);
  805. #endif
  806. }