NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_compassmot_status.h
Go to the documentation of this file.
1 // MESSAGE COMPASSMOT_STATUS PACKING
2 
3 #define MAVLINK_MSG_ID_COMPASSMOT_STATUS 177
4 
6 {
7  float current;
8  float CompensationX;
9  float CompensationY;
10  float CompensationZ;
11  uint16_t throttle;
12  uint16_t interference;
14 
15 #define MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN 20
16 #define MAVLINK_MSG_ID_177_LEN 20
17 
18 #define MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC 240
19 #define MAVLINK_MSG_ID_177_CRC 240
20 
21 
22 
23 #define MAVLINK_MESSAGE_INFO_COMPASSMOT_STATUS { \
24  "COMPASSMOT_STATUS", \
25  6, \
26  { { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_compassmot_status_t, current) }, \
27  { "CompensationX", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_compassmot_status_t, CompensationX) }, \
28  { "CompensationY", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_compassmot_status_t, CompensationY) }, \
29  { "CompensationZ", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_compassmot_status_t, CompensationZ) }, \
30  { "throttle", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_compassmot_status_t, throttle) }, \
31  { "interference", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_compassmot_status_t, interference) }, \
32  } \
33 }
34 
35 
50 static inline uint16_t mavlink_msg_compassmot_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
51  uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ)
52 {
53 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55  _mav_put_float(buf, 0, current);
56  _mav_put_float(buf, 4, CompensationX);
57  _mav_put_float(buf, 8, CompensationY);
58  _mav_put_float(buf, 12, CompensationZ);
59  _mav_put_uint16_t(buf, 16, throttle);
60  _mav_put_uint16_t(buf, 18, interference);
61 
63 #else
65  packet.current = current;
66  packet.CompensationX = CompensationX;
67  packet.CompensationY = CompensationY;
68  packet.CompensationZ = CompensationZ;
69  packet.throttle = throttle;
70  packet.interference = interference;
71 
73 #endif
74 
76 #if MAVLINK_CRC_EXTRA
78 #else
79  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
80 #endif
81 }
82 
97 static inline uint16_t mavlink_msg_compassmot_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
98  mavlink_message_t* msg,
99  uint16_t throttle,float current,uint16_t interference,float CompensationX,float CompensationY,float CompensationZ)
100 {
101 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
103  _mav_put_float(buf, 0, current);
104  _mav_put_float(buf, 4, CompensationX);
105  _mav_put_float(buf, 8, CompensationY);
106  _mav_put_float(buf, 12, CompensationZ);
107  _mav_put_uint16_t(buf, 16, throttle);
108  _mav_put_uint16_t(buf, 18, interference);
109 
111 #else
113  packet.current = current;
114  packet.CompensationX = CompensationX;
115  packet.CompensationY = CompensationY;
116  packet.CompensationZ = CompensationZ;
117  packet.throttle = throttle;
118  packet.interference = interference;
119 
121 #endif
122 
124 #if MAVLINK_CRC_EXTRA
126 #else
127  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
128 #endif
129 }
130 
139 static inline uint16_t mavlink_msg_compassmot_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_compassmot_status_t* compassmot_status)
140 {
141  return mavlink_msg_compassmot_status_pack(system_id, component_id, msg, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ);
142 }
143 
153 static inline uint16_t mavlink_msg_compassmot_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_compassmot_status_t* compassmot_status)
154 {
155  return mavlink_msg_compassmot_status_pack_chan(system_id, component_id, chan, msg, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ);
156 }
157 
169 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
170 
171 static inline void mavlink_msg_compassmot_status_send(mavlink_channel_t chan, uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ)
172 {
173 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
175  _mav_put_float(buf, 0, current);
176  _mav_put_float(buf, 4, CompensationX);
177  _mav_put_float(buf, 8, CompensationY);
178  _mav_put_float(buf, 12, CompensationZ);
179  _mav_put_uint16_t(buf, 16, throttle);
180  _mav_put_uint16_t(buf, 18, interference);
181 
182 #if MAVLINK_CRC_EXTRA
184 #else
185  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
186 #endif
187 #else
189  packet.current = current;
190  packet.CompensationX = CompensationX;
191  packet.CompensationY = CompensationY;
192  packet.CompensationZ = CompensationZ;
193  packet.throttle = throttle;
194  packet.interference = interference;
195 
196 #if MAVLINK_CRC_EXTRA
197  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
198 #else
199  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
200 #endif
201 #endif
202 }
203 
204 #if MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
205 /*
206  This varient of _send() can be used to save stack space by re-using
207  memory from the receive buffer. The caller provides a
208  mavlink_message_t which is the size of a full mavlink message. This
209  is usually the receive buffer for the channel, and allows a reply to an
210  incoming message with minimum stack space usage.
211  */
212 static inline void mavlink_msg_compassmot_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ)
213 {
214 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
215  char *buf = (char *)msgbuf;
216  _mav_put_float(buf, 0, current);
217  _mav_put_float(buf, 4, CompensationX);
218  _mav_put_float(buf, 8, CompensationY);
219  _mav_put_float(buf, 12, CompensationZ);
220  _mav_put_uint16_t(buf, 16, throttle);
221  _mav_put_uint16_t(buf, 18, interference);
222 
223 #if MAVLINK_CRC_EXTRA
225 #else
226  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
227 #endif
228 #else
230  packet->current = current;
231  packet->CompensationX = CompensationX;
232  packet->CompensationY = CompensationY;
233  packet->CompensationZ = CompensationZ;
234  packet->throttle = throttle;
235  packet->interference = interference;
236 
237 #if MAVLINK_CRC_EXTRA
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
239 #else
240  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
241 #endif
242 #endif
243 }
244 #endif
245 
246 #endif
247 
248 // MESSAGE COMPASSMOT_STATUS UNPACKING
249 
250 
256 static inline uint16_t mavlink_msg_compassmot_status_get_throttle(const mavlink_message_t* msg)
257 {
258  return _MAV_RETURN_uint16_t(msg, 16);
259 }
260 
266 static inline float mavlink_msg_compassmot_status_get_current(const mavlink_message_t* msg)
267 {
268  return _MAV_RETURN_float(msg, 0);
269 }
270 
276 static inline uint16_t mavlink_msg_compassmot_status_get_interference(const mavlink_message_t* msg)
277 {
278  return _MAV_RETURN_uint16_t(msg, 18);
279 }
280 
286 static inline float mavlink_msg_compassmot_status_get_CompensationX(const mavlink_message_t* msg)
287 {
288  return _MAV_RETURN_float(msg, 4);
289 }
290 
296 static inline float mavlink_msg_compassmot_status_get_CompensationY(const mavlink_message_t* msg)
297 {
298  return _MAV_RETURN_float(msg, 8);
299 }
300 
306 static inline float mavlink_msg_compassmot_status_get_CompensationZ(const mavlink_message_t* msg)
307 {
308  return _MAV_RETURN_float(msg, 12);
309 }
310 
317 static inline void mavlink_msg_compassmot_status_decode(const mavlink_message_t* msg, mavlink_compassmot_status_t* compassmot_status)
318 {
319 #if MAVLINK_NEED_BYTE_SWAP
320  compassmot_status->current = mavlink_msg_compassmot_status_get_current(msg);
321  compassmot_status->CompensationX = mavlink_msg_compassmot_status_get_CompensationX(msg);
322  compassmot_status->CompensationY = mavlink_msg_compassmot_status_get_CompensationY(msg);
323  compassmot_status->CompensationZ = mavlink_msg_compassmot_status_get_CompensationZ(msg);
324  compassmot_status->throttle = mavlink_msg_compassmot_status_get_throttle(msg);
325  compassmot_status->interference = mavlink_msg_compassmot_status_get_interference(msg);
326 #else
327  memcpy(compassmot_status, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
328 #endif
329 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
struct throttle_correction_config throttle
Definition: config.h:98
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139