RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_compassmot_status.h
1#pragma once
2// MESSAGE COMPASSMOT_STATUS PACKING
3
4#define MAVLINK_MSG_ID_COMPASSMOT_STATUS 177
5
6MAVPACKED(
7typedef struct __mavlink_compassmot_status_t {
8 float current; /*< current (Ampere)*/
9 float CompensationX; /*< Motor Compensation X*/
10 float CompensationY; /*< Motor Compensation Y*/
11 float CompensationZ; /*< Motor Compensation Z*/
12 uint16_t throttle; /*< throttle (percent*10)*/
13 uint16_t interference; /*< interference (percent)*/
14}) mavlink_compassmot_status_t;
15
16#define MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN 20
17#define MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN 20
18#define MAVLINK_MSG_ID_177_LEN 20
19#define MAVLINK_MSG_ID_177_MIN_LEN 20
20
21#define MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC 240
22#define MAVLINK_MSG_ID_177_CRC 240
23
24
25
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_COMPASSMOT_STATUS { \
28 177, \
29 "COMPASSMOT_STATUS", \
30 6, \
31 { { "throttle", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_compassmot_status_t, throttle) }, \
32 { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_compassmot_status_t, current) }, \
33 { "interference", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_compassmot_status_t, interference) }, \
34 { "CompensationX", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_compassmot_status_t, CompensationX) }, \
35 { "CompensationY", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_compassmot_status_t, CompensationY) }, \
36 { "CompensationZ", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_compassmot_status_t, CompensationZ) }, \
37 } \
38}
39#else
40#define MAVLINK_MESSAGE_INFO_COMPASSMOT_STATUS { \
41 "COMPASSMOT_STATUS", \
42 6, \
43 { { "throttle", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_compassmot_status_t, throttle) }, \
44 { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_compassmot_status_t, current) }, \
45 { "interference", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_compassmot_status_t, interference) }, \
46 { "CompensationX", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_compassmot_status_t, CompensationX) }, \
47 { "CompensationY", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_compassmot_status_t, CompensationY) }, \
48 { "CompensationZ", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_compassmot_status_t, CompensationZ) }, \
49 } \
50}
51#endif
52
67static inline uint16_t mavlink_msg_compassmot_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
68 uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ)
69{
70#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
71 char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN];
72 _mav_put_float(buf, 0, current);
73 _mav_put_float(buf, 4, CompensationX);
74 _mav_put_float(buf, 8, CompensationY);
75 _mav_put_float(buf, 12, CompensationZ);
76 _mav_put_uint16_t(buf, 16, throttle);
77 _mav_put_uint16_t(buf, 18, interference);
78
79 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
80#else
81 mavlink_compassmot_status_t packet;
82 packet.current = current;
83 packet.CompensationX = CompensationX;
84 packet.CompensationY = CompensationY;
85 packet.CompensationZ = CompensationZ;
86 packet.throttle = throttle;
87 packet.interference = interference;
88
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
90#endif
91
92 msg->msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS;
93 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
94}
95
110static inline uint16_t mavlink_msg_compassmot_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
111 mavlink_message_t* msg,
112 uint16_t throttle,float current,uint16_t interference,float CompensationX,float CompensationY,float CompensationZ)
113{
114#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
115 char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN];
116 _mav_put_float(buf, 0, current);
117 _mav_put_float(buf, 4, CompensationX);
118 _mav_put_float(buf, 8, CompensationY);
119 _mav_put_float(buf, 12, CompensationZ);
120 _mav_put_uint16_t(buf, 16, throttle);
121 _mav_put_uint16_t(buf, 18, interference);
122
123 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
124#else
125 mavlink_compassmot_status_t packet;
126 packet.current = current;
127 packet.CompensationX = CompensationX;
128 packet.CompensationY = CompensationY;
129 packet.CompensationZ = CompensationZ;
130 packet.throttle = throttle;
131 packet.interference = interference;
132
133 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
134#endif
135
136 msg->msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS;
137 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
138}
139
148static 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)
149{
150 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);
151}
152
162static 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)
163{
164 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);
165}
166
178#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179
180static 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)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN];
184 _mav_put_float(buf, 0, current);
185 _mav_put_float(buf, 4, CompensationX);
186 _mav_put_float(buf, 8, CompensationY);
187 _mav_put_float(buf, 12, CompensationZ);
188 _mav_put_uint16_t(buf, 16, throttle);
189 _mav_put_uint16_t(buf, 18, interference);
190
191 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
192#else
193 mavlink_compassmot_status_t packet;
194 packet.current = current;
195 packet.CompensationX = CompensationX;
196 packet.CompensationY = CompensationY;
197 packet.CompensationZ = CompensationZ;
198 packet.throttle = throttle;
199 packet.interference = interference;
200
201 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
202#endif
203}
204
210static inline void mavlink_msg_compassmot_status_send_struct(mavlink_channel_t chan, const mavlink_compassmot_status_t* compassmot_status)
211{
212#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
213 mavlink_msg_compassmot_status_send(chan, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ);
214#else
215 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)compassmot_status, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
216#endif
217}
218
219#if MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
220/*
221 This varient of _send() can be used to save stack space by re-using
222 memory from the receive buffer. The caller provides a
223 mavlink_message_t which is the size of a full mavlink message. This
224 is usually the receive buffer for the channel, and allows a reply to an
225 incoming message with minimum stack space usage.
226 */
227static 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)
228{
229#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
230 char *buf = (char *)msgbuf;
231 _mav_put_float(buf, 0, current);
232 _mav_put_float(buf, 4, CompensationX);
233 _mav_put_float(buf, 8, CompensationY);
234 _mav_put_float(buf, 12, CompensationZ);
235 _mav_put_uint16_t(buf, 16, throttle);
236 _mav_put_uint16_t(buf, 18, interference);
237
238 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
239#else
240 mavlink_compassmot_status_t *packet = (mavlink_compassmot_status_t *)msgbuf;
241 packet->current = current;
242 packet->CompensationX = CompensationX;
243 packet->CompensationY = CompensationY;
244 packet->CompensationZ = CompensationZ;
245 packet->throttle = throttle;
246 packet->interference = interference;
247
248 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC);
249#endif
250}
251#endif
252
253#endif
254
255// MESSAGE COMPASSMOT_STATUS UNPACKING
256
257
263static inline uint16_t mavlink_msg_compassmot_status_get_throttle(const mavlink_message_t* msg)
264{
265 return _MAV_RETURN_uint16_t(msg, 16);
266}
267
273static inline float mavlink_msg_compassmot_status_get_current(const mavlink_message_t* msg)
274{
275 return _MAV_RETURN_float(msg, 0);
276}
277
283static inline uint16_t mavlink_msg_compassmot_status_get_interference(const mavlink_message_t* msg)
284{
285 return _MAV_RETURN_uint16_t(msg, 18);
286}
287
293static inline float mavlink_msg_compassmot_status_get_CompensationX(const mavlink_message_t* msg)
294{
295 return _MAV_RETURN_float(msg, 4);
296}
297
303static inline float mavlink_msg_compassmot_status_get_CompensationY(const mavlink_message_t* msg)
304{
305 return _MAV_RETURN_float(msg, 8);
306}
307
313static inline float mavlink_msg_compassmot_status_get_CompensationZ(const mavlink_message_t* msg)
314{
315 return _MAV_RETURN_float(msg, 12);
316}
317
324static inline void mavlink_msg_compassmot_status_decode(const mavlink_message_t* msg, mavlink_compassmot_status_t* compassmot_status)
325{
326#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
327 compassmot_status->current = mavlink_msg_compassmot_status_get_current(msg);
328 compassmot_status->CompensationX = mavlink_msg_compassmot_status_get_CompensationX(msg);
329 compassmot_status->CompensationY = mavlink_msg_compassmot_status_get_CompensationY(msg);
330 compassmot_status->CompensationZ = mavlink_msg_compassmot_status_get_CompensationZ(msg);
331 compassmot_status->throttle = mavlink_msg_compassmot_status_get_throttle(msg);
332 compassmot_status->interference = mavlink_msg_compassmot_status_get_interference(msg);
333#else
334 uint8_t len = msg->len < MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN? msg->len : MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN;
335 memset(compassmot_status, 0, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN);
336 memcpy(compassmot_status, _MAV_PAYLOAD(msg), len);
337#endif
338}