NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_mag_cal_progress.h
Go to the documentation of this file.
1 // MESSAGE MAG_CAL_PROGRESS PACKING
2 
3 #define MAVLINK_MSG_ID_MAG_CAL_PROGRESS 191
4 
6 {
7  float direction_x;
8  float direction_y;
9  float direction_z;
10  uint8_t compass_id;
11  uint8_t cal_mask;
12  uint8_t cal_status;
13  uint8_t attempt;
14  uint8_t completion_pct;
15  uint8_t completion_mask[10];
17 
18 #define MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN 27
19 #define MAVLINK_MSG_ID_191_LEN 27
20 
21 #define MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC 92
22 #define MAVLINK_MSG_ID_191_CRC 92
23 
24 #define MAVLINK_MSG_MAG_CAL_PROGRESS_FIELD_COMPLETION_MASK_LEN 10
25 
26 #define MAVLINK_MESSAGE_INFO_MAG_CAL_PROGRESS { \
27  "MAG_CAL_PROGRESS", \
28  9, \
29  { { "direction_x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mag_cal_progress_t, direction_x) }, \
30  { "direction_y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mag_cal_progress_t, direction_y) }, \
31  { "direction_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mag_cal_progress_t, direction_z) }, \
32  { "compass_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mag_cal_progress_t, compass_id) }, \
33  { "cal_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mag_cal_progress_t, cal_mask) }, \
34  { "cal_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mag_cal_progress_t, cal_status) }, \
35  { "attempt", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_mag_cal_progress_t, attempt) }, \
36  { "completion_pct", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_mag_cal_progress_t, completion_pct) }, \
37  { "completion_mask", NULL, MAVLINK_TYPE_UINT8_T, 10, 17, offsetof(mavlink_mag_cal_progress_t, completion_mask) }, \
38  } \
39 }
40 
41 
59 static inline uint16_t mavlink_msg_mag_cal_progress_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
60  uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z)
61 {
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
64  _mav_put_float(buf, 0, direction_x);
65  _mav_put_float(buf, 4, direction_y);
66  _mav_put_float(buf, 8, direction_z);
67  _mav_put_uint8_t(buf, 12, compass_id);
68  _mav_put_uint8_t(buf, 13, cal_mask);
69  _mav_put_uint8_t(buf, 14, cal_status);
70  _mav_put_uint8_t(buf, 15, attempt);
71  _mav_put_uint8_t(buf, 16, completion_pct);
72  _mav_put_uint8_t_array(buf, 17, completion_mask, 10);
74 #else
76  packet.direction_x = direction_x;
77  packet.direction_y = direction_y;
78  packet.direction_z = direction_z;
79  packet.compass_id = compass_id;
80  packet.cal_mask = cal_mask;
81  packet.cal_status = cal_status;
82  packet.attempt = attempt;
83  packet.completion_pct = completion_pct;
84  mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10);
86 #endif
87 
89 #if MAVLINK_CRC_EXTRA
91 #else
92  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
93 #endif
94 }
95 
113 static inline uint16_t mavlink_msg_mag_cal_progress_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
114  mavlink_message_t* msg,
115  uint8_t compass_id,uint8_t cal_mask,uint8_t cal_status,uint8_t attempt,uint8_t completion_pct,const uint8_t *completion_mask,float direction_x,float direction_y,float direction_z)
116 {
117 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
119  _mav_put_float(buf, 0, direction_x);
120  _mav_put_float(buf, 4, direction_y);
121  _mav_put_float(buf, 8, direction_z);
122  _mav_put_uint8_t(buf, 12, compass_id);
123  _mav_put_uint8_t(buf, 13, cal_mask);
124  _mav_put_uint8_t(buf, 14, cal_status);
125  _mav_put_uint8_t(buf, 15, attempt);
126  _mav_put_uint8_t(buf, 16, completion_pct);
127  _mav_put_uint8_t_array(buf, 17, completion_mask, 10);
129 #else
131  packet.direction_x = direction_x;
132  packet.direction_y = direction_y;
133  packet.direction_z = direction_z;
134  packet.compass_id = compass_id;
135  packet.cal_mask = cal_mask;
136  packet.cal_status = cal_status;
137  packet.attempt = attempt;
138  packet.completion_pct = completion_pct;
139  mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10);
141 #endif
142 
143  msg->msgid = MAVLINK_MSG_ID_MAG_CAL_PROGRESS;
144 #if MAVLINK_CRC_EXTRA
146 #else
147  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
148 #endif
149 }
150 
159 static inline uint16_t mavlink_msg_mag_cal_progress_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mag_cal_progress_t* mag_cal_progress)
160 {
161  return mavlink_msg_mag_cal_progress_pack(system_id, component_id, msg, mag_cal_progress->compass_id, mag_cal_progress->cal_mask, mag_cal_progress->cal_status, mag_cal_progress->attempt, mag_cal_progress->completion_pct, mag_cal_progress->completion_mask, mag_cal_progress->direction_x, mag_cal_progress->direction_y, mag_cal_progress->direction_z);
162 }
163 
173 static inline uint16_t mavlink_msg_mag_cal_progress_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mag_cal_progress_t* mag_cal_progress)
174 {
175  return mavlink_msg_mag_cal_progress_pack_chan(system_id, component_id, chan, msg, mag_cal_progress->compass_id, mag_cal_progress->cal_mask, mag_cal_progress->cal_status, mag_cal_progress->attempt, mag_cal_progress->completion_pct, mag_cal_progress->completion_mask, mag_cal_progress->direction_x, mag_cal_progress->direction_y, mag_cal_progress->direction_z);
176 }
177 
192 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
193 
194 static inline void mavlink_msg_mag_cal_progress_send(mavlink_channel_t chan, uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z)
195 {
196 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
198  _mav_put_float(buf, 0, direction_x);
199  _mav_put_float(buf, 4, direction_y);
200  _mav_put_float(buf, 8, direction_z);
201  _mav_put_uint8_t(buf, 12, compass_id);
202  _mav_put_uint8_t(buf, 13, cal_mask);
203  _mav_put_uint8_t(buf, 14, cal_status);
204  _mav_put_uint8_t(buf, 15, attempt);
205  _mav_put_uint8_t(buf, 16, completion_pct);
206  _mav_put_uint8_t_array(buf, 17, completion_mask, 10);
207 #if MAVLINK_CRC_EXTRA
209 #else
210  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
211 #endif
212 #else
214  packet.direction_x = direction_x;
215  packet.direction_y = direction_y;
216  packet.direction_z = direction_z;
217  packet.compass_id = compass_id;
218  packet.cal_mask = cal_mask;
219  packet.cal_status = cal_status;
220  packet.attempt = attempt;
221  packet.completion_pct = completion_pct;
222  mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10);
223 #if MAVLINK_CRC_EXTRA
224  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)&packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
225 #else
226  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)&packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
227 #endif
228 #endif
229 }
230 
231 #if MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
232 /*
233  This varient of _send() can be used to save stack space by re-using
234  memory from the receive buffer. The caller provides a
235  mavlink_message_t which is the size of a full mavlink message. This
236  is usually the receive buffer for the channel, and allows a reply to an
237  incoming message with minimum stack space usage.
238  */
239 static inline void mavlink_msg_mag_cal_progress_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z)
240 {
241 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242  char *buf = (char *)msgbuf;
243  _mav_put_float(buf, 0, direction_x);
244  _mav_put_float(buf, 4, direction_y);
245  _mav_put_float(buf, 8, direction_z);
246  _mav_put_uint8_t(buf, 12, compass_id);
247  _mav_put_uint8_t(buf, 13, cal_mask);
248  _mav_put_uint8_t(buf, 14, cal_status);
249  _mav_put_uint8_t(buf, 15, attempt);
250  _mav_put_uint8_t(buf, 16, completion_pct);
251  _mav_put_uint8_t_array(buf, 17, completion_mask, 10);
252 #if MAVLINK_CRC_EXTRA
254 #else
255  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
256 #endif
257 #else
259  packet->direction_x = direction_x;
260  packet->direction_y = direction_y;
261  packet->direction_z = direction_z;
262  packet->compass_id = compass_id;
263  packet->cal_mask = cal_mask;
264  packet->cal_status = cal_status;
265  packet->attempt = attempt;
266  packet->completion_pct = completion_pct;
267  mav_array_memcpy(packet->completion_mask, completion_mask, sizeof(uint8_t)*10);
268 #if MAVLINK_CRC_EXTRA
269  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
270 #else
271  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
272 #endif
273 #endif
274 }
275 #endif
276 
277 #endif
278 
279 // MESSAGE MAG_CAL_PROGRESS UNPACKING
280 
281 
287 static inline uint8_t mavlink_msg_mag_cal_progress_get_compass_id(const mavlink_message_t* msg)
288 {
289  return _MAV_RETURN_uint8_t(msg, 12);
290 }
291 
297 static inline uint8_t mavlink_msg_mag_cal_progress_get_cal_mask(const mavlink_message_t* msg)
298 {
299  return _MAV_RETURN_uint8_t(msg, 13);
300 }
301 
307 static inline uint8_t mavlink_msg_mag_cal_progress_get_cal_status(const mavlink_message_t* msg)
308 {
309  return _MAV_RETURN_uint8_t(msg, 14);
310 }
311 
317 static inline uint8_t mavlink_msg_mag_cal_progress_get_attempt(const mavlink_message_t* msg)
318 {
319  return _MAV_RETURN_uint8_t(msg, 15);
320 }
321 
327 static inline uint8_t mavlink_msg_mag_cal_progress_get_completion_pct(const mavlink_message_t* msg)
328 {
329  return _MAV_RETURN_uint8_t(msg, 16);
330 }
331 
337 static inline uint16_t mavlink_msg_mag_cal_progress_get_completion_mask(const mavlink_message_t* msg, uint8_t *completion_mask)
338 {
339  return _MAV_RETURN_uint8_t_array(msg, completion_mask, 10, 17);
340 }
341 
347 static inline float mavlink_msg_mag_cal_progress_get_direction_x(const mavlink_message_t* msg)
348 {
349  return _MAV_RETURN_float(msg, 0);
350 }
351 
357 static inline float mavlink_msg_mag_cal_progress_get_direction_y(const mavlink_message_t* msg)
358 {
359  return _MAV_RETURN_float(msg, 4);
360 }
361 
367 static inline float mavlink_msg_mag_cal_progress_get_direction_z(const mavlink_message_t* msg)
368 {
369  return _MAV_RETURN_float(msg, 8);
370 }
371 
378 static inline void mavlink_msg_mag_cal_progress_decode(const mavlink_message_t* msg, mavlink_mag_cal_progress_t* mag_cal_progress)
379 {
380 #if MAVLINK_NEED_BYTE_SWAP
381  mag_cal_progress->direction_x = mavlink_msg_mag_cal_progress_get_direction_x(msg);
382  mag_cal_progress->direction_y = mavlink_msg_mag_cal_progress_get_direction_y(msg);
383  mag_cal_progress->direction_z = mavlink_msg_mag_cal_progress_get_direction_z(msg);
384  mag_cal_progress->compass_id = mavlink_msg_mag_cal_progress_get_compass_id(msg);
385  mag_cal_progress->cal_mask = mavlink_msg_mag_cal_progress_get_cal_mask(msg);
386  mag_cal_progress->cal_status = mavlink_msg_mag_cal_progress_get_cal_status(msg);
387  mag_cal_progress->attempt = mavlink_msg_mag_cal_progress_get_attempt(msg);
388  mag_cal_progress->completion_pct = mavlink_msg_mag_cal_progress_get_completion_pct(msg);
389  mavlink_msg_mag_cal_progress_get_completion_mask(msg, mag_cal_progress->completion_mask);
390 #else
391  memcpy(mag_cal_progress, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
392 #endif
393 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134