mavlink_msg_esc_info.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. #pragma once
  2. // MESSAGE ESC_INFO PACKING
  3. #define MAVLINK_MSG_ID_ESC_INFO 290
  4. typedef struct __mavlink_esc_info_t {
  5. uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.*/
  6. uint32_t error_count[4]; /*< Number of reported errors by each ESC since boot.*/
  7. uint16_t counter; /*< Counter of data packets received.*/
  8. uint16_t failure_flags[4]; /*< Bitmap of ESC failure flags.*/
  9. int16_t temperature[4]; /*< [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.*/
  10. uint8_t index; /*< Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4.*/
  11. uint8_t count; /*< Total number of ESCs in all messages of this type. Message fields with an index higher than this should be ignored because they contain invalid data.*/
  12. uint8_t connection_type; /*< Connection type protocol for all ESC.*/
  13. uint8_t info; /*< Information regarding online/offline status of each ESC.*/
  14. } mavlink_esc_info_t;
  15. #define MAVLINK_MSG_ID_ESC_INFO_LEN 46
  16. #define MAVLINK_MSG_ID_ESC_INFO_MIN_LEN 46
  17. #define MAVLINK_MSG_ID_290_LEN 46
  18. #define MAVLINK_MSG_ID_290_MIN_LEN 46
  19. #define MAVLINK_MSG_ID_ESC_INFO_CRC 251
  20. #define MAVLINK_MSG_ID_290_CRC 251
  21. #define MAVLINK_MSG_ESC_INFO_FIELD_ERROR_COUNT_LEN 4
  22. #define MAVLINK_MSG_ESC_INFO_FIELD_FAILURE_FLAGS_LEN 4
  23. #define MAVLINK_MSG_ESC_INFO_FIELD_TEMPERATURE_LEN 4
  24. #if MAVLINK_COMMAND_24BIT
  25. #define MAVLINK_MESSAGE_INFO_ESC_INFO { \
  26. 290, \
  27. "ESC_INFO", \
  28. 9, \
  29. { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_esc_info_t, index) }, \
  30. { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_esc_info_t, time_usec) }, \
  31. { "counter", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_esc_info_t, counter) }, \
  32. { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_esc_info_t, count) }, \
  33. { "connection_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_esc_info_t, connection_type) }, \
  34. { "info", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_esc_info_t, info) }, \
  35. { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 4, 26, offsetof(mavlink_esc_info_t, failure_flags) }, \
  36. { "error_count", NULL, MAVLINK_TYPE_UINT32_T, 4, 8, offsetof(mavlink_esc_info_t, error_count) }, \
  37. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 4, 34, offsetof(mavlink_esc_info_t, temperature) }, \
  38. } \
  39. }
  40. #else
  41. #define MAVLINK_MESSAGE_INFO_ESC_INFO { \
  42. "ESC_INFO", \
  43. 9, \
  44. { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_esc_info_t, index) }, \
  45. { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_esc_info_t, time_usec) }, \
  46. { "counter", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_esc_info_t, counter) }, \
  47. { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_esc_info_t, count) }, \
  48. { "connection_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_esc_info_t, connection_type) }, \
  49. { "info", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_esc_info_t, info) }, \
  50. { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 4, 26, offsetof(mavlink_esc_info_t, failure_flags) }, \
  51. { "error_count", NULL, MAVLINK_TYPE_UINT32_T, 4, 8, offsetof(mavlink_esc_info_t, error_count) }, \
  52. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 4, 34, offsetof(mavlink_esc_info_t, temperature) }, \
  53. } \
  54. }
  55. #endif
  56. /**
  57. * @brief Pack a esc_info message
  58. * @param system_id ID of this system
  59. * @param component_id ID of this component (e.g. 200 for IMU)
  60. * @param msg The MAVLink message to compress the data into
  61. *
  62. * @param index Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4.
  63. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  64. * @param counter Counter of data packets received.
  65. * @param count Total number of ESCs in all messages of this type. Message fields with an index higher than this should be ignored because they contain invalid data.
  66. * @param connection_type Connection type protocol for all ESC.
  67. * @param info Information regarding online/offline status of each ESC.
  68. * @param failure_flags Bitmap of ESC failure flags.
  69. * @param error_count Number of reported errors by each ESC since boot.
  70. * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
  71. * @return length of the message in bytes (excluding serial stream start sign)
  72. */
  73. static inline uint16_t mavlink_msg_esc_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  74. uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const int16_t *temperature)
  75. {
  76. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  77. char buf[MAVLINK_MSG_ID_ESC_INFO_LEN];
  78. _mav_put_uint64_t(buf, 0, time_usec);
  79. _mav_put_uint16_t(buf, 24, counter);
  80. _mav_put_uint8_t(buf, 42, index);
  81. _mav_put_uint8_t(buf, 43, count);
  82. _mav_put_uint8_t(buf, 44, connection_type);
  83. _mav_put_uint8_t(buf, 45, info);
  84. _mav_put_uint32_t_array(buf, 8, error_count, 4);
  85. _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
  86. _mav_put_int16_t_array(buf, 34, temperature, 4);
  87. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_INFO_LEN);
  88. #else
  89. mavlink_esc_info_t packet;
  90. packet.time_usec = time_usec;
  91. packet.counter = counter;
  92. packet.index = index;
  93. packet.count = count;
  94. packet.connection_type = connection_type;
  95. packet.info = info;
  96. mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4);
  97. mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4);
  98. mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
  99. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_INFO_LEN);
  100. #endif
  101. msg->msgid = MAVLINK_MSG_ID_ESC_INFO;
  102. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC);
  103. }
  104. /**
  105. * @brief Pack a esc_info message on a channel
  106. * @param system_id ID of this system
  107. * @param component_id ID of this component (e.g. 200 for IMU)
  108. * @param chan The MAVLink channel this message will be sent over
  109. * @param msg The MAVLink message to compress the data into
  110. * @param index Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4.
  111. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  112. * @param counter Counter of data packets received.
  113. * @param count Total number of ESCs in all messages of this type. Message fields with an index higher than this should be ignored because they contain invalid data.
  114. * @param connection_type Connection type protocol for all ESC.
  115. * @param info Information regarding online/offline status of each ESC.
  116. * @param failure_flags Bitmap of ESC failure flags.
  117. * @param error_count Number of reported errors by each ESC since boot.
  118. * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
  119. * @return length of the message in bytes (excluding serial stream start sign)
  120. */
  121. static inline uint16_t mavlink_msg_esc_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  122. mavlink_message_t* msg,
  123. uint8_t index,uint64_t time_usec,uint16_t counter,uint8_t count,uint8_t connection_type,uint8_t info,const uint16_t *failure_flags,const uint32_t *error_count,const int16_t *temperature)
  124. {
  125. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  126. char buf[MAVLINK_MSG_ID_ESC_INFO_LEN];
  127. _mav_put_uint64_t(buf, 0, time_usec);
  128. _mav_put_uint16_t(buf, 24, counter);
  129. _mav_put_uint8_t(buf, 42, index);
  130. _mav_put_uint8_t(buf, 43, count);
  131. _mav_put_uint8_t(buf, 44, connection_type);
  132. _mav_put_uint8_t(buf, 45, info);
  133. _mav_put_uint32_t_array(buf, 8, error_count, 4);
  134. _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
  135. _mav_put_int16_t_array(buf, 34, temperature, 4);
  136. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_INFO_LEN);
  137. #else
  138. mavlink_esc_info_t packet;
  139. packet.time_usec = time_usec;
  140. packet.counter = counter;
  141. packet.index = index;
  142. packet.count = count;
  143. packet.connection_type = connection_type;
  144. packet.info = info;
  145. mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4);
  146. mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4);
  147. mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
  148. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_INFO_LEN);
  149. #endif
  150. msg->msgid = MAVLINK_MSG_ID_ESC_INFO;
  151. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC);
  152. }
  153. /**
  154. * @brief Encode a esc_info struct
  155. *
  156. * @param system_id ID of this system
  157. * @param component_id ID of this component (e.g. 200 for IMU)
  158. * @param msg The MAVLink message to compress the data into
  159. * @param esc_info C-struct to read the message contents from
  160. */
  161. static inline uint16_t mavlink_msg_esc_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_esc_info_t* esc_info)
  162. {
  163. return mavlink_msg_esc_info_pack(system_id, component_id, msg, esc_info->index, esc_info->time_usec, esc_info->counter, esc_info->count, esc_info->connection_type, esc_info->info, esc_info->failure_flags, esc_info->error_count, esc_info->temperature);
  164. }
  165. /**
  166. * @brief Encode a esc_info struct on a channel
  167. *
  168. * @param system_id ID of this system
  169. * @param component_id ID of this component (e.g. 200 for IMU)
  170. * @param chan The MAVLink channel this message will be sent over
  171. * @param msg The MAVLink message to compress the data into
  172. * @param esc_info C-struct to read the message contents from
  173. */
  174. static inline uint16_t mavlink_msg_esc_info_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_esc_info_t* esc_info)
  175. {
  176. return mavlink_msg_esc_info_pack_chan(system_id, component_id, chan, msg, esc_info->index, esc_info->time_usec, esc_info->counter, esc_info->count, esc_info->connection_type, esc_info->info, esc_info->failure_flags, esc_info->error_count, esc_info->temperature);
  177. }
  178. /**
  179. * @brief Send a esc_info message
  180. * @param chan MAVLink channel to send the message
  181. *
  182. * @param index Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4.
  183. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  184. * @param counter Counter of data packets received.
  185. * @param count Total number of ESCs in all messages of this type. Message fields with an index higher than this should be ignored because they contain invalid data.
  186. * @param connection_type Connection type protocol for all ESC.
  187. * @param info Information regarding online/offline status of each ESC.
  188. * @param failure_flags Bitmap of ESC failure flags.
  189. * @param error_count Number of reported errors by each ESC since boot.
  190. * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
  191. */
  192. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  193. static inline void mavlink_msg_esc_info_send(mavlink_channel_t chan, uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const int16_t *temperature)
  194. {
  195. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  196. char buf[MAVLINK_MSG_ID_ESC_INFO_LEN];
  197. _mav_put_uint64_t(buf, 0, time_usec);
  198. _mav_put_uint16_t(buf, 24, counter);
  199. _mav_put_uint8_t(buf, 42, index);
  200. _mav_put_uint8_t(buf, 43, count);
  201. _mav_put_uint8_t(buf, 44, connection_type);
  202. _mav_put_uint8_t(buf, 45, info);
  203. _mav_put_uint32_t_array(buf, 8, error_count, 4);
  204. _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
  205. _mav_put_int16_t_array(buf, 34, temperature, 4);
  206. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, buf, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC);
  207. #else
  208. mavlink_esc_info_t packet;
  209. packet.time_usec = time_usec;
  210. packet.counter = counter;
  211. packet.index = index;
  212. packet.count = count;
  213. packet.connection_type = connection_type;
  214. packet.info = info;
  215. mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4);
  216. mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4);
  217. mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
  218. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, (const char *)&packet, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC);
  219. #endif
  220. }
  221. /**
  222. * @brief Send a esc_info message
  223. * @param chan MAVLink channel to send the message
  224. * @param struct The MAVLink struct to serialize
  225. */
  226. static inline void mavlink_msg_esc_info_send_struct(mavlink_channel_t chan, const mavlink_esc_info_t* esc_info)
  227. {
  228. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  229. mavlink_msg_esc_info_send(chan, esc_info->index, esc_info->time_usec, esc_info->counter, esc_info->count, esc_info->connection_type, esc_info->info, esc_info->failure_flags, esc_info->error_count, esc_info->temperature);
  230. #else
  231. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, (const char *)esc_info, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC);
  232. #endif
  233. }
  234. #if MAVLINK_MSG_ID_ESC_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  235. /*
  236. This variant of _send() can be used to save stack space by re-using
  237. memory from the receive buffer. The caller provides a
  238. mavlink_message_t which is the size of a full mavlink message. This
  239. is usually the receive buffer for the channel, and allows a reply to an
  240. incoming message with minimum stack space usage.
  241. */
  242. static inline void mavlink_msg_esc_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const int16_t *temperature)
  243. {
  244. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  245. char *buf = (char *)msgbuf;
  246. _mav_put_uint64_t(buf, 0, time_usec);
  247. _mav_put_uint16_t(buf, 24, counter);
  248. _mav_put_uint8_t(buf, 42, index);
  249. _mav_put_uint8_t(buf, 43, count);
  250. _mav_put_uint8_t(buf, 44, connection_type);
  251. _mav_put_uint8_t(buf, 45, info);
  252. _mav_put_uint32_t_array(buf, 8, error_count, 4);
  253. _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
  254. _mav_put_int16_t_array(buf, 34, temperature, 4);
  255. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, buf, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC);
  256. #else
  257. mavlink_esc_info_t *packet = (mavlink_esc_info_t *)msgbuf;
  258. packet->time_usec = time_usec;
  259. packet->counter = counter;
  260. packet->index = index;
  261. packet->count = count;
  262. packet->connection_type = connection_type;
  263. packet->info = info;
  264. mav_array_memcpy(packet->error_count, error_count, sizeof(uint32_t)*4);
  265. mav_array_memcpy(packet->failure_flags, failure_flags, sizeof(uint16_t)*4);
  266. mav_array_memcpy(packet->temperature, temperature, sizeof(int16_t)*4);
  267. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, (const char *)packet, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC);
  268. #endif
  269. }
  270. #endif
  271. #endif
  272. // MESSAGE ESC_INFO UNPACKING
  273. /**
  274. * @brief Get field index from esc_info message
  275. *
  276. * @return Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4.
  277. */
  278. static inline uint8_t mavlink_msg_esc_info_get_index(const mavlink_message_t* msg)
  279. {
  280. return _MAV_RETURN_uint8_t(msg, 42);
  281. }
  282. /**
  283. * @brief Get field time_usec from esc_info message
  284. *
  285. * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  286. */
  287. static inline uint64_t mavlink_msg_esc_info_get_time_usec(const mavlink_message_t* msg)
  288. {
  289. return _MAV_RETURN_uint64_t(msg, 0);
  290. }
  291. /**
  292. * @brief Get field counter from esc_info message
  293. *
  294. * @return Counter of data packets received.
  295. */
  296. static inline uint16_t mavlink_msg_esc_info_get_counter(const mavlink_message_t* msg)
  297. {
  298. return _MAV_RETURN_uint16_t(msg, 24);
  299. }
  300. /**
  301. * @brief Get field count from esc_info message
  302. *
  303. * @return Total number of ESCs in all messages of this type. Message fields with an index higher than this should be ignored because they contain invalid data.
  304. */
  305. static inline uint8_t mavlink_msg_esc_info_get_count(const mavlink_message_t* msg)
  306. {
  307. return _MAV_RETURN_uint8_t(msg, 43);
  308. }
  309. /**
  310. * @brief Get field connection_type from esc_info message
  311. *
  312. * @return Connection type protocol for all ESC.
  313. */
  314. static inline uint8_t mavlink_msg_esc_info_get_connection_type(const mavlink_message_t* msg)
  315. {
  316. return _MAV_RETURN_uint8_t(msg, 44);
  317. }
  318. /**
  319. * @brief Get field info from esc_info message
  320. *
  321. * @return Information regarding online/offline status of each ESC.
  322. */
  323. static inline uint8_t mavlink_msg_esc_info_get_info(const mavlink_message_t* msg)
  324. {
  325. return _MAV_RETURN_uint8_t(msg, 45);
  326. }
  327. /**
  328. * @brief Get field failure_flags from esc_info message
  329. *
  330. * @return Bitmap of ESC failure flags.
  331. */
  332. static inline uint16_t mavlink_msg_esc_info_get_failure_flags(const mavlink_message_t* msg, uint16_t *failure_flags)
  333. {
  334. return _MAV_RETURN_uint16_t_array(msg, failure_flags, 4, 26);
  335. }
  336. /**
  337. * @brief Get field error_count from esc_info message
  338. *
  339. * @return Number of reported errors by each ESC since boot.
  340. */
  341. static inline uint16_t mavlink_msg_esc_info_get_error_count(const mavlink_message_t* msg, uint32_t *error_count)
  342. {
  343. return _MAV_RETURN_uint32_t_array(msg, error_count, 4, 8);
  344. }
  345. /**
  346. * @brief Get field temperature from esc_info message
  347. *
  348. * @return [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
  349. */
  350. static inline uint16_t mavlink_msg_esc_info_get_temperature(const mavlink_message_t* msg, int16_t *temperature)
  351. {
  352. return _MAV_RETURN_int16_t_array(msg, temperature, 4, 34);
  353. }
  354. /**
  355. * @brief Decode a esc_info message into a struct
  356. *
  357. * @param msg The message to decode
  358. * @param esc_info C-struct to decode the message contents into
  359. */
  360. static inline void mavlink_msg_esc_info_decode(const mavlink_message_t* msg, mavlink_esc_info_t* esc_info)
  361. {
  362. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  363. esc_info->time_usec = mavlink_msg_esc_info_get_time_usec(msg);
  364. mavlink_msg_esc_info_get_error_count(msg, esc_info->error_count);
  365. esc_info->counter = mavlink_msg_esc_info_get_counter(msg);
  366. mavlink_msg_esc_info_get_failure_flags(msg, esc_info->failure_flags);
  367. mavlink_msg_esc_info_get_temperature(msg, esc_info->temperature);
  368. esc_info->index = mavlink_msg_esc_info_get_index(msg);
  369. esc_info->count = mavlink_msg_esc_info_get_count(msg);
  370. esc_info->connection_type = mavlink_msg_esc_info_get_connection_type(msg);
  371. esc_info->info = mavlink_msg_esc_info_get_info(msg);
  372. #else
  373. uint8_t len = msg->len < MAVLINK_MSG_ID_ESC_INFO_LEN? msg->len : MAVLINK_MSG_ID_ESC_INFO_LEN;
  374. memset(esc_info, 0, MAVLINK_MSG_ID_ESC_INFO_LEN);
  375. memcpy(esc_info, _MAV_PAYLOAD(msg), len);
  376. #endif
  377. }