2 // MESSAGE MAG_CAL_REPORT PACKING
4 #define MAVLINK_MSG_ID_MAG_CAL_REPORT 192
7 typedef struct __mavlink_mag_cal_report_t
{
8 float fitness
; /*< [mgauss] RMS milligauss residuals.*/
9 float ofs_x
; /*< X offset.*/
10 float ofs_y
; /*< Y offset.*/
11 float ofs_z
; /*< Z offset.*/
12 float diag_x
; /*< X diagonal (matrix 11).*/
13 float diag_y
; /*< Y diagonal (matrix 22).*/
14 float diag_z
; /*< Z diagonal (matrix 33).*/
15 float offdiag_x
; /*< X off-diagonal (matrix 12 and 21).*/
16 float offdiag_y
; /*< Y off-diagonal (matrix 13 and 31).*/
17 float offdiag_z
; /*< Z off-diagonal (matrix 32 and 23).*/
18 uint8_t compass_id
; /*< Compass being calibrated.*/
19 uint8_t cal_mask
; /*< Bitmask of compasses being calibrated.*/
20 uint8_t cal_status
; /*< Calibration Status.*/
21 uint8_t autosaved
; /*< 0=requires a MAV_CMD_DO_ACCEPT_MAG_CAL, 1=saved to parameters.*/
22 float orientation_confidence
; /*< Confidence in orientation (higher is better).*/
23 uint8_t old_orientation
; /*< orientation before calibration.*/
24 uint8_t new_orientation
; /*< orientation after calibration.*/
25 float scale_factor
; /*< field radius correction factor*/
26 }) mavlink_mag_cal_report_t
;
28 #define MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN 54
29 #define MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN 44
30 #define MAVLINK_MSG_ID_192_LEN 54
31 #define MAVLINK_MSG_ID_192_MIN_LEN 44
33 #define MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC 36
34 #define MAVLINK_MSG_ID_192_CRC 36
38 #if MAVLINK_COMMAND_24BIT
39 #define MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT { \
43 { { "compass_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_mag_cal_report_t, compass_id) }, \
44 { "cal_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_mag_cal_report_t, cal_mask) }, \
45 { "cal_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_mag_cal_report_t, cal_status) }, \
46 { "autosaved", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_mag_cal_report_t, autosaved) }, \
47 { "fitness", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mag_cal_report_t, fitness) }, \
48 { "ofs_x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mag_cal_report_t, ofs_x) }, \
49 { "ofs_y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mag_cal_report_t, ofs_y) }, \
50 { "ofs_z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mag_cal_report_t, ofs_z) }, \
51 { "diag_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_mag_cal_report_t, diag_x) }, \
52 { "diag_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_mag_cal_report_t, diag_y) }, \
53 { "diag_z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_mag_cal_report_t, diag_z) }, \
54 { "offdiag_x", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_mag_cal_report_t, offdiag_x) }, \
55 { "offdiag_y", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_mag_cal_report_t, offdiag_y) }, \
56 { "offdiag_z", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_mag_cal_report_t, offdiag_z) }, \
57 { "orientation_confidence", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_mag_cal_report_t, orientation_confidence) }, \
58 { "old_orientation", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_mag_cal_report_t, old_orientation) }, \
59 { "new_orientation", NULL, MAVLINK_TYPE_UINT8_T, 0, 49, offsetof(mavlink_mag_cal_report_t, new_orientation) }, \
60 { "scale_factor", NULL, MAVLINK_TYPE_FLOAT, 0, 50, offsetof(mavlink_mag_cal_report_t, scale_factor) }, \
64 #define MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT { \
67 { { "compass_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_mag_cal_report_t, compass_id) }, \
68 { "cal_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_mag_cal_report_t, cal_mask) }, \
69 { "cal_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_mag_cal_report_t, cal_status) }, \
70 { "autosaved", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_mag_cal_report_t, autosaved) }, \
71 { "fitness", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mag_cal_report_t, fitness) }, \
72 { "ofs_x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mag_cal_report_t, ofs_x) }, \
73 { "ofs_y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mag_cal_report_t, ofs_y) }, \
74 { "ofs_z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mag_cal_report_t, ofs_z) }, \
75 { "diag_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_mag_cal_report_t, diag_x) }, \
76 { "diag_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_mag_cal_report_t, diag_y) }, \
77 { "diag_z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_mag_cal_report_t, diag_z) }, \
78 { "offdiag_x", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_mag_cal_report_t, offdiag_x) }, \
79 { "offdiag_y", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_mag_cal_report_t, offdiag_y) }, \
80 { "offdiag_z", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_mag_cal_report_t, offdiag_z) }, \
81 { "orientation_confidence", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_mag_cal_report_t, orientation_confidence) }, \
82 { "old_orientation", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_mag_cal_report_t, old_orientation) }, \
83 { "new_orientation", NULL, MAVLINK_TYPE_UINT8_T, 0, 49, offsetof(mavlink_mag_cal_report_t, new_orientation) }, \
84 { "scale_factor", NULL, MAVLINK_TYPE_FLOAT, 0, 50, offsetof(mavlink_mag_cal_report_t, scale_factor) }, \
90 * @brief Pack a mag_cal_report message
91 * @param system_id ID of this system
92 * @param component_id ID of this component (e.g. 200 for IMU)
93 * @param msg The MAVLink message to compress the data into
95 * @param compass_id Compass being calibrated.
96 * @param cal_mask Bitmask of compasses being calibrated.
97 * @param cal_status Calibration Status.
98 * @param autosaved 0=requires a MAV_CMD_DO_ACCEPT_MAG_CAL, 1=saved to parameters.
99 * @param fitness [mgauss] RMS milligauss residuals.
100 * @param ofs_x X offset.
101 * @param ofs_y Y offset.
102 * @param ofs_z Z offset.
103 * @param diag_x X diagonal (matrix 11).
104 * @param diag_y Y diagonal (matrix 22).
105 * @param diag_z Z diagonal (matrix 33).
106 * @param offdiag_x X off-diagonal (matrix 12 and 21).
107 * @param offdiag_y Y off-diagonal (matrix 13 and 31).
108 * @param offdiag_z Z off-diagonal (matrix 32 and 23).
109 * @param orientation_confidence Confidence in orientation (higher is better).
110 * @param old_orientation orientation before calibration.
111 * @param new_orientation orientation after calibration.
112 * @param scale_factor field radius correction factor
113 * @return length of the message in bytes (excluding serial stream start sign)
115 static inline uint16_t mavlink_msg_mag_cal_report_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
116 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
, float orientation_confidence
, uint8_t old_orientation
, uint8_t new_orientation
, float scale_factor
)
118 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
119 char buf
[MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
];
120 _mav_put_float(buf
, 0, fitness
);
121 _mav_put_float(buf
, 4, ofs_x
);
122 _mav_put_float(buf
, 8, ofs_y
);
123 _mav_put_float(buf
, 12, ofs_z
);
124 _mav_put_float(buf
, 16, diag_x
);
125 _mav_put_float(buf
, 20, diag_y
);
126 _mav_put_float(buf
, 24, diag_z
);
127 _mav_put_float(buf
, 28, offdiag_x
);
128 _mav_put_float(buf
, 32, offdiag_y
);
129 _mav_put_float(buf
, 36, offdiag_z
);
130 _mav_put_uint8_t(buf
, 40, compass_id
);
131 _mav_put_uint8_t(buf
, 41, cal_mask
);
132 _mav_put_uint8_t(buf
, 42, cal_status
);
133 _mav_put_uint8_t(buf
, 43, autosaved
);
134 _mav_put_float(buf
, 44, orientation_confidence
);
135 _mav_put_uint8_t(buf
, 48, old_orientation
);
136 _mav_put_uint8_t(buf
, 49, new_orientation
);
137 _mav_put_float(buf
, 50, scale_factor
);
139 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
);
141 mavlink_mag_cal_report_t packet
;
142 packet
.fitness
= fitness
;
143 packet
.ofs_x
= ofs_x
;
144 packet
.ofs_y
= ofs_y
;
145 packet
.ofs_z
= ofs_z
;
146 packet
.diag_x
= diag_x
;
147 packet
.diag_y
= diag_y
;
148 packet
.diag_z
= diag_z
;
149 packet
.offdiag_x
= offdiag_x
;
150 packet
.offdiag_y
= offdiag_y
;
151 packet
.offdiag_z
= offdiag_z
;
152 packet
.compass_id
= compass_id
;
153 packet
.cal_mask
= cal_mask
;
154 packet
.cal_status
= cal_status
;
155 packet
.autosaved
= autosaved
;
156 packet
.orientation_confidence
= orientation_confidence
;
157 packet
.old_orientation
= old_orientation
;
158 packet
.new_orientation
= new_orientation
;
159 packet
.scale_factor
= scale_factor
;
161 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
);
164 msg
->msgid
= MAVLINK_MSG_ID_MAG_CAL_REPORT
;
165 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC
);
169 * @brief Pack a mag_cal_report message on a channel
170 * @param system_id ID of this system
171 * @param component_id ID of this component (e.g. 200 for IMU)
172 * @param chan The MAVLink channel this message will be sent over
173 * @param msg The MAVLink message to compress the data into
174 * @param compass_id Compass being calibrated.
175 * @param cal_mask Bitmask of compasses being calibrated.
176 * @param cal_status Calibration Status.
177 * @param autosaved 0=requires a MAV_CMD_DO_ACCEPT_MAG_CAL, 1=saved to parameters.
178 * @param fitness [mgauss] RMS milligauss residuals.
179 * @param ofs_x X offset.
180 * @param ofs_y Y offset.
181 * @param ofs_z Z offset.
182 * @param diag_x X diagonal (matrix 11).
183 * @param diag_y Y diagonal (matrix 22).
184 * @param diag_z Z diagonal (matrix 33).
185 * @param offdiag_x X off-diagonal (matrix 12 and 21).
186 * @param offdiag_y Y off-diagonal (matrix 13 and 31).
187 * @param offdiag_z Z off-diagonal (matrix 32 and 23).
188 * @param orientation_confidence Confidence in orientation (higher is better).
189 * @param old_orientation orientation before calibration.
190 * @param new_orientation orientation after calibration.
191 * @param scale_factor field radius correction factor
192 * @return length of the message in bytes (excluding serial stream start sign)
194 static inline uint16_t mavlink_msg_mag_cal_report_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
195 mavlink_message_t
* msg
,
196 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
,float orientation_confidence
,uint8_t old_orientation
,uint8_t new_orientation
,float scale_factor
)
198 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
199 char buf
[MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
];
200 _mav_put_float(buf
, 0, fitness
);
201 _mav_put_float(buf
, 4, ofs_x
);
202 _mav_put_float(buf
, 8, ofs_y
);
203 _mav_put_float(buf
, 12, ofs_z
);
204 _mav_put_float(buf
, 16, diag_x
);
205 _mav_put_float(buf
, 20, diag_y
);
206 _mav_put_float(buf
, 24, diag_z
);
207 _mav_put_float(buf
, 28, offdiag_x
);
208 _mav_put_float(buf
, 32, offdiag_y
);
209 _mav_put_float(buf
, 36, offdiag_z
);
210 _mav_put_uint8_t(buf
, 40, compass_id
);
211 _mav_put_uint8_t(buf
, 41, cal_mask
);
212 _mav_put_uint8_t(buf
, 42, cal_status
);
213 _mav_put_uint8_t(buf
, 43, autosaved
);
214 _mav_put_float(buf
, 44, orientation_confidence
);
215 _mav_put_uint8_t(buf
, 48, old_orientation
);
216 _mav_put_uint8_t(buf
, 49, new_orientation
);
217 _mav_put_float(buf
, 50, scale_factor
);
219 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
);
221 mavlink_mag_cal_report_t packet
;
222 packet
.fitness
= fitness
;
223 packet
.ofs_x
= ofs_x
;
224 packet
.ofs_y
= ofs_y
;
225 packet
.ofs_z
= ofs_z
;
226 packet
.diag_x
= diag_x
;
227 packet
.diag_y
= diag_y
;
228 packet
.diag_z
= diag_z
;
229 packet
.offdiag_x
= offdiag_x
;
230 packet
.offdiag_y
= offdiag_y
;
231 packet
.offdiag_z
= offdiag_z
;
232 packet
.compass_id
= compass_id
;
233 packet
.cal_mask
= cal_mask
;
234 packet
.cal_status
= cal_status
;
235 packet
.autosaved
= autosaved
;
236 packet
.orientation_confidence
= orientation_confidence
;
237 packet
.old_orientation
= old_orientation
;
238 packet
.new_orientation
= new_orientation
;
239 packet
.scale_factor
= scale_factor
;
241 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
);
244 msg
->msgid
= MAVLINK_MSG_ID_MAG_CAL_REPORT
;
245 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC
);
249 * @brief Encode a mag_cal_report struct
251 * @param system_id ID of this system
252 * @param component_id ID of this component (e.g. 200 for IMU)
253 * @param msg The MAVLink message to compress the data into
254 * @param mag_cal_report C-struct to read the message contents from
256 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
)
258 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
, mag_cal_report
->orientation_confidence
, mag_cal_report
->old_orientation
, mag_cal_report
->new_orientation
, mag_cal_report
->scale_factor
);
262 * @brief Encode a mag_cal_report struct on a channel
264 * @param system_id ID of this system
265 * @param component_id ID of this component (e.g. 200 for IMU)
266 * @param chan The MAVLink channel this message will be sent over
267 * @param msg The MAVLink message to compress the data into
268 * @param mag_cal_report C-struct to read the message contents from
270 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
)
272 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
, mag_cal_report
->orientation_confidence
, mag_cal_report
->old_orientation
, mag_cal_report
->new_orientation
, mag_cal_report
->scale_factor
);
276 * @brief Send a mag_cal_report message
277 * @param chan MAVLink channel to send the message
279 * @param compass_id Compass being calibrated.
280 * @param cal_mask Bitmask of compasses being calibrated.
281 * @param cal_status Calibration Status.
282 * @param autosaved 0=requires a MAV_CMD_DO_ACCEPT_MAG_CAL, 1=saved to parameters.
283 * @param fitness [mgauss] RMS milligauss residuals.
284 * @param ofs_x X offset.
285 * @param ofs_y Y offset.
286 * @param ofs_z Z offset.
287 * @param diag_x X diagonal (matrix 11).
288 * @param diag_y Y diagonal (matrix 22).
289 * @param diag_z Z diagonal (matrix 33).
290 * @param offdiag_x X off-diagonal (matrix 12 and 21).
291 * @param offdiag_y Y off-diagonal (matrix 13 and 31).
292 * @param offdiag_z Z off-diagonal (matrix 32 and 23).
293 * @param orientation_confidence Confidence in orientation (higher is better).
294 * @param old_orientation orientation before calibration.
295 * @param new_orientation orientation after calibration.
296 * @param scale_factor field radius correction factor
298 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
300 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
, float orientation_confidence
, uint8_t old_orientation
, uint8_t new_orientation
, float scale_factor
)
302 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
303 char buf
[MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
];
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 _mav_put_float(buf
, 44, orientation_confidence
);
319 _mav_put_uint8_t(buf
, 48, old_orientation
);
320 _mav_put_uint8_t(buf
, 49, new_orientation
);
321 _mav_put_float(buf
, 50, scale_factor
);
323 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_MAG_CAL_REPORT
, buf
, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC
);
325 mavlink_mag_cal_report_t packet
;
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 packet
.orientation_confidence
= orientation_confidence
;
341 packet
.old_orientation
= old_orientation
;
342 packet
.new_orientation
= new_orientation
;
343 packet
.scale_factor
= scale_factor
;
345 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_MAG_CAL_REPORT
, (const char *)&packet
, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC
);
350 * @brief Send a mag_cal_report message
351 * @param chan MAVLink channel to send the message
352 * @param struct The MAVLink struct to serialize
354 static inline void mavlink_msg_mag_cal_report_send_struct(mavlink_channel_t chan
, const mavlink_mag_cal_report_t
* mag_cal_report
)
356 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
357 mavlink_msg_mag_cal_report_send(chan
, 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
, mag_cal_report
->orientation_confidence
, mag_cal_report
->old_orientation
, mag_cal_report
->new_orientation
, mag_cal_report
->scale_factor
);
359 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_MAG_CAL_REPORT
, (const char *)mag_cal_report
, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC
);
363 #if MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
365 This varient of _send() can be used to save stack space by re-using
366 memory from the receive buffer. The caller provides a
367 mavlink_message_t which is the size of a full mavlink message. This
368 is usually the receive buffer for the channel, and allows a reply to an
369 incoming message with minimum stack space usage.
371 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
, float orientation_confidence
, uint8_t old_orientation
, uint8_t new_orientation
, float scale_factor
)
373 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
374 char *buf
= (char *)msgbuf
;
375 _mav_put_float(buf
, 0, fitness
);
376 _mav_put_float(buf
, 4, ofs_x
);
377 _mav_put_float(buf
, 8, ofs_y
);
378 _mav_put_float(buf
, 12, ofs_z
);
379 _mav_put_float(buf
, 16, diag_x
);
380 _mav_put_float(buf
, 20, diag_y
);
381 _mav_put_float(buf
, 24, diag_z
);
382 _mav_put_float(buf
, 28, offdiag_x
);
383 _mav_put_float(buf
, 32, offdiag_y
);
384 _mav_put_float(buf
, 36, offdiag_z
);
385 _mav_put_uint8_t(buf
, 40, compass_id
);
386 _mav_put_uint8_t(buf
, 41, cal_mask
);
387 _mav_put_uint8_t(buf
, 42, cal_status
);
388 _mav_put_uint8_t(buf
, 43, autosaved
);
389 _mav_put_float(buf
, 44, orientation_confidence
);
390 _mav_put_uint8_t(buf
, 48, old_orientation
);
391 _mav_put_uint8_t(buf
, 49, new_orientation
);
392 _mav_put_float(buf
, 50, scale_factor
);
394 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_MAG_CAL_REPORT
, buf
, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC
);
396 mavlink_mag_cal_report_t
*packet
= (mavlink_mag_cal_report_t
*)msgbuf
;
397 packet
->fitness
= fitness
;
398 packet
->ofs_x
= ofs_x
;
399 packet
->ofs_y
= ofs_y
;
400 packet
->ofs_z
= ofs_z
;
401 packet
->diag_x
= diag_x
;
402 packet
->diag_y
= diag_y
;
403 packet
->diag_z
= diag_z
;
404 packet
->offdiag_x
= offdiag_x
;
405 packet
->offdiag_y
= offdiag_y
;
406 packet
->offdiag_z
= offdiag_z
;
407 packet
->compass_id
= compass_id
;
408 packet
->cal_mask
= cal_mask
;
409 packet
->cal_status
= cal_status
;
410 packet
->autosaved
= autosaved
;
411 packet
->orientation_confidence
= orientation_confidence
;
412 packet
->old_orientation
= old_orientation
;
413 packet
->new_orientation
= new_orientation
;
414 packet
->scale_factor
= scale_factor
;
416 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_MAG_CAL_REPORT
, (const char *)packet
, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC
);
423 // MESSAGE MAG_CAL_REPORT UNPACKING
427 * @brief Get field compass_id from mag_cal_report message
429 * @return Compass being calibrated.
431 static inline uint8_t mavlink_msg_mag_cal_report_get_compass_id(const mavlink_message_t
* msg
)
433 return _MAV_RETURN_uint8_t(msg
, 40);
437 * @brief Get field cal_mask from mag_cal_report message
439 * @return Bitmask of compasses being calibrated.
441 static inline uint8_t mavlink_msg_mag_cal_report_get_cal_mask(const mavlink_message_t
* msg
)
443 return _MAV_RETURN_uint8_t(msg
, 41);
447 * @brief Get field cal_status from mag_cal_report message
449 * @return Calibration Status.
451 static inline uint8_t mavlink_msg_mag_cal_report_get_cal_status(const mavlink_message_t
* msg
)
453 return _MAV_RETURN_uint8_t(msg
, 42);
457 * @brief Get field autosaved from mag_cal_report message
459 * @return 0=requires a MAV_CMD_DO_ACCEPT_MAG_CAL, 1=saved to parameters.
461 static inline uint8_t mavlink_msg_mag_cal_report_get_autosaved(const mavlink_message_t
* msg
)
463 return _MAV_RETURN_uint8_t(msg
, 43);
467 * @brief Get field fitness from mag_cal_report message
469 * @return [mgauss] RMS milligauss residuals.
471 static inline float mavlink_msg_mag_cal_report_get_fitness(const mavlink_message_t
* msg
)
473 return _MAV_RETURN_float(msg
, 0);
477 * @brief Get field ofs_x from mag_cal_report message
481 static inline float mavlink_msg_mag_cal_report_get_ofs_x(const mavlink_message_t
* msg
)
483 return _MAV_RETURN_float(msg
, 4);
487 * @brief Get field ofs_y from mag_cal_report message
491 static inline float mavlink_msg_mag_cal_report_get_ofs_y(const mavlink_message_t
* msg
)
493 return _MAV_RETURN_float(msg
, 8);
497 * @brief Get field ofs_z from mag_cal_report message
501 static inline float mavlink_msg_mag_cal_report_get_ofs_z(const mavlink_message_t
* msg
)
503 return _MAV_RETURN_float(msg
, 12);
507 * @brief Get field diag_x from mag_cal_report message
509 * @return X diagonal (matrix 11).
511 static inline float mavlink_msg_mag_cal_report_get_diag_x(const mavlink_message_t
* msg
)
513 return _MAV_RETURN_float(msg
, 16);
517 * @brief Get field diag_y from mag_cal_report message
519 * @return Y diagonal (matrix 22).
521 static inline float mavlink_msg_mag_cal_report_get_diag_y(const mavlink_message_t
* msg
)
523 return _MAV_RETURN_float(msg
, 20);
527 * @brief Get field diag_z from mag_cal_report message
529 * @return Z diagonal (matrix 33).
531 static inline float mavlink_msg_mag_cal_report_get_diag_z(const mavlink_message_t
* msg
)
533 return _MAV_RETURN_float(msg
, 24);
537 * @brief Get field offdiag_x from mag_cal_report message
539 * @return X off-diagonal (matrix 12 and 21).
541 static inline float mavlink_msg_mag_cal_report_get_offdiag_x(const mavlink_message_t
* msg
)
543 return _MAV_RETURN_float(msg
, 28);
547 * @brief Get field offdiag_y from mag_cal_report message
549 * @return Y off-diagonal (matrix 13 and 31).
551 static inline float mavlink_msg_mag_cal_report_get_offdiag_y(const mavlink_message_t
* msg
)
553 return _MAV_RETURN_float(msg
, 32);
557 * @brief Get field offdiag_z from mag_cal_report message
559 * @return Z off-diagonal (matrix 32 and 23).
561 static inline float mavlink_msg_mag_cal_report_get_offdiag_z(const mavlink_message_t
* msg
)
563 return _MAV_RETURN_float(msg
, 36);
567 * @brief Get field orientation_confidence from mag_cal_report message
569 * @return Confidence in orientation (higher is better).
571 static inline float mavlink_msg_mag_cal_report_get_orientation_confidence(const mavlink_message_t
* msg
)
573 return _MAV_RETURN_float(msg
, 44);
577 * @brief Get field old_orientation from mag_cal_report message
579 * @return orientation before calibration.
581 static inline uint8_t mavlink_msg_mag_cal_report_get_old_orientation(const mavlink_message_t
* msg
)
583 return _MAV_RETURN_uint8_t(msg
, 48);
587 * @brief Get field new_orientation from mag_cal_report message
589 * @return orientation after calibration.
591 static inline uint8_t mavlink_msg_mag_cal_report_get_new_orientation(const mavlink_message_t
* msg
)
593 return _MAV_RETURN_uint8_t(msg
, 49);
597 * @brief Get field scale_factor from mag_cal_report message
599 * @return field radius correction factor
601 static inline float mavlink_msg_mag_cal_report_get_scale_factor(const mavlink_message_t
* msg
)
603 return _MAV_RETURN_float(msg
, 50);
607 * @brief Decode a mag_cal_report message into a struct
609 * @param msg The message to decode
610 * @param mag_cal_report C-struct to decode the message contents into
612 static inline void mavlink_msg_mag_cal_report_decode(const mavlink_message_t
* msg
, mavlink_mag_cal_report_t
* mag_cal_report
)
614 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
615 mag_cal_report
->fitness
= mavlink_msg_mag_cal_report_get_fitness(msg
);
616 mag_cal_report
->ofs_x
= mavlink_msg_mag_cal_report_get_ofs_x(msg
);
617 mag_cal_report
->ofs_y
= mavlink_msg_mag_cal_report_get_ofs_y(msg
);
618 mag_cal_report
->ofs_z
= mavlink_msg_mag_cal_report_get_ofs_z(msg
);
619 mag_cal_report
->diag_x
= mavlink_msg_mag_cal_report_get_diag_x(msg
);
620 mag_cal_report
->diag_y
= mavlink_msg_mag_cal_report_get_diag_y(msg
);
621 mag_cal_report
->diag_z
= mavlink_msg_mag_cal_report_get_diag_z(msg
);
622 mag_cal_report
->offdiag_x
= mavlink_msg_mag_cal_report_get_offdiag_x(msg
);
623 mag_cal_report
->offdiag_y
= mavlink_msg_mag_cal_report_get_offdiag_y(msg
);
624 mag_cal_report
->offdiag_z
= mavlink_msg_mag_cal_report_get_offdiag_z(msg
);
625 mag_cal_report
->compass_id
= mavlink_msg_mag_cal_report_get_compass_id(msg
);
626 mag_cal_report
->cal_mask
= mavlink_msg_mag_cal_report_get_cal_mask(msg
);
627 mag_cal_report
->cal_status
= mavlink_msg_mag_cal_report_get_cal_status(msg
);
628 mag_cal_report
->autosaved
= mavlink_msg_mag_cal_report_get_autosaved(msg
);
629 mag_cal_report
->orientation_confidence
= mavlink_msg_mag_cal_report_get_orientation_confidence(msg
);
630 mag_cal_report
->old_orientation
= mavlink_msg_mag_cal_report_get_old_orientation(msg
);
631 mag_cal_report
->new_orientation
= mavlink_msg_mag_cal_report_get_new_orientation(msg
);
632 mag_cal_report
->scale_factor
= mavlink_msg_mag_cal_report_get_scale_factor(msg
);
634 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
? msg
->len
: MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
;
635 memset(mag_cal_report
, 0, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN
);
636 memcpy(mag_cal_report
, _MAV_PAYLOAD(msg
), len
);