NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_mag_cal_report.h
Go to the documentation of this file.
1 // MESSAGE MAG_CAL_REPORT PACKING
2 
3 #define MAVLINK_MSG_ID_MAG_CAL_REPORT 192
4 
6 {
7  float fitness;
8  float ofs_x;
9  float ofs_y;
10  float ofs_z;
11  float diag_x;
12  float diag_y;
13  float diag_z;
14  float offdiag_x;
15  float offdiag_y;
16  float offdiag_z;
17  uint8_t compass_id;
18  uint8_t cal_mask;
19  uint8_t cal_status;
20  uint8_t autosaved;
22 
23 #define MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN 44
24 #define MAVLINK_MSG_ID_192_LEN 44
25 
26 #define MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC 36
27 #define MAVLINK_MSG_ID_192_CRC 36
28 
29 
30 
31 #define MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT { \
32  "MAG_CAL_REPORT", \
33  14, \
34  { { "fitness", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mag_cal_report_t, fitness) }, \
35  { "ofs_x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mag_cal_report_t, ofs_x) }, \
36  { "ofs_y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mag_cal_report_t, ofs_y) }, \
37  { "ofs_z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mag_cal_report_t, ofs_z) }, \
38  { "diag_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_mag_cal_report_t, diag_x) }, \
39  { "diag_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_mag_cal_report_t, diag_y) }, \
40  { "diag_z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_mag_cal_report_t, diag_z) }, \
41  { "offdiag_x", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_mag_cal_report_t, offdiag_x) }, \
42  { "offdiag_y", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_mag_cal_report_t, offdiag_y) }, \
43  { "offdiag_z", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_mag_cal_report_t, offdiag_z) }, \
44  { "compass_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_mag_cal_report_t, compass_id) }, \
45  { "cal_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_mag_cal_report_t, cal_mask) }, \
46  { "cal_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_mag_cal_report_t, cal_status) }, \
47  { "autosaved", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_mag_cal_report_t, autosaved) }, \
48  } \
49 }
50 
51 
74 static inline uint16_t mavlink_msg_mag_cal_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
75  uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t autosaved, float fitness, float ofs_x, float ofs_y, float ofs_z, float diag_x, float diag_y, float diag_z, float offdiag_x, float offdiag_y, float offdiag_z)
76 {
77 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
79  _mav_put_float(buf, 0, fitness);
80  _mav_put_float(buf, 4, ofs_x);
81  _mav_put_float(buf, 8, ofs_y);
82  _mav_put_float(buf, 12, ofs_z);
83  _mav_put_float(buf, 16, diag_x);
84  _mav_put_float(buf, 20, diag_y);
85  _mav_put_float(buf, 24, diag_z);
86  _mav_put_float(buf, 28, offdiag_x);
87  _mav_put_float(buf, 32, offdiag_y);
88  _mav_put_float(buf, 36, offdiag_z);
89  _mav_put_uint8_t(buf, 40, compass_id);
90  _mav_put_uint8_t(buf, 41, cal_mask);
91  _mav_put_uint8_t(buf, 42, cal_status);
92  _mav_put_uint8_t(buf, 43, autosaved);
93 
95 #else
97  packet.fitness = fitness;
98  packet.ofs_x = ofs_x;
99  packet.ofs_y = ofs_y;
100  packet.ofs_z = ofs_z;
101  packet.diag_x = diag_x;
102  packet.diag_y = diag_y;
103  packet.diag_z = diag_z;
104  packet.offdiag_x = offdiag_x;
105  packet.offdiag_y = offdiag_y;
106  packet.offdiag_z = offdiag_z;
107  packet.compass_id = compass_id;
108  packet.cal_mask = cal_mask;
109  packet.cal_status = cal_status;
110  packet.autosaved = autosaved;
111 
113 #endif
114 
115  msg->msgid = MAVLINK_MSG_ID_MAG_CAL_REPORT;
116 #if MAVLINK_CRC_EXTRA
118 #else
119  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN);
120 #endif
121 }
122 
145 static inline uint16_t mavlink_msg_mag_cal_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
146  mavlink_message_t* msg,
147  uint8_t compass_id,uint8_t cal_mask,uint8_t cal_status,uint8_t autosaved,float fitness,float ofs_x,float ofs_y,float ofs_z,float diag_x,float diag_y,float diag_z,float offdiag_x,float offdiag_y,float offdiag_z)
148 {
149 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
151  _mav_put_float(buf, 0, fitness);
152  _mav_put_float(buf, 4, ofs_x);
153  _mav_put_float(buf, 8, ofs_y);
154  _mav_put_float(buf, 12, ofs_z);
155  _mav_put_float(buf, 16, diag_x);
156  _mav_put_float(buf, 20, diag_y);
157  _mav_put_float(buf, 24, diag_z);
158  _mav_put_float(buf, 28, offdiag_x);
159  _mav_put_float(buf, 32, offdiag_y);
160  _mav_put_float(buf, 36, offdiag_z);
161  _mav_put_uint8_t(buf, 40, compass_id);
162  _mav_put_uint8_t(buf, 41, cal_mask);
163  _mav_put_uint8_t(buf, 42, cal_status);
164  _mav_put_uint8_t(buf, 43, autosaved);
165 
167 #else
169  packet.fitness = fitness;
170  packet.ofs_x = ofs_x;
171  packet.ofs_y = ofs_y;
172  packet.ofs_z = ofs_z;
173  packet.diag_x = diag_x;
174  packet.diag_y = diag_y;
175  packet.diag_z = diag_z;
176  packet.offdiag_x = offdiag_x;
177  packet.offdiag_y = offdiag_y;
178  packet.offdiag_z = offdiag_z;
179  packet.compass_id = compass_id;
180  packet.cal_mask = cal_mask;
181  packet.cal_status = cal_status;
182  packet.autosaved = autosaved;
183 
185 #endif
186 
187  msg->msgid = MAVLINK_MSG_ID_MAG_CAL_REPORT;
188 #if MAVLINK_CRC_EXTRA
190 #else
191  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN);
192 #endif
193 }
194 
203 static inline uint16_t mavlink_msg_mag_cal_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mag_cal_report_t* mag_cal_report)
204 {
205  return mavlink_msg_mag_cal_report_pack(system_id, component_id, msg, mag_cal_report->compass_id, mag_cal_report->cal_mask, mag_cal_report->cal_status, mag_cal_report->autosaved, mag_cal_report->fitness, mag_cal_report->ofs_x, mag_cal_report->ofs_y, mag_cal_report->ofs_z, mag_cal_report->diag_x, mag_cal_report->diag_y, mag_cal_report->diag_z, mag_cal_report->offdiag_x, mag_cal_report->offdiag_y, mag_cal_report->offdiag_z);
206 }
207 
217 static inline uint16_t mavlink_msg_mag_cal_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mag_cal_report_t* mag_cal_report)
218 {
219  return mavlink_msg_mag_cal_report_pack_chan(system_id, component_id, chan, msg, mag_cal_report->compass_id, mag_cal_report->cal_mask, mag_cal_report->cal_status, mag_cal_report->autosaved, mag_cal_report->fitness, mag_cal_report->ofs_x, mag_cal_report->ofs_y, mag_cal_report->ofs_z, mag_cal_report->diag_x, mag_cal_report->diag_y, mag_cal_report->diag_z, mag_cal_report->offdiag_x, mag_cal_report->offdiag_y, mag_cal_report->offdiag_z);
220 }
221 
241 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
242 
243 static inline void mavlink_msg_mag_cal_report_send(mavlink_channel_t chan, uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t autosaved, float fitness, float ofs_x, float ofs_y, float ofs_z, float diag_x, float diag_y, float diag_z, float offdiag_x, float offdiag_y, float offdiag_z)
244 {
245 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
247  _mav_put_float(buf, 0, fitness);
248  _mav_put_float(buf, 4, ofs_x);
249  _mav_put_float(buf, 8, ofs_y);
250  _mav_put_float(buf, 12, ofs_z);
251  _mav_put_float(buf, 16, diag_x);
252  _mav_put_float(buf, 20, diag_y);
253  _mav_put_float(buf, 24, diag_z);
254  _mav_put_float(buf, 28, offdiag_x);
255  _mav_put_float(buf, 32, offdiag_y);
256  _mav_put_float(buf, 36, offdiag_z);
257  _mav_put_uint8_t(buf, 40, compass_id);
258  _mav_put_uint8_t(buf, 41, cal_mask);
259  _mav_put_uint8_t(buf, 42, cal_status);
260  _mav_put_uint8_t(buf, 43, autosaved);
261 
262 #if MAVLINK_CRC_EXTRA
264 #else
265  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_REPORT, buf, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN);
266 #endif
267 #else
269  packet.fitness = fitness;
270  packet.ofs_x = ofs_x;
271  packet.ofs_y = ofs_y;
272  packet.ofs_z = ofs_z;
273  packet.diag_x = diag_x;
274  packet.diag_y = diag_y;
275  packet.diag_z = diag_z;
276  packet.offdiag_x = offdiag_x;
277  packet.offdiag_y = offdiag_y;
278  packet.offdiag_z = offdiag_z;
279  packet.compass_id = compass_id;
280  packet.cal_mask = cal_mask;
281  packet.cal_status = cal_status;
282  packet.autosaved = autosaved;
283 
284 #if MAVLINK_CRC_EXTRA
285  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_REPORT, (const char *)&packet, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC);
286 #else
287  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_REPORT, (const char *)&packet, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN);
288 #endif
289 #endif
290 }
291 
292 #if MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
293 /*
294  This varient of _send() can be used to save stack space by re-using
295  memory from the receive buffer. The caller provides a
296  mavlink_message_t which is the size of a full mavlink message. This
297  is usually the receive buffer for the channel, and allows a reply to an
298  incoming message with minimum stack space usage.
299  */
300 static inline void mavlink_msg_mag_cal_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t autosaved, float fitness, float ofs_x, float ofs_y, float ofs_z, float diag_x, float diag_y, float diag_z, float offdiag_x, float offdiag_y, float offdiag_z)
301 {
302 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
303  char *buf = (char *)msgbuf;
304  _mav_put_float(buf, 0, fitness);
305  _mav_put_float(buf, 4, ofs_x);
306  _mav_put_float(buf, 8, ofs_y);
307  _mav_put_float(buf, 12, ofs_z);
308  _mav_put_float(buf, 16, diag_x);
309  _mav_put_float(buf, 20, diag_y);
310  _mav_put_float(buf, 24, diag_z);
311  _mav_put_float(buf, 28, offdiag_x);
312  _mav_put_float(buf, 32, offdiag_y);
313  _mav_put_float(buf, 36, offdiag_z);
314  _mav_put_uint8_t(buf, 40, compass_id);
315  _mav_put_uint8_t(buf, 41, cal_mask);
316  _mav_put_uint8_t(buf, 42, cal_status);
317  _mav_put_uint8_t(buf, 43, autosaved);
318 
319 #if MAVLINK_CRC_EXTRA
321 #else
322  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_REPORT, buf, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN);
323 #endif
324 #else
326  packet->fitness = fitness;
327  packet->ofs_x = ofs_x;
328  packet->ofs_y = ofs_y;
329  packet->ofs_z = ofs_z;
330  packet->diag_x = diag_x;
331  packet->diag_y = diag_y;
332  packet->diag_z = diag_z;
333  packet->offdiag_x = offdiag_x;
334  packet->offdiag_y = offdiag_y;
335  packet->offdiag_z = offdiag_z;
336  packet->compass_id = compass_id;
337  packet->cal_mask = cal_mask;
338  packet->cal_status = cal_status;
339  packet->autosaved = autosaved;
340 
341 #if MAVLINK_CRC_EXTRA
342  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_REPORT, (const char *)packet, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC);
343 #else
344  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_REPORT, (const char *)packet, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN);
345 #endif
346 #endif
347 }
348 #endif
349 
350 #endif
351 
352 // MESSAGE MAG_CAL_REPORT UNPACKING
353 
354 
360 static inline uint8_t mavlink_msg_mag_cal_report_get_compass_id(const mavlink_message_t* msg)
361 {
362  return _MAV_RETURN_uint8_t(msg, 40);
363 }
364 
370 static inline uint8_t mavlink_msg_mag_cal_report_get_cal_mask(const mavlink_message_t* msg)
371 {
372  return _MAV_RETURN_uint8_t(msg, 41);
373 }
374 
380 static inline uint8_t mavlink_msg_mag_cal_report_get_cal_status(const mavlink_message_t* msg)
381 {
382  return _MAV_RETURN_uint8_t(msg, 42);
383 }
384 
390 static inline uint8_t mavlink_msg_mag_cal_report_get_autosaved(const mavlink_message_t* msg)
391 {
392  return _MAV_RETURN_uint8_t(msg, 43);
393 }
394 
400 static inline float mavlink_msg_mag_cal_report_get_fitness(const mavlink_message_t* msg)
401 {
402  return _MAV_RETURN_float(msg, 0);
403 }
404 
410 static inline float mavlink_msg_mag_cal_report_get_ofs_x(const mavlink_message_t* msg)
411 {
412  return _MAV_RETURN_float(msg, 4);
413 }
414 
420 static inline float mavlink_msg_mag_cal_report_get_ofs_y(const mavlink_message_t* msg)
421 {
422  return _MAV_RETURN_float(msg, 8);
423 }
424 
430 static inline float mavlink_msg_mag_cal_report_get_ofs_z(const mavlink_message_t* msg)
431 {
432  return _MAV_RETURN_float(msg, 12);
433 }
434 
440 static inline float mavlink_msg_mag_cal_report_get_diag_x(const mavlink_message_t* msg)
441 {
442  return _MAV_RETURN_float(msg, 16);
443 }
444 
450 static inline float mavlink_msg_mag_cal_report_get_diag_y(const mavlink_message_t* msg)
451 {
452  return _MAV_RETURN_float(msg, 20);
453 }
454 
460 static inline float mavlink_msg_mag_cal_report_get_diag_z(const mavlink_message_t* msg)
461 {
462  return _MAV_RETURN_float(msg, 24);
463 }
464 
470 static inline float mavlink_msg_mag_cal_report_get_offdiag_x(const mavlink_message_t* msg)
471 {
472  return _MAV_RETURN_float(msg, 28);
473 }
474 
480 static inline float mavlink_msg_mag_cal_report_get_offdiag_y(const mavlink_message_t* msg)
481 {
482  return _MAV_RETURN_float(msg, 32);
483 }
484 
490 static inline float mavlink_msg_mag_cal_report_get_offdiag_z(const mavlink_message_t* msg)
491 {
492  return _MAV_RETURN_float(msg, 36);
493 }
494 
501 static inline void mavlink_msg_mag_cal_report_decode(const mavlink_message_t* msg, mavlink_mag_cal_report_t* mag_cal_report)
502 {
503 #if MAVLINK_NEED_BYTE_SWAP
504  mag_cal_report->fitness = mavlink_msg_mag_cal_report_get_fitness(msg);
505  mag_cal_report->ofs_x = mavlink_msg_mag_cal_report_get_ofs_x(msg);
506  mag_cal_report->ofs_y = mavlink_msg_mag_cal_report_get_ofs_y(msg);
507  mag_cal_report->ofs_z = mavlink_msg_mag_cal_report_get_ofs_z(msg);
508  mag_cal_report->diag_x = mavlink_msg_mag_cal_report_get_diag_x(msg);
509  mag_cal_report->diag_y = mavlink_msg_mag_cal_report_get_diag_y(msg);
510  mag_cal_report->diag_z = mavlink_msg_mag_cal_report_get_diag_z(msg);
511  mag_cal_report->offdiag_x = mavlink_msg_mag_cal_report_get_offdiag_x(msg);
512  mag_cal_report->offdiag_y = mavlink_msg_mag_cal_report_get_offdiag_y(msg);
513  mag_cal_report->offdiag_z = mavlink_msg_mag_cal_report_get_offdiag_z(msg);
514  mag_cal_report->compass_id = mavlink_msg_mag_cal_report_get_compass_id(msg);
515  mag_cal_report->cal_mask = mavlink_msg_mag_cal_report_get_cal_mask(msg);
516  mag_cal_report->cal_status = mavlink_msg_mag_cal_report_get_cal_status(msg);
517  mag_cal_report->autosaved = mavlink_msg_mag_cal_report_get_autosaved(msg);
518 #else
519  memcpy(mag_cal_report, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN);
520 #endif
521 }
#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