NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_sens_mppt.h
Go to the documentation of this file.
1 // MESSAGE SENS_MPPT PACKING
2 
3 #define MAVLINK_MSG_ID_SENS_MPPT 202
4 
5 typedef struct __mavlink_sens_mppt_t
6 {
7  uint64_t mppt_timestamp;
8  float mppt1_volt;
9  float mppt1_amp;
10  float mppt2_volt;
11  float mppt2_amp;
12  float mppt3_volt;
13  float mppt3_amp;
14  uint16_t mppt1_pwm;
15  uint16_t mppt2_pwm;
16  uint16_t mppt3_pwm;
17  uint8_t mppt1_status;
18  uint8_t mppt2_status;
19  uint8_t mppt3_status;
21 
22 #define MAVLINK_MSG_ID_SENS_MPPT_LEN 41
23 #define MAVLINK_MSG_ID_202_LEN 41
24 
25 #define MAVLINK_MSG_ID_SENS_MPPT_CRC 231
26 #define MAVLINK_MSG_ID_202_CRC 231
27 
28 
29 
30 #define MAVLINK_MESSAGE_INFO_SENS_MPPT { \
31  "SENS_MPPT", \
32  13, \
33  { { "mppt_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_mppt_t, mppt_timestamp) }, \
34  { "mppt1_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_mppt_t, mppt1_volt) }, \
35  { "mppt1_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_mppt_t, mppt1_amp) }, \
36  { "mppt2_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sens_mppt_t, mppt2_volt) }, \
37  { "mppt2_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sens_mppt_t, mppt2_amp) }, \
38  { "mppt3_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sens_mppt_t, mppt3_volt) }, \
39  { "mppt3_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sens_mppt_t, mppt3_amp) }, \
40  { "mppt1_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_sens_mppt_t, mppt1_pwm) }, \
41  { "mppt2_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_sens_mppt_t, mppt2_pwm) }, \
42  { "mppt3_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_sens_mppt_t, mppt3_pwm) }, \
43  { "mppt1_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_sens_mppt_t, mppt1_status) }, \
44  { "mppt2_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_sens_mppt_t, mppt2_status) }, \
45  { "mppt3_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_sens_mppt_t, mppt3_status) }, \
46  } \
47 }
48 
49 
71 static inline uint16_t mavlink_msg_sens_mppt_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72  uint64_t mppt_timestamp, float mppt1_volt, float mppt1_amp, uint16_t mppt1_pwm, uint8_t mppt1_status, float mppt2_volt, float mppt2_amp, uint16_t mppt2_pwm, uint8_t mppt2_status, float mppt3_volt, float mppt3_amp, uint16_t mppt3_pwm, uint8_t mppt3_status)
73 {
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
76  _mav_put_uint64_t(buf, 0, mppt_timestamp);
77  _mav_put_float(buf, 8, mppt1_volt);
78  _mav_put_float(buf, 12, mppt1_amp);
79  _mav_put_float(buf, 16, mppt2_volt);
80  _mav_put_float(buf, 20, mppt2_amp);
81  _mav_put_float(buf, 24, mppt3_volt);
82  _mav_put_float(buf, 28, mppt3_amp);
83  _mav_put_uint16_t(buf, 32, mppt1_pwm);
84  _mav_put_uint16_t(buf, 34, mppt2_pwm);
85  _mav_put_uint16_t(buf, 36, mppt3_pwm);
86  _mav_put_uint8_t(buf, 38, mppt1_status);
87  _mav_put_uint8_t(buf, 39, mppt2_status);
88  _mav_put_uint8_t(buf, 40, mppt3_status);
89 
91 #else
92  mavlink_sens_mppt_t packet;
93  packet.mppt_timestamp = mppt_timestamp;
94  packet.mppt1_volt = mppt1_volt;
95  packet.mppt1_amp = mppt1_amp;
96  packet.mppt2_volt = mppt2_volt;
97  packet.mppt2_amp = mppt2_amp;
98  packet.mppt3_volt = mppt3_volt;
99  packet.mppt3_amp = mppt3_amp;
100  packet.mppt1_pwm = mppt1_pwm;
101  packet.mppt2_pwm = mppt2_pwm;
102  packet.mppt3_pwm = mppt3_pwm;
103  packet.mppt1_status = mppt1_status;
104  packet.mppt2_status = mppt2_status;
105  packet.mppt3_status = mppt3_status;
106 
108 #endif
109 
110  msg->msgid = MAVLINK_MSG_ID_SENS_MPPT;
111 #if MAVLINK_CRC_EXTRA
113 #else
114  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENS_MPPT_LEN);
115 #endif
116 }
117 
139 static inline uint16_t mavlink_msg_sens_mppt_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
140  mavlink_message_t* msg,
141  uint64_t mppt_timestamp,float mppt1_volt,float mppt1_amp,uint16_t mppt1_pwm,uint8_t mppt1_status,float mppt2_volt,float mppt2_amp,uint16_t mppt2_pwm,uint8_t mppt2_status,float mppt3_volt,float mppt3_amp,uint16_t mppt3_pwm,uint8_t mppt3_status)
142 {
143 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
145  _mav_put_uint64_t(buf, 0, mppt_timestamp);
146  _mav_put_float(buf, 8, mppt1_volt);
147  _mav_put_float(buf, 12, mppt1_amp);
148  _mav_put_float(buf, 16, mppt2_volt);
149  _mav_put_float(buf, 20, mppt2_amp);
150  _mav_put_float(buf, 24, mppt3_volt);
151  _mav_put_float(buf, 28, mppt3_amp);
152  _mav_put_uint16_t(buf, 32, mppt1_pwm);
153  _mav_put_uint16_t(buf, 34, mppt2_pwm);
154  _mav_put_uint16_t(buf, 36, mppt3_pwm);
155  _mav_put_uint8_t(buf, 38, mppt1_status);
156  _mav_put_uint8_t(buf, 39, mppt2_status);
157  _mav_put_uint8_t(buf, 40, mppt3_status);
158 
160 #else
161  mavlink_sens_mppt_t packet;
162  packet.mppt_timestamp = mppt_timestamp;
163  packet.mppt1_volt = mppt1_volt;
164  packet.mppt1_amp = mppt1_amp;
165  packet.mppt2_volt = mppt2_volt;
166  packet.mppt2_amp = mppt2_amp;
167  packet.mppt3_volt = mppt3_volt;
168  packet.mppt3_amp = mppt3_amp;
169  packet.mppt1_pwm = mppt1_pwm;
170  packet.mppt2_pwm = mppt2_pwm;
171  packet.mppt3_pwm = mppt3_pwm;
172  packet.mppt1_status = mppt1_status;
173  packet.mppt2_status = mppt2_status;
174  packet.mppt3_status = mppt3_status;
175 
177 #endif
178 
179  msg->msgid = MAVLINK_MSG_ID_SENS_MPPT;
180 #if MAVLINK_CRC_EXTRA
182 #else
183  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENS_MPPT_LEN);
184 #endif
185 }
186 
195 static inline uint16_t mavlink_msg_sens_mppt_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sens_mppt_t* sens_mppt)
196 {
197  return mavlink_msg_sens_mppt_pack(system_id, component_id, msg, sens_mppt->mppt_timestamp, sens_mppt->mppt1_volt, sens_mppt->mppt1_amp, sens_mppt->mppt1_pwm, sens_mppt->mppt1_status, sens_mppt->mppt2_volt, sens_mppt->mppt2_amp, sens_mppt->mppt2_pwm, sens_mppt->mppt2_status, sens_mppt->mppt3_volt, sens_mppt->mppt3_amp, sens_mppt->mppt3_pwm, sens_mppt->mppt3_status);
198 }
199 
209 static inline uint16_t mavlink_msg_sens_mppt_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sens_mppt_t* sens_mppt)
210 {
211  return mavlink_msg_sens_mppt_pack_chan(system_id, component_id, chan, msg, sens_mppt->mppt_timestamp, sens_mppt->mppt1_volt, sens_mppt->mppt1_amp, sens_mppt->mppt1_pwm, sens_mppt->mppt1_status, sens_mppt->mppt2_volt, sens_mppt->mppt2_amp, sens_mppt->mppt2_pwm, sens_mppt->mppt2_status, sens_mppt->mppt3_volt, sens_mppt->mppt3_amp, sens_mppt->mppt3_pwm, sens_mppt->mppt3_status);
212 }
213 
232 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
233 
234 static inline void mavlink_msg_sens_mppt_send(mavlink_channel_t chan, uint64_t mppt_timestamp, float mppt1_volt, float mppt1_amp, uint16_t mppt1_pwm, uint8_t mppt1_status, float mppt2_volt, float mppt2_amp, uint16_t mppt2_pwm, uint8_t mppt2_status, float mppt3_volt, float mppt3_amp, uint16_t mppt3_pwm, uint8_t mppt3_status)
235 {
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
238  _mav_put_uint64_t(buf, 0, mppt_timestamp);
239  _mav_put_float(buf, 8, mppt1_volt);
240  _mav_put_float(buf, 12, mppt1_amp);
241  _mav_put_float(buf, 16, mppt2_volt);
242  _mav_put_float(buf, 20, mppt2_amp);
243  _mav_put_float(buf, 24, mppt3_volt);
244  _mav_put_float(buf, 28, mppt3_amp);
245  _mav_put_uint16_t(buf, 32, mppt1_pwm);
246  _mav_put_uint16_t(buf, 34, mppt2_pwm);
247  _mav_put_uint16_t(buf, 36, mppt3_pwm);
248  _mav_put_uint8_t(buf, 38, mppt1_status);
249  _mav_put_uint8_t(buf, 39, mppt2_status);
250  _mav_put_uint8_t(buf, 40, mppt3_status);
251 
252 #if MAVLINK_CRC_EXTRA
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, buf, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC);
254 #else
255  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, buf, MAVLINK_MSG_ID_SENS_MPPT_LEN);
256 #endif
257 #else
258  mavlink_sens_mppt_t packet;
259  packet.mppt_timestamp = mppt_timestamp;
260  packet.mppt1_volt = mppt1_volt;
261  packet.mppt1_amp = mppt1_amp;
262  packet.mppt2_volt = mppt2_volt;
263  packet.mppt2_amp = mppt2_amp;
264  packet.mppt3_volt = mppt3_volt;
265  packet.mppt3_amp = mppt3_amp;
266  packet.mppt1_pwm = mppt1_pwm;
267  packet.mppt2_pwm = mppt2_pwm;
268  packet.mppt3_pwm = mppt3_pwm;
269  packet.mppt1_status = mppt1_status;
270  packet.mppt2_status = mppt2_status;
271  packet.mppt3_status = mppt3_status;
272 
273 #if MAVLINK_CRC_EXTRA
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, (const char *)&packet, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC);
275 #else
276  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, (const char *)&packet, MAVLINK_MSG_ID_SENS_MPPT_LEN);
277 #endif
278 #endif
279 }
280 
281 #if MAVLINK_MSG_ID_SENS_MPPT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
282 /*
283  This varient of _send() can be used to save stack space by re-using
284  memory from the receive buffer. The caller provides a
285  mavlink_message_t which is the size of a full mavlink message. This
286  is usually the receive buffer for the channel, and allows a reply to an
287  incoming message with minimum stack space usage.
288  */
289 static inline void mavlink_msg_sens_mppt_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t mppt_timestamp, float mppt1_volt, float mppt1_amp, uint16_t mppt1_pwm, uint8_t mppt1_status, float mppt2_volt, float mppt2_amp, uint16_t mppt2_pwm, uint8_t mppt2_status, float mppt3_volt, float mppt3_amp, uint16_t mppt3_pwm, uint8_t mppt3_status)
290 {
291 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
292  char *buf = (char *)msgbuf;
293  _mav_put_uint64_t(buf, 0, mppt_timestamp);
294  _mav_put_float(buf, 8, mppt1_volt);
295  _mav_put_float(buf, 12, mppt1_amp);
296  _mav_put_float(buf, 16, mppt2_volt);
297  _mav_put_float(buf, 20, mppt2_amp);
298  _mav_put_float(buf, 24, mppt3_volt);
299  _mav_put_float(buf, 28, mppt3_amp);
300  _mav_put_uint16_t(buf, 32, mppt1_pwm);
301  _mav_put_uint16_t(buf, 34, mppt2_pwm);
302  _mav_put_uint16_t(buf, 36, mppt3_pwm);
303  _mav_put_uint8_t(buf, 38, mppt1_status);
304  _mav_put_uint8_t(buf, 39, mppt2_status);
305  _mav_put_uint8_t(buf, 40, mppt3_status);
306 
307 #if MAVLINK_CRC_EXTRA
308  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, buf, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC);
309 #else
310  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, buf, MAVLINK_MSG_ID_SENS_MPPT_LEN);
311 #endif
312 #else
313  mavlink_sens_mppt_t *packet = (mavlink_sens_mppt_t *)msgbuf;
314  packet->mppt_timestamp = mppt_timestamp;
315  packet->mppt1_volt = mppt1_volt;
316  packet->mppt1_amp = mppt1_amp;
317  packet->mppt2_volt = mppt2_volt;
318  packet->mppt2_amp = mppt2_amp;
319  packet->mppt3_volt = mppt3_volt;
320  packet->mppt3_amp = mppt3_amp;
321  packet->mppt1_pwm = mppt1_pwm;
322  packet->mppt2_pwm = mppt2_pwm;
323  packet->mppt3_pwm = mppt3_pwm;
324  packet->mppt1_status = mppt1_status;
325  packet->mppt2_status = mppt2_status;
326  packet->mppt3_status = mppt3_status;
327 
328 #if MAVLINK_CRC_EXTRA
329  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, (const char *)packet, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC);
330 #else
331  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, (const char *)packet, MAVLINK_MSG_ID_SENS_MPPT_LEN);
332 #endif
333 #endif
334 }
335 #endif
336 
337 #endif
338 
339 // MESSAGE SENS_MPPT UNPACKING
340 
341 
347 static inline uint64_t mavlink_msg_sens_mppt_get_mppt_timestamp(const mavlink_message_t* msg)
348 {
349  return _MAV_RETURN_uint64_t(msg, 0);
350 }
351 
357 static inline float mavlink_msg_sens_mppt_get_mppt1_volt(const mavlink_message_t* msg)
358 {
359  return _MAV_RETURN_float(msg, 8);
360 }
361 
367 static inline float mavlink_msg_sens_mppt_get_mppt1_amp(const mavlink_message_t* msg)
368 {
369  return _MAV_RETURN_float(msg, 12);
370 }
371 
377 static inline uint16_t mavlink_msg_sens_mppt_get_mppt1_pwm(const mavlink_message_t* msg)
378 {
379  return _MAV_RETURN_uint16_t(msg, 32);
380 }
381 
387 static inline uint8_t mavlink_msg_sens_mppt_get_mppt1_status(const mavlink_message_t* msg)
388 {
389  return _MAV_RETURN_uint8_t(msg, 38);
390 }
391 
397 static inline float mavlink_msg_sens_mppt_get_mppt2_volt(const mavlink_message_t* msg)
398 {
399  return _MAV_RETURN_float(msg, 16);
400 }
401 
407 static inline float mavlink_msg_sens_mppt_get_mppt2_amp(const mavlink_message_t* msg)
408 {
409  return _MAV_RETURN_float(msg, 20);
410 }
411 
417 static inline uint16_t mavlink_msg_sens_mppt_get_mppt2_pwm(const mavlink_message_t* msg)
418 {
419  return _MAV_RETURN_uint16_t(msg, 34);
420 }
421 
427 static inline uint8_t mavlink_msg_sens_mppt_get_mppt2_status(const mavlink_message_t* msg)
428 {
429  return _MAV_RETURN_uint8_t(msg, 39);
430 }
431 
437 static inline float mavlink_msg_sens_mppt_get_mppt3_volt(const mavlink_message_t* msg)
438 {
439  return _MAV_RETURN_float(msg, 24);
440 }
441 
447 static inline float mavlink_msg_sens_mppt_get_mppt3_amp(const mavlink_message_t* msg)
448 {
449  return _MAV_RETURN_float(msg, 28);
450 }
451 
457 static inline uint16_t mavlink_msg_sens_mppt_get_mppt3_pwm(const mavlink_message_t* msg)
458 {
459  return _MAV_RETURN_uint16_t(msg, 36);
460 }
461 
467 static inline uint8_t mavlink_msg_sens_mppt_get_mppt3_status(const mavlink_message_t* msg)
468 {
469  return _MAV_RETURN_uint8_t(msg, 40);
470 }
471 
478 static inline void mavlink_msg_sens_mppt_decode(const mavlink_message_t* msg, mavlink_sens_mppt_t* sens_mppt)
479 {
480 #if MAVLINK_NEED_BYTE_SWAP
481  sens_mppt->mppt_timestamp = mavlink_msg_sens_mppt_get_mppt_timestamp(msg);
482  sens_mppt->mppt1_volt = mavlink_msg_sens_mppt_get_mppt1_volt(msg);
483  sens_mppt->mppt1_amp = mavlink_msg_sens_mppt_get_mppt1_amp(msg);
484  sens_mppt->mppt2_volt = mavlink_msg_sens_mppt_get_mppt2_volt(msg);
485  sens_mppt->mppt2_amp = mavlink_msg_sens_mppt_get_mppt2_amp(msg);
486  sens_mppt->mppt3_volt = mavlink_msg_sens_mppt_get_mppt3_volt(msg);
487  sens_mppt->mppt3_amp = mavlink_msg_sens_mppt_get_mppt3_amp(msg);
488  sens_mppt->mppt1_pwm = mavlink_msg_sens_mppt_get_mppt1_pwm(msg);
489  sens_mppt->mppt2_pwm = mavlink_msg_sens_mppt_get_mppt2_pwm(msg);
490  sens_mppt->mppt3_pwm = mavlink_msg_sens_mppt_get_mppt3_pwm(msg);
491  sens_mppt->mppt1_status = mavlink_msg_sens_mppt_get_mppt1_status(msg);
492  sens_mppt->mppt2_status = mavlink_msg_sens_mppt_get_mppt2_status(msg);
493  sens_mppt->mppt3_status = mavlink_msg_sens_mppt_get_mppt3_status(msg);
494 #else
495  memcpy(sens_mppt, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SENS_MPPT_LEN);
496 #endif
497 }
#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
#define _mav_put_uint64_t(buf, wire_offset, b)
Definition: protocol.h:143
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139