Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_esc_info.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE ESC_INFO PACKING
3
4#define MAVLINK_MSG_ID_ESC_INFO 290
5
6
7typedef struct __mavlink_esc_info_t {
8 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.*/
9 uint32_t error_count[4]; /*< Number of reported errors by each ESC since boot.*/
10 uint16_t counter; /*< Counter of data packets received.*/
11 uint16_t failure_flags[4]; /*< Bitmap of ESC failure flags.*/
12 int16_t temperature[4]; /*< [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.*/
13 uint8_t index; /*< Index of the first ESC in this message (ESC are indexed in motor order). minValue = 0, maxValue = 60, increment = 4.*/
14 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.*/
15 uint8_t connection_type; /*< Connection type protocol for all ESC.*/
16 uint8_t info; /*< Information regarding online/offline status of each ESC.*/
17} mavlink_esc_info_t;
18
19#define MAVLINK_MSG_ID_ESC_INFO_LEN 46
20#define MAVLINK_MSG_ID_ESC_INFO_MIN_LEN 46
21#define MAVLINK_MSG_ID_290_LEN 46
22#define MAVLINK_MSG_ID_290_MIN_LEN 46
23
24#define MAVLINK_MSG_ID_ESC_INFO_CRC 251
25#define MAVLINK_MSG_ID_290_CRC 251
26
27#define MAVLINK_MSG_ESC_INFO_FIELD_ERROR_COUNT_LEN 4
28#define MAVLINK_MSG_ESC_INFO_FIELD_FAILURE_FLAGS_LEN 4
29#define MAVLINK_MSG_ESC_INFO_FIELD_TEMPERATURE_LEN 4
30
31#if MAVLINK_COMMAND_24BIT
32#define MAVLINK_MESSAGE_INFO_ESC_INFO {
33 290,
34 "ESC_INFO",
35 9,
36 { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_esc_info_t, index) },
37 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_esc_info_t, time_usec) },
38 { "counter", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_esc_info_t, counter) },
39 { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_esc_info_t, count) },
40 { "connection_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_esc_info_t, connection_type) },
41 { "info", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_esc_info_t, info) },
42 { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 4, 26, offsetof(mavlink_esc_info_t, failure_flags) },
43 { "error_count", NULL, MAVLINK_TYPE_UINT32_T, 4, 8, offsetof(mavlink_esc_info_t, error_count) },
44 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 4, 34, offsetof(mavlink_esc_info_t, temperature) },
45 } \
46}
47#else
48#define MAVLINK_MESSAGE_INFO_ESC_INFO {
49 "ESC_INFO",
50 9,
51 { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_esc_info_t, index) },
52 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_esc_info_t, time_usec) },
53 { "counter", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_esc_info_t, counter) },
54 { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_esc_info_t, count) },
55 { "connection_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_esc_info_t, connection_type) },
56 { "info", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_esc_info_t, info) },
57 { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 4, 26, offsetof(mavlink_esc_info_t, failure_flags) },
58 { "error_count", NULL, MAVLINK_TYPE_UINT32_T, 4, 8, offsetof(mavlink_esc_info_t, error_count) },
59 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 4, 34, offsetof(mavlink_esc_info_t, temperature) },
60 } \
61}
62#endif
63
64/**
65 * @brief Pack a esc_info message
66 * @param system_id ID of this system
67 * @param component_id ID of this component (e.g. 200 for IMU)
68 * @param msg The MAVLink message to compress the data into
69 *
70 * @param index Index of the first ESC in this message (ESC are indexed in motor order). minValue = 0, maxValue = 60, increment = 4.
71 * @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.
72 * @param counter Counter of data packets received.
73 * @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.
74 * @param connection_type Connection type protocol for all ESC.
75 * @param info Information regarding online/offline status of each ESC.
76 * @param failure_flags Bitmap of ESC failure flags.
77 * @param error_count Number of reported errors by each ESC since boot.
78 * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
79 * @return length of the message in bytes (excluding serial stream start sign)
80 */
81MAVLINK_WIP
82static inline uint16_t mavlink_msg_esc_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
83 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)
84{
85#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 _mav_put_uint64_t(buf, 0, time_usec);
88 _mav_put_uint16_t(buf, 24, counter);
89 _mav_put_uint8_t(buf, 42, index);
90 _mav_put_uint8_t(buf, 43, count);
91 _mav_put_uint8_t(buf, 44, connection_type);
92 _mav_put_uint8_t(buf, 45, info);
93 _mav_put_uint32_t_array(buf, 8, error_count, 4);
94 _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
95 _mav_put_int16_t_array(buf, 34, temperature, 4);
96 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_INFO_LEN);
97#else
98 mavlink_esc_info_t packet;
99 packet.time_usec = time_usec;
100 packet.counter = counter;
101 packet.index = index;
102 packet.count = count;
103 packet.connection_type = connection_type;
104 packet.info = info;
105 mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4);
106 mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4);
107 mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
108 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_INFO_LEN);
109#endif
110
111 msg->msgid = MAVLINK_MSG_ID_ESC_INFO;
112 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);
113}
114
115/**
116 * @brief Pack a esc_info message
117 * @param system_id ID of this system
118 * @param component_id ID of this component (e.g. 200 for IMU)
119 * @param status MAVLink status structure
120 * @param msg The MAVLink message to compress the data into
121 *
122 * @param index Index of the first ESC in this message (ESC are indexed in motor order). minValue = 0, maxValue = 60, increment = 4.
123 * @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.
124 * @param counter Counter of data packets received.
125 * @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.
126 * @param connection_type Connection type protocol for all ESC.
127 * @param info Information regarding online/offline status of each ESC.
128 * @param failure_flags Bitmap of ESC failure flags.
129 * @param error_count Number of reported errors by each ESC since boot.
130 * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
131 * @return length of the message in bytes (excluding serial stream start sign)
132 */
133static inline uint16_t mavlink_msg_esc_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
134 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)
135{
136#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
138 _mav_put_uint64_t(buf, 0, time_usec);
139 _mav_put_uint16_t(buf, 24, counter);
140 _mav_put_uint8_t(buf, 42, index);
141 _mav_put_uint8_t(buf, 43, count);
142 _mav_put_uint8_t(buf, 44, connection_type);
143 _mav_put_uint8_t(buf, 45, info);
144 _mav_put_uint32_t_array(buf, 8, error_count, 4);
145 _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
146 _mav_put_int16_t_array(buf, 34, temperature, 4);
147 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_INFO_LEN);
148#else
149 mavlink_esc_info_t packet;
150 packet.time_usec = time_usec;
151 packet.counter = counter;
152 packet.index = index;
153 packet.count = count;
154 packet.connection_type = connection_type;
155 packet.info = info;
156 mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4);
157 mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4);
158 mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
159 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_INFO_LEN);
160#endif
161
162 msg->msgid = MAVLINK_MSG_ID_ESC_INFO;
163#if MAVLINK_CRC_EXTRA
164 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC);
165#else
166 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN);
167#endif
168}
169
170/**
171 * @brief Pack a esc_info message on a channel
172 * @param system_id ID of this system
173 * @param component_id ID of this component (e.g. 200 for IMU)
174 * @param chan The MAVLink channel this message will be sent over
175 * @param msg The MAVLink message to compress the data into
176 * @param index Index of the first ESC in this message (ESC are indexed in motor order). minValue = 0, maxValue = 60, increment = 4.
177 * @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.
178 * @param counter Counter of data packets received.
179 * @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.
180 * @param connection_type Connection type protocol for all ESC.
181 * @param info Information regarding online/offline status of each ESC.
182 * @param failure_flags Bitmap of ESC failure flags.
183 * @param error_count Number of reported errors by each ESC since boot.
184 * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
185 * @return length of the message in bytes (excluding serial stream start sign)
186 */
187MAVLINK_WIP
188static inline uint16_t mavlink_msg_esc_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
189 mavlink_message_t* msg,
190 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)
191{
192#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
194 _mav_put_uint64_t(buf, 0, time_usec);
195 _mav_put_uint16_t(buf, 24, counter);
196 _mav_put_uint8_t(buf, 42, index);
197 _mav_put_uint8_t(buf, 43, count);
198 _mav_put_uint8_t(buf, 44, connection_type);
199 _mav_put_uint8_t(buf, 45, info);
200 _mav_put_uint32_t_array(buf, 8, error_count, 4);
201 _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
202 _mav_put_int16_t_array(buf, 34, temperature, 4);
203 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_INFO_LEN);
204#else
205 mavlink_esc_info_t packet;
206 packet.time_usec = time_usec;
207 packet.counter = counter;
208 packet.index = index;
209 packet.count = count;
210 packet.connection_type = connection_type;
211 packet.info = info;
212 mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4);
213 mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4);
214 mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
215 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_INFO_LEN);
216#endif
217
218 msg->msgid = MAVLINK_MSG_ID_ESC_INFO;
219 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);
220}
221
222/**
223 * @brief Encode a esc_info struct
224 *
225 * @param system_id ID of this system
226 * @param component_id ID of this component (e.g. 200 for IMU)
227 * @param msg The MAVLink message to compress the data into
228 * @param esc_info C-struct to read the message contents from
229 */
230MAVLINK_WIP
231static 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)
232{
233 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);
234}
235
236/**
237 * @brief Encode a esc_info struct on a channel
238 *
239 * @param system_id ID of this system
240 * @param component_id ID of this component (e.g. 200 for IMU)
241 * @param chan The MAVLink channel this message will be sent over
242 * @param msg The MAVLink message to compress the data into
243 * @param esc_info C-struct to read the message contents from
244 */
245MAVLINK_WIP
246static 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)
247{
248 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);
249}
250
251/**
252 * @brief Encode a esc_info struct with provided status structure
253 *
254 * @param system_id ID of this system
255 * @param component_id ID of this component (e.g. 200 for IMU)
256 * @param status MAVLink status structure
257 * @param msg The MAVLink message to compress the data into
258 * @param esc_info C-struct to read the message contents from
259 */
260static inline uint16_t mavlink_msg_esc_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_esc_info_t* esc_info)
261{
262 return mavlink_msg_esc_info_pack_status(system_id, component_id, _status, 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);
263}
264
265/**
266 * @brief Send a esc_info message
267 * @param chan MAVLink channel to send the message
268 *
269 * @param index Index of the first ESC in this message (ESC are indexed in motor order). minValue = 0, maxValue = 60, increment = 4.
270 * @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.
271 * @param counter Counter of data packets received.
272 * @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.
273 * @param connection_type Connection type protocol for all ESC.
274 * @param info Information regarding online/offline status of each ESC.
275 * @param failure_flags Bitmap of ESC failure flags.
276 * @param error_count Number of reported errors by each ESC since boot.
277 * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
278 */
279#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
280
281MAVLINK_WIP
282static 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)
283{
284#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
285 char buf[MAVLINK_MSG_ID_ESC_INFO_LEN];
286 _mav_put_uint64_t(buf, 0, time_usec);
287 _mav_put_uint16_t(buf, 24, counter);
288 _mav_put_uint8_t(buf, 42, index);
289 _mav_put_uint8_t(buf, 43, count);
290 _mav_put_uint8_t(buf, 44, connection_type);
291 _mav_put_uint8_t(buf, 45, info);
292 _mav_put_uint32_t_array(buf, 8, error_count, 4);
293 _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
294 _mav_put_int16_t_array(buf, 34, temperature, 4);
295 _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);
296#else
297 mavlink_esc_info_t packet;
298 packet.time_usec = time_usec;
299 packet.counter = counter;
300 packet.index = index;
301 packet.count = count;
302 packet.connection_type = connection_type;
303 packet.info = info;
304 mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4);
305 mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4);
306 mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4);
307 _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);
308#endif
309}
310
311/**
312 * @brief Send a esc_info message
313 * @param chan MAVLink channel to send the message
314 * @param struct The MAVLink struct to serialize
315 */
316MAVLINK_WIP
317static inline void mavlink_msg_esc_info_send_struct(mavlink_channel_t chan, const mavlink_esc_info_t* esc_info)
318{
319#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
320 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);
321#else
322 _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);
323#endif
324}
325
326#if MAVLINK_MSG_ID_ESC_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
327/*
328 This variant of _send() can be used to save stack space by reusing
329 memory from the receive buffer. The caller provides a
330 mavlink_message_t which is the size of a full mavlink message. This
331 is usually the receive buffer for the channel, and allows a reply to an
332 incoming message with minimum stack space usage.
333 */
334MAVLINK_WIP
335static 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)
336{
337#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
338 char *buf = (char *)msgbuf;
339 _mav_put_uint64_t(buf, 0, time_usec);
340 _mav_put_uint16_t(buf, 24, counter);
341 _mav_put_uint8_t(buf, 42, index);
342 _mav_put_uint8_t(buf, 43, count);
343 _mav_put_uint8_t(buf, 44, connection_type);
344 _mav_put_uint8_t(buf, 45, info);
345 _mav_put_uint32_t_array(buf, 8, error_count, 4);
346 _mav_put_uint16_t_array(buf, 26, failure_flags, 4);
347 _mav_put_int16_t_array(buf, 34, temperature, 4);
348 _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);
349#else
350 mavlink_esc_info_t *packet = (mavlink_esc_info_t *)msgbuf;
351 packet->time_usec = time_usec;
352 packet->counter = counter;
353 packet->index = index;
354 packet->count = count;
355 packet->connection_type = connection_type;
356 packet->info = info;
357 mav_array_memcpy(packet->error_count, error_count, sizeof(uint32_t)*4);
358 mav_array_memcpy(packet->failure_flags, failure_flags, sizeof(uint16_t)*4);
359 mav_array_memcpy(packet->temperature, temperature, sizeof(int16_t)*4);
360 _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);
361#endif
362}
363#endif
364
365#endif
366
367// MESSAGE ESC_INFO UNPACKING
368
369
370/**
371 * @brief Get field index from esc_info message
372 *
373 * @return Index of the first ESC in this message (ESC are indexed in motor order). minValue = 0, maxValue = 60, increment = 4.
374 */
375MAVLINK_WIP
376static inline uint8_t mavlink_msg_esc_info_get_index(const mavlink_message_t* msg)
377{
378 return _MAV_RETURN_uint8_t(msg, 42);
379}
380
381/**
382 * @brief Get field time_usec from esc_info message
383 *
384 * @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.
385 */
386MAVLINK_WIP
387static inline uint64_t mavlink_msg_esc_info_get_time_usec(const mavlink_message_t* msg)
388{
389 return _MAV_RETURN_uint64_t(msg, 0);
390}
391
392/**
393 * @brief Get field counter from esc_info message
394 *
395 * @return Counter of data packets received.
396 */
397MAVLINK_WIP
398static inline uint16_t mavlink_msg_esc_info_get_counter(const mavlink_message_t* msg)
399{
400 return _MAV_RETURN_uint16_t(msg, 24);
401}
402
403/**
404 * @brief Get field count from esc_info message
405 *
406 * @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.
407 */
408MAVLINK_WIP
409static inline uint8_t mavlink_msg_esc_info_get_count(const mavlink_message_t* msg)
410{
411 return _MAV_RETURN_uint8_t(msg, 43);
412}
413
414/**
415 * @brief Get field connection_type from esc_info message
416 *
417 * @return Connection type protocol for all ESC.
418 */
419MAVLINK_WIP
420static inline uint8_t mavlink_msg_esc_info_get_connection_type(const mavlink_message_t* msg)
421{
422 return _MAV_RETURN_uint8_t(msg, 44);
423}
424
425/**
426 * @brief Get field info from esc_info message
427 *
428 * @return Information regarding online/offline status of each ESC.
429 */
430MAVLINK_WIP
431static inline uint8_t mavlink_msg_esc_info_get_info(const mavlink_message_t* msg)
432{
433 return _MAV_RETURN_uint8_t(msg, 45);
434}
435
436/**
437 * @brief Get field failure_flags from esc_info message
438 *
439 * @return Bitmap of ESC failure flags.
440 */
441MAVLINK_WIP
442static inline uint16_t mavlink_msg_esc_info_get_failure_flags(const mavlink_message_t* msg, uint16_t *failure_flags)
443{
444 return _MAV_RETURN_uint16_t_array(msg, failure_flags, 4, 26);
445}
446
447/**
448 * @brief Get field error_count from esc_info message
449 *
450 * @return Number of reported errors by each ESC since boot.
451 */
452MAVLINK_WIP
453static inline uint16_t mavlink_msg_esc_info_get_error_count(const mavlink_message_t* msg, uint32_t *error_count)
454{
455 return _MAV_RETURN_uint32_t_array(msg, error_count, 4, 8);
456}
457
458/**
459 * @brief Get field temperature from esc_info message
460 *
461 * @return [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.
462 */
463MAVLINK_WIP
464static inline uint16_t mavlink_msg_esc_info_get_temperature(const mavlink_message_t* msg, int16_t *temperature)
465{
466 return _MAV_RETURN_int16_t_array(msg, temperature, 4, 34);
467}
468
469/**
470 * @brief Decode a esc_info message into a struct
471 *
472 * @param msg The message to decode
473 * @param esc_info C-struct to decode the message contents into
474 */
475MAVLINK_WIP
476static inline void mavlink_msg_esc_info_decode(const mavlink_message_t* msg, mavlink_esc_info_t* esc_info)
477{
478#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
479 esc_info->time_usec = mavlink_msg_esc_info_get_time_usec(msg);
480 mavlink_msg_esc_info_get_error_count(msg, esc_info->error_count);
481 esc_info->counter = mavlink_msg_esc_info_get_counter(msg);
482 mavlink_msg_esc_info_get_failure_flags(msg, esc_info->failure_flags);
483 mavlink_msg_esc_info_get_temperature(msg, esc_info->temperature);
484 esc_info->index = mavlink_msg_esc_info_get_index(msg);
485 esc_info->count = mavlink_msg_esc_info_get_count(msg);
486 esc_info->connection_type = mavlink_msg_esc_info_get_connection_type(msg);
487 esc_info->info = mavlink_msg_esc_info_get_info(msg);
488#else
489 uint8_t len = msg->len < MAVLINK_MSG_ID_ESC_INFO_LEN? msg->len : MAVLINK_MSG_ID_ESC_INFO_LEN;
490 memset(esc_info, 0, MAVLINK_MSG_ID_ESC_INFO_LEN);
491 memcpy(esc_info, _MAV_PAYLOAD(msg), len);
492#endif
493}