RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_battery_status.h
1#pragma once
2// MESSAGE BATTERY_STATUS PACKING
3
4#define MAVLINK_MSG_ID_BATTERY_STATUS 147
5
6MAVPACKED(
7typedef struct __mavlink_battery_status_t {
8 int32_t current_consumed; /*< Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate*/
9 int32_t energy_consumed; /*< Consumed energy, in HectoJoules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate*/
10 int16_t temperature; /*< Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.*/
11 uint16_t voltages[10]; /*< Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.*/
12 int16_t current_battery; /*< Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current*/
13 uint8_t id; /*< Battery ID*/
14 uint8_t battery_function; /*< Function of the battery*/
15 uint8_t type; /*< Type (chemistry) of the battery*/
16 int8_t battery_remaining; /*< Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery*/
17}) mavlink_battery_status_t;
18
19#define MAVLINK_MSG_ID_BATTERY_STATUS_LEN 36
20#define MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN 36
21#define MAVLINK_MSG_ID_147_LEN 36
22#define MAVLINK_MSG_ID_147_MIN_LEN 36
23
24#define MAVLINK_MSG_ID_BATTERY_STATUS_CRC 154
25#define MAVLINK_MSG_ID_147_CRC 154
26
27#define MAVLINK_MSG_BATTERY_STATUS_FIELD_VOLTAGES_LEN 10
28
29#if MAVLINK_COMMAND_24BIT
30#define MAVLINK_MESSAGE_INFO_BATTERY_STATUS { \
31 147, \
32 "BATTERY_STATUS", \
33 9, \
34 { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_battery_status_t, id) }, \
35 { "battery_function", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_battery_status_t, battery_function) }, \
36 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_battery_status_t, type) }, \
37 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_battery_status_t, temperature) }, \
38 { "voltages", NULL, MAVLINK_TYPE_UINT16_T, 10, 10, offsetof(mavlink_battery_status_t, voltages) }, \
39 { "current_battery", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_battery_status_t, current_battery) }, \
40 { "current_consumed", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_battery_status_t, current_consumed) }, \
41 { "energy_consumed", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_battery_status_t, energy_consumed) }, \
42 { "battery_remaining", NULL, MAVLINK_TYPE_INT8_T, 0, 35, offsetof(mavlink_battery_status_t, battery_remaining) }, \
43 } \
44}
45#else
46#define MAVLINK_MESSAGE_INFO_BATTERY_STATUS { \
47 "BATTERY_STATUS", \
48 9, \
49 { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_battery_status_t, id) }, \
50 { "battery_function", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_battery_status_t, battery_function) }, \
51 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_battery_status_t, type) }, \
52 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_battery_status_t, temperature) }, \
53 { "voltages", NULL, MAVLINK_TYPE_UINT16_T, 10, 10, offsetof(mavlink_battery_status_t, voltages) }, \
54 { "current_battery", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_battery_status_t, current_battery) }, \
55 { "current_consumed", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_battery_status_t, current_consumed) }, \
56 { "energy_consumed", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_battery_status_t, energy_consumed) }, \
57 { "battery_remaining", NULL, MAVLINK_TYPE_INT8_T, 0, 35, offsetof(mavlink_battery_status_t, battery_remaining) }, \
58 } \
59}
60#endif
61
62/**
63 * @brief Pack a battery_status message
64 * @param system_id ID of this system
65 * @param component_id ID of this component (e.g. 200 for IMU)
66 * @param msg The MAVLink message to compress the data into
67 *
68 * @param id Battery ID
69 * @param battery_function Function of the battery
70 * @param type Type (chemistry) of the battery
71 * @param temperature Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.
72 * @param voltages Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.
73 * @param current_battery Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current
74 * @param current_consumed Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate
75 * @param energy_consumed Consumed energy, in HectoJoules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate
76 * @param battery_remaining Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery
77 * @return length of the message in bytes (excluding serial stream start sign)
78 */
79static inline uint16_t mavlink_msg_battery_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
80 uint8_t id, uint8_t battery_function, uint8_t type, int16_t temperature, const uint16_t *voltages, int16_t current_battery, int32_t current_consumed, int32_t energy_consumed, int8_t battery_remaining)
81{
82#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
83 char buf[MAVLINK_MSG_ID_BATTERY_STATUS_LEN];
84 _mav_put_int32_t(buf, 0, current_consumed);
85 _mav_put_int32_t(buf, 4, energy_consumed);
86 _mav_put_int16_t(buf, 8, temperature);
87 _mav_put_int16_t(buf, 30, current_battery);
88 _mav_put_uint8_t(buf, 32, id);
89 _mav_put_uint8_t(buf, 33, battery_function);
90 _mav_put_uint8_t(buf, 34, type);
91 _mav_put_int8_t(buf, 35, battery_remaining);
92 _mav_put_uint16_t_array(buf, 10, voltages, 10);
93 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
94#else
95 mavlink_battery_status_t packet;
96 packet.current_consumed = current_consumed;
97 packet.energy_consumed = energy_consumed;
98 packet.temperature = temperature;
99 packet.current_battery = current_battery;
100 packet.id = id;
101 packet.battery_function = battery_function;
102 packet.type = type;
103 packet.battery_remaining = battery_remaining;
104 mav_array_memcpy(packet.voltages, voltages, sizeof(uint16_t)*10);
105 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
106#endif
107
108 msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS;
109 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
110}
111
112/**
113 * @brief Pack a battery_status message on a channel
114 * @param system_id ID of this system
115 * @param component_id ID of this component (e.g. 200 for IMU)
116 * @param chan The MAVLink channel this message will be sent over
117 * @param msg The MAVLink message to compress the data into
118 * @param id Battery ID
119 * @param battery_function Function of the battery
120 * @param type Type (chemistry) of the battery
121 * @param temperature Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.
122 * @param voltages Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.
123 * @param current_battery Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current
124 * @param current_consumed Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate
125 * @param energy_consumed Consumed energy, in HectoJoules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate
126 * @param battery_remaining Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery
127 * @return length of the message in bytes (excluding serial stream start sign)
128 */
129static inline uint16_t mavlink_msg_battery_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
130 mavlink_message_t* msg,
131 uint8_t id,uint8_t battery_function,uint8_t type,int16_t temperature,const uint16_t *voltages,int16_t current_battery,int32_t current_consumed,int32_t energy_consumed,int8_t battery_remaining)
132{
133#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
134 char buf[MAVLINK_MSG_ID_BATTERY_STATUS_LEN];
135 _mav_put_int32_t(buf, 0, current_consumed);
136 _mav_put_int32_t(buf, 4, energy_consumed);
137 _mav_put_int16_t(buf, 8, temperature);
138 _mav_put_int16_t(buf, 30, current_battery);
139 _mav_put_uint8_t(buf, 32, id);
140 _mav_put_uint8_t(buf, 33, battery_function);
141 _mav_put_uint8_t(buf, 34, type);
142 _mav_put_int8_t(buf, 35, battery_remaining);
143 _mav_put_uint16_t_array(buf, 10, voltages, 10);
144 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
145#else
146 mavlink_battery_status_t packet;
147 packet.current_consumed = current_consumed;
148 packet.energy_consumed = energy_consumed;
149 packet.temperature = temperature;
150 packet.current_battery = current_battery;
151 packet.id = id;
152 packet.battery_function = battery_function;
153 packet.type = type;
154 packet.battery_remaining = battery_remaining;
155 mav_array_memcpy(packet.voltages, voltages, sizeof(uint16_t)*10);
156 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
157#endif
158
159 msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS;
160 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
161}
162
163/**
164 * @brief Encode a battery_status struct
165 *
166 * @param system_id ID of this system
167 * @param component_id ID of this component (e.g. 200 for IMU)
168 * @param msg The MAVLink message to compress the data into
169 * @param battery_status C-struct to read the message contents from
170 */
171static inline uint16_t mavlink_msg_battery_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_battery_status_t* battery_status)
172{
173 return mavlink_msg_battery_status_pack(system_id, component_id, msg, battery_status->id, battery_status->battery_function, battery_status->type, battery_status->temperature, battery_status->voltages, battery_status->current_battery, battery_status->current_consumed, battery_status->energy_consumed, battery_status->battery_remaining);
174}
175
176/**
177 * @brief Encode a battery_status struct on a channel
178 *
179 * @param system_id ID of this system
180 * @param component_id ID of this component (e.g. 200 for IMU)
181 * @param chan The MAVLink channel this message will be sent over
182 * @param msg The MAVLink message to compress the data into
183 * @param battery_status C-struct to read the message contents from
184 */
185static inline uint16_t mavlink_msg_battery_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_battery_status_t* battery_status)
186{
187 return mavlink_msg_battery_status_pack_chan(system_id, component_id, chan, msg, battery_status->id, battery_status->battery_function, battery_status->type, battery_status->temperature, battery_status->voltages, battery_status->current_battery, battery_status->current_consumed, battery_status->energy_consumed, battery_status->battery_remaining);
188}
189
190/**
191 * @brief Send a battery_status message
192 * @param chan MAVLink channel to send the message
193 *
194 * @param id Battery ID
195 * @param battery_function Function of the battery
196 * @param type Type (chemistry) of the battery
197 * @param temperature Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.
198 * @param voltages Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.
199 * @param current_battery Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current
200 * @param current_consumed Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate
201 * @param energy_consumed Consumed energy, in HectoJoules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate
202 * @param battery_remaining Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery
203 */
204#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
205
206static inline void mavlink_msg_battery_status_send(mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, int16_t temperature, const uint16_t *voltages, int16_t current_battery, int32_t current_consumed, int32_t energy_consumed, int8_t battery_remaining)
207{
208#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
209 char buf[MAVLINK_MSG_ID_BATTERY_STATUS_LEN];
210 _mav_put_int32_t(buf, 0, current_consumed);
211 _mav_put_int32_t(buf, 4, energy_consumed);
212 _mav_put_int16_t(buf, 8, temperature);
213 _mav_put_int16_t(buf, 30, current_battery);
214 _mav_put_uint8_t(buf, 32, id);
215 _mav_put_uint8_t(buf, 33, battery_function);
216 _mav_put_uint8_t(buf, 34, type);
217 _mav_put_int8_t(buf, 35, battery_remaining);
218 _mav_put_uint16_t_array(buf, 10, voltages, 10);
219 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, buf, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
220#else
221 mavlink_battery_status_t packet;
222 packet.current_consumed = current_consumed;
223 packet.energy_consumed = energy_consumed;
224 packet.temperature = temperature;
225 packet.current_battery = current_battery;
226 packet.id = id;
227 packet.battery_function = battery_function;
228 packet.type = type;
229 packet.battery_remaining = battery_remaining;
230 mav_array_memcpy(packet.voltages, voltages, sizeof(uint16_t)*10);
231 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)&packet, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
232#endif
233}
234
235/**
236 * @brief Send a battery_status message
237 * @param chan MAVLink channel to send the message
238 * @param struct The MAVLink struct to serialize
239 */
240static inline void mavlink_msg_battery_status_send_struct(mavlink_channel_t chan, const mavlink_battery_status_t* battery_status)
241{
242#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
243 mavlink_msg_battery_status_send(chan, battery_status->id, battery_status->battery_function, battery_status->type, battery_status->temperature, battery_status->voltages, battery_status->current_battery, battery_status->current_consumed, battery_status->energy_consumed, battery_status->battery_remaining);
244#else
245 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)battery_status, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
246#endif
247}
248
249#if MAVLINK_MSG_ID_BATTERY_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
250/*
251 This varient of _send() can be used to save stack space by re-using
252 memory from the receive buffer. The caller provides a
253 mavlink_message_t which is the size of a full mavlink message. This
254 is usually the receive buffer for the channel, and allows a reply to an
255 incoming message with minimum stack space usage.
256 */
257static inline void mavlink_msg_battery_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, int16_t temperature, const uint16_t *voltages, int16_t current_battery, int32_t current_consumed, int32_t energy_consumed, int8_t battery_remaining)
258{
259#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
260 char *buf = (char *)msgbuf;
261 _mav_put_int32_t(buf, 0, current_consumed);
262 _mav_put_int32_t(buf, 4, energy_consumed);
263 _mav_put_int16_t(buf, 8, temperature);
264 _mav_put_int16_t(buf, 30, current_battery);
265 _mav_put_uint8_t(buf, 32, id);
266 _mav_put_uint8_t(buf, 33, battery_function);
267 _mav_put_uint8_t(buf, 34, type);
268 _mav_put_int8_t(buf, 35, battery_remaining);
269 _mav_put_uint16_t_array(buf, 10, voltages, 10);
270 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, buf, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
271#else
272 mavlink_battery_status_t *packet = (mavlink_battery_status_t *)msgbuf;
273 packet->current_consumed = current_consumed;
274 packet->energy_consumed = energy_consumed;
275 packet->temperature = temperature;
276 packet->current_battery = current_battery;
277 packet->id = id;
278 packet->battery_function = battery_function;
279 packet->type = type;
280 packet->battery_remaining = battery_remaining;
281 mav_array_memcpy(packet->voltages, voltages, sizeof(uint16_t)*10);
282 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)packet, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
283#endif
284}
285#endif
286
287#endif
288
289// MESSAGE BATTERY_STATUS UNPACKING
290
291
292/**
293 * @brief Get field id from battery_status message
294 *
295 * @return Battery ID
296 */
297static inline uint8_t mavlink_msg_battery_status_get_id(const mavlink_message_t* msg)
298{
299 return _MAV_RETURN_uint8_t(msg, 32);
300}
301
302/**
303 * @brief Get field battery_function from battery_status message
304 *
305 * @return Function of the battery
306 */
307static inline uint8_t mavlink_msg_battery_status_get_battery_function(const mavlink_message_t* msg)
308{
309 return _MAV_RETURN_uint8_t(msg, 33);
310}
311
312/**
313 * @brief Get field type from battery_status message
314 *
315 * @return Type (chemistry) of the battery
316 */
317static inline uint8_t mavlink_msg_battery_status_get_type(const mavlink_message_t* msg)
318{
319 return _MAV_RETURN_uint8_t(msg, 34);
320}
321
322/**
323 * @brief Get field temperature from battery_status message
324 *
325 * @return Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.
326 */
327static inline int16_t mavlink_msg_battery_status_get_temperature(const mavlink_message_t* msg)
328{
329 return _MAV_RETURN_int16_t(msg, 8);
330}
331
332/**
333 * @brief Get field voltages from battery_status message
334 *
335 * @return Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.
336 */
337static inline uint16_t mavlink_msg_battery_status_get_voltages(const mavlink_message_t* msg, uint16_t *voltages)
338{
339 return _MAV_RETURN_uint16_t_array(msg, voltages, 10, 10);
340}
341
342/**
343 * @brief Get field current_battery from battery_status message
344 *
345 * @return Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current
346 */
347static inline int16_t mavlink_msg_battery_status_get_current_battery(const mavlink_message_t* msg)
348{
349 return _MAV_RETURN_int16_t(msg, 30);
350}
351
352/**
353 * @brief Get field current_consumed from battery_status message
354 *
355 * @return Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate
356 */
357static inline int32_t mavlink_msg_battery_status_get_current_consumed(const mavlink_message_t* msg)
358{
359 return _MAV_RETURN_int32_t(msg, 0);
360}
361
362/**
363 * @brief Get field energy_consumed from battery_status message
364 *
365 * @return Consumed energy, in HectoJoules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate
366 */
367static inline int32_t mavlink_msg_battery_status_get_energy_consumed(const mavlink_message_t* msg)
368{
369 return _MAV_RETURN_int32_t(msg, 4);
370}
371
372/**
373 * @brief Get field battery_remaining from battery_status message
374 *
375 * @return Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery
376 */
377static inline int8_t mavlink_msg_battery_status_get_battery_remaining(const mavlink_message_t* msg)
378{
379 return _MAV_RETURN_int8_t(msg, 35);
380}
381
382/**
383 * @brief Decode a battery_status message into a struct
384 *
385 * @param msg The message to decode
386 * @param battery_status C-struct to decode the message contents into
387 */
388static inline void mavlink_msg_battery_status_decode(const mavlink_message_t* msg, mavlink_battery_status_t* battery_status)
389{
390#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
391 battery_status->current_consumed = mavlink_msg_battery_status_get_current_consumed(msg);
392 battery_status->energy_consumed = mavlink_msg_battery_status_get_energy_consumed(msg);
393 battery_status->temperature = mavlink_msg_battery_status_get_temperature(msg);
394 mavlink_msg_battery_status_get_voltages(msg, battery_status->voltages);
395 battery_status->current_battery = mavlink_msg_battery_status_get_current_battery(msg);
396 battery_status->id = mavlink_msg_battery_status_get_id(msg);
397 battery_status->battery_function = mavlink_msg_battery_status_get_battery_function(msg);
398 battery_status->type = mavlink_msg_battery_status_get_type(msg);
399 battery_status->battery_remaining = mavlink_msg_battery_status_get_battery_remaining(msg);
400#else
401 uint8_t len = msg->len < MAVLINK_MSG_ID_BATTERY_STATUS_LEN? msg->len : MAVLINK_MSG_ID_BATTERY_STATUS_LEN;
402 memset(battery_status, 0, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
403 memcpy(battery_status, _MAV_PAYLOAD(msg), len);
404#endif
405}