Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_fuel_status.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE FUEL_STATUS PACKING
3
4#define MAVLINK_MSG_ID_FUEL_STATUS 371
5
6
7typedef struct __mavlink_fuel_status_t {
8 float maximum_fuel; /*< Capacity when full. Must be provided.*/
9 float consumed_fuel; /*< Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided.*/
10 float remaining_fuel; /*< Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided.*/
11 float flow_rate; /*< Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided.*/
12 float temperature; /*< [K] Fuel temperature. NaN: field not provided.*/
13 uint32_t fuel_type; /*< Fuel type. Defines units for fuel capacity and consumption fields above.*/
14 uint8_t id; /*< Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2.*/
15 uint8_t percent_remaining; /*< [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided.*/
16} mavlink_fuel_status_t;
17
18#define MAVLINK_MSG_ID_FUEL_STATUS_LEN 26
19#define MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN 26
20#define MAVLINK_MSG_ID_371_LEN 26
21#define MAVLINK_MSG_ID_371_MIN_LEN 26
22
23#define MAVLINK_MSG_ID_FUEL_STATUS_CRC 10
24#define MAVLINK_MSG_ID_371_CRC 10
25
26
27
28#if MAVLINK_COMMAND_24BIT
29#define MAVLINK_MESSAGE_INFO_FUEL_STATUS {
30 371,
31 "FUEL_STATUS",
32 8,
33 { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_fuel_status_t, id) },
34 { "maximum_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_fuel_status_t, maximum_fuel) },
35 { "consumed_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_fuel_status_t, consumed_fuel) },
36 { "remaining_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_fuel_status_t, remaining_fuel) },
37 { "percent_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_fuel_status_t, percent_remaining) },
38 { "flow_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_fuel_status_t, flow_rate) },
39 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_fuel_status_t, temperature) },
40 { "fuel_type", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_fuel_status_t, fuel_type) },
41 } \
42}
43#else
44#define MAVLINK_MESSAGE_INFO_FUEL_STATUS {
45 "FUEL_STATUS",
46 8,
47 { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_fuel_status_t, id) },
48 { "maximum_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_fuel_status_t, maximum_fuel) },
49 { "consumed_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_fuel_status_t, consumed_fuel) },
50 { "remaining_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_fuel_status_t, remaining_fuel) },
51 { "percent_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_fuel_status_t, percent_remaining) },
52 { "flow_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_fuel_status_t, flow_rate) },
53 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_fuel_status_t, temperature) },
54 { "fuel_type", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_fuel_status_t, fuel_type) },
55 } \
56}
57#endif
58
59/**
60 * @brief Pack a fuel_status message
61 * @param system_id ID of this system
62 * @param component_id ID of this component (e.g. 200 for IMU)
63 * @param msg The MAVLink message to compress the data into
64 *
65 * @param id Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2.
66 * @param maximum_fuel Capacity when full. Must be provided.
67 * @param consumed_fuel Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided.
68 * @param remaining_fuel Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided.
69 * @param percent_remaining [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided.
70 * @param flow_rate Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided.
71 * @param temperature [K] Fuel temperature. NaN: field not provided.
72 * @param fuel_type Fuel type. Defines units for fuel capacity and consumption fields above.
73 * @return length of the message in bytes (excluding serial stream start sign)
74 */
75static inline uint16_t mavlink_msg_fuel_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
76 uint8_t id, float maximum_fuel, float consumed_fuel, float remaining_fuel, uint8_t percent_remaining, float flow_rate, float temperature, uint32_t fuel_type)
77{
78#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
80 _mav_put_float(buf, 0, maximum_fuel);
81 _mav_put_float(buf, 4, consumed_fuel);
82 _mav_put_float(buf, 8, remaining_fuel);
83 _mav_put_float(buf, 12, flow_rate);
84 _mav_put_float(buf, 16, temperature);
85 _mav_put_uint32_t(buf, 20, fuel_type);
86 _mav_put_uint8_t(buf, 24, id);
87 _mav_put_uint8_t(buf, 25, percent_remaining);
88
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FUEL_STATUS_LEN);
90#else
91 mavlink_fuel_status_t packet;
92 packet.maximum_fuel = maximum_fuel;
93 packet.consumed_fuel = consumed_fuel;
94 packet.remaining_fuel = remaining_fuel;
95 packet.flow_rate = flow_rate;
96 packet.temperature = temperature;
97 packet.fuel_type = fuel_type;
98 packet.id = id;
99 packet.percent_remaining = percent_remaining;
100
101 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FUEL_STATUS_LEN);
102#endif
103
104 msg->msgid = MAVLINK_MSG_ID_FUEL_STATUS;
105 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC);
106}
107
108/**
109 * @brief Pack a fuel_status message
110 * @param system_id ID of this system
111 * @param component_id ID of this component (e.g. 200 for IMU)
112 * @param status MAVLink status structure
113 * @param msg The MAVLink message to compress the data into
114 *
115 * @param id Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2.
116 * @param maximum_fuel Capacity when full. Must be provided.
117 * @param consumed_fuel Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided.
118 * @param remaining_fuel Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided.
119 * @param percent_remaining [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided.
120 * @param flow_rate Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided.
121 * @param temperature [K] Fuel temperature. NaN: field not provided.
122 * @param fuel_type Fuel type. Defines units for fuel capacity and consumption fields above.
123 * @return length of the message in bytes (excluding serial stream start sign)
124 */
125static inline uint16_t mavlink_msg_fuel_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
126 uint8_t id, float maximum_fuel, float consumed_fuel, float remaining_fuel, uint8_t percent_remaining, float flow_rate, float temperature, uint32_t fuel_type)
127{
128#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
130 _mav_put_float(buf, 0, maximum_fuel);
131 _mav_put_float(buf, 4, consumed_fuel);
132 _mav_put_float(buf, 8, remaining_fuel);
133 _mav_put_float(buf, 12, flow_rate);
134 _mav_put_float(buf, 16, temperature);
135 _mav_put_uint32_t(buf, 20, fuel_type);
136 _mav_put_uint8_t(buf, 24, id);
137 _mav_put_uint8_t(buf, 25, percent_remaining);
138
139 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FUEL_STATUS_LEN);
140#else
141 mavlink_fuel_status_t packet;
142 packet.maximum_fuel = maximum_fuel;
143 packet.consumed_fuel = consumed_fuel;
144 packet.remaining_fuel = remaining_fuel;
145 packet.flow_rate = flow_rate;
146 packet.temperature = temperature;
147 packet.fuel_type = fuel_type;
148 packet.id = id;
149 packet.percent_remaining = percent_remaining;
150
151 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FUEL_STATUS_LEN);
152#endif
153
154 msg->msgid = MAVLINK_MSG_ID_FUEL_STATUS;
155#if MAVLINK_CRC_EXTRA
156 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC);
157#else
158 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN);
159#endif
160}
161
162/**
163 * @brief Pack a fuel_status message on a channel
164 * @param system_id ID of this system
165 * @param component_id ID of this component (e.g. 200 for IMU)
166 * @param chan The MAVLink channel this message will be sent over
167 * @param msg The MAVLink message to compress the data into
168 * @param id Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2.
169 * @param maximum_fuel Capacity when full. Must be provided.
170 * @param consumed_fuel Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided.
171 * @param remaining_fuel Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided.
172 * @param percent_remaining [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided.
173 * @param flow_rate Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided.
174 * @param temperature [K] Fuel temperature. NaN: field not provided.
175 * @param fuel_type Fuel type. Defines units for fuel capacity and consumption fields above.
176 * @return length of the message in bytes (excluding serial stream start sign)
177 */
178static inline uint16_t mavlink_msg_fuel_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
179 mavlink_message_t* msg,
180 uint8_t id,float maximum_fuel,float consumed_fuel,float remaining_fuel,uint8_t percent_remaining,float flow_rate,float temperature,uint32_t fuel_type)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184 _mav_put_float(buf, 0, maximum_fuel);
185 _mav_put_float(buf, 4, consumed_fuel);
186 _mav_put_float(buf, 8, remaining_fuel);
187 _mav_put_float(buf, 12, flow_rate);
188 _mav_put_float(buf, 16, temperature);
189 _mav_put_uint32_t(buf, 20, fuel_type);
190 _mav_put_uint8_t(buf, 24, id);
191 _mav_put_uint8_t(buf, 25, percent_remaining);
192
193 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FUEL_STATUS_LEN);
194#else
195 mavlink_fuel_status_t packet;
196 packet.maximum_fuel = maximum_fuel;
197 packet.consumed_fuel = consumed_fuel;
198 packet.remaining_fuel = remaining_fuel;
199 packet.flow_rate = flow_rate;
200 packet.temperature = temperature;
201 packet.fuel_type = fuel_type;
202 packet.id = id;
203 packet.percent_remaining = percent_remaining;
204
205 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FUEL_STATUS_LEN);
206#endif
207
208 msg->msgid = MAVLINK_MSG_ID_FUEL_STATUS;
209 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC);
210}
211
212/**
213 * @brief Encode a fuel_status struct
214 *
215 * @param system_id ID of this system
216 * @param component_id ID of this component (e.g. 200 for IMU)
217 * @param msg The MAVLink message to compress the data into
218 * @param fuel_status C-struct to read the message contents from
219 */
220static inline uint16_t mavlink_msg_fuel_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fuel_status_t* fuel_status)
221{
222 return mavlink_msg_fuel_status_pack(system_id, component_id, msg, fuel_status->id, fuel_status->maximum_fuel, fuel_status->consumed_fuel, fuel_status->remaining_fuel, fuel_status->percent_remaining, fuel_status->flow_rate, fuel_status->temperature, fuel_status->fuel_type);
223}
224
225/**
226 * @brief Encode a fuel_status struct on a channel
227 *
228 * @param system_id ID of this system
229 * @param component_id ID of this component (e.g. 200 for IMU)
230 * @param chan The MAVLink channel this message will be sent over
231 * @param msg The MAVLink message to compress the data into
232 * @param fuel_status C-struct to read the message contents from
233 */
234static inline uint16_t mavlink_msg_fuel_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fuel_status_t* fuel_status)
235{
236 return mavlink_msg_fuel_status_pack_chan(system_id, component_id, chan, msg, fuel_status->id, fuel_status->maximum_fuel, fuel_status->consumed_fuel, fuel_status->remaining_fuel, fuel_status->percent_remaining, fuel_status->flow_rate, fuel_status->temperature, fuel_status->fuel_type);
237}
238
239/**
240 * @brief Encode a fuel_status struct with provided status structure
241 *
242 * @param system_id ID of this system
243 * @param component_id ID of this component (e.g. 200 for IMU)
244 * @param status MAVLink status structure
245 * @param msg The MAVLink message to compress the data into
246 * @param fuel_status C-struct to read the message contents from
247 */
248static inline uint16_t mavlink_msg_fuel_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_fuel_status_t* fuel_status)
249{
250 return mavlink_msg_fuel_status_pack_status(system_id, component_id, _status, msg, fuel_status->id, fuel_status->maximum_fuel, fuel_status->consumed_fuel, fuel_status->remaining_fuel, fuel_status->percent_remaining, fuel_status->flow_rate, fuel_status->temperature, fuel_status->fuel_type);
251}
252
253/**
254 * @brief Send a fuel_status message
255 * @param chan MAVLink channel to send the message
256 *
257 * @param id Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2.
258 * @param maximum_fuel Capacity when full. Must be provided.
259 * @param consumed_fuel Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided.
260 * @param remaining_fuel Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided.
261 * @param percent_remaining [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided.
262 * @param flow_rate Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided.
263 * @param temperature [K] Fuel temperature. NaN: field not provided.
264 * @param fuel_type Fuel type. Defines units for fuel capacity and consumption fields above.
265 */
266#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
267
268static inline void mavlink_msg_fuel_status_send(mavlink_channel_t chan, uint8_t id, float maximum_fuel, float consumed_fuel, float remaining_fuel, uint8_t percent_remaining, float flow_rate, float temperature, uint32_t fuel_type)
269{
270#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
271 char buf[MAVLINK_MSG_ID_FUEL_STATUS_LEN];
272 _mav_put_float(buf, 0, maximum_fuel);
273 _mav_put_float(buf, 4, consumed_fuel);
274 _mav_put_float(buf, 8, remaining_fuel);
275 _mav_put_float(buf, 12, flow_rate);
276 _mav_put_float(buf, 16, temperature);
277 _mav_put_uint32_t(buf, 20, fuel_type);
278 _mav_put_uint8_t(buf, 24, id);
279 _mav_put_uint8_t(buf, 25, percent_remaining);
280
281 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, buf, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC);
282#else
283 mavlink_fuel_status_t packet;
284 packet.maximum_fuel = maximum_fuel;
285 packet.consumed_fuel = consumed_fuel;
286 packet.remaining_fuel = remaining_fuel;
287 packet.flow_rate = flow_rate;
288 packet.temperature = temperature;
289 packet.fuel_type = fuel_type;
290 packet.id = id;
291 packet.percent_remaining = percent_remaining;
292
293 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, (const char *)&packet, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC);
294#endif
295}
296
297/**
298 * @brief Send a fuel_status message
299 * @param chan MAVLink channel to send the message
300 * @param struct The MAVLink struct to serialize
301 */
302static inline void mavlink_msg_fuel_status_send_struct(mavlink_channel_t chan, const mavlink_fuel_status_t* fuel_status)
303{
304#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
305 mavlink_msg_fuel_status_send(chan, fuel_status->id, fuel_status->maximum_fuel, fuel_status->consumed_fuel, fuel_status->remaining_fuel, fuel_status->percent_remaining, fuel_status->flow_rate, fuel_status->temperature, fuel_status->fuel_type);
306#else
307 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, (const char *)fuel_status, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC);
308#endif
309}
310
311#if MAVLINK_MSG_ID_FUEL_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
312/*
313 This variant of _send() can be used to save stack space by reusing
314 memory from the receive buffer. The caller provides a
315 mavlink_message_t which is the size of a full mavlink message. This
316 is usually the receive buffer for the channel, and allows a reply to an
317 incoming message with minimum stack space usage.
318 */
319static inline void mavlink_msg_fuel_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, float maximum_fuel, float consumed_fuel, float remaining_fuel, uint8_t percent_remaining, float flow_rate, float temperature, uint32_t fuel_type)
320{
321#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
322 char *buf = (char *)msgbuf;
323 _mav_put_float(buf, 0, maximum_fuel);
324 _mav_put_float(buf, 4, consumed_fuel);
325 _mav_put_float(buf, 8, remaining_fuel);
326 _mav_put_float(buf, 12, flow_rate);
327 _mav_put_float(buf, 16, temperature);
328 _mav_put_uint32_t(buf, 20, fuel_type);
329 _mav_put_uint8_t(buf, 24, id);
330 _mav_put_uint8_t(buf, 25, percent_remaining);
331
332 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, buf, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC);
333#else
334 mavlink_fuel_status_t *packet = (mavlink_fuel_status_t *)msgbuf;
335 packet->maximum_fuel = maximum_fuel;
336 packet->consumed_fuel = consumed_fuel;
337 packet->remaining_fuel = remaining_fuel;
338 packet->flow_rate = flow_rate;
339 packet->temperature = temperature;
340 packet->fuel_type = fuel_type;
341 packet->id = id;
342 packet->percent_remaining = percent_remaining;
343
344 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, (const char *)packet, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC);
345#endif
346}
347#endif
348
349#endif
350
351// MESSAGE FUEL_STATUS UNPACKING
352
353
354/**
355 * @brief Get field id from fuel_status message
356 *
357 * @return Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2.
358 */
359static inline uint8_t mavlink_msg_fuel_status_get_id(const mavlink_message_t* msg)
360{
361 return _MAV_RETURN_uint8_t(msg, 24);
362}
363
364/**
365 * @brief Get field maximum_fuel from fuel_status message
366 *
367 * @return Capacity when full. Must be provided.
368 */
369static inline float mavlink_msg_fuel_status_get_maximum_fuel(const mavlink_message_t* msg)
370{
371 return _MAV_RETURN_float(msg, 0);
372}
373
374/**
375 * @brief Get field consumed_fuel from fuel_status message
376 *
377 * @return Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided.
378 */
379static inline float mavlink_msg_fuel_status_get_consumed_fuel(const mavlink_message_t* msg)
380{
381 return _MAV_RETURN_float(msg, 4);
382}
383
384/**
385 * @brief Get field remaining_fuel from fuel_status message
386 *
387 * @return Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided.
388 */
389static inline float mavlink_msg_fuel_status_get_remaining_fuel(const mavlink_message_t* msg)
390{
391 return _MAV_RETURN_float(msg, 8);
392}
393
394/**
395 * @brief Get field percent_remaining from fuel_status message
396 *
397 * @return [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided.
398 */
399static inline uint8_t mavlink_msg_fuel_status_get_percent_remaining(const mavlink_message_t* msg)
400{
401 return _MAV_RETURN_uint8_t(msg, 25);
402}
403
404/**
405 * @brief Get field flow_rate from fuel_status message
406 *
407 * @return Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided.
408 */
409static inline float mavlink_msg_fuel_status_get_flow_rate(const mavlink_message_t* msg)
410{
411 return _MAV_RETURN_float(msg, 12);
412}
413
414/**
415 * @brief Get field temperature from fuel_status message
416 *
417 * @return [K] Fuel temperature. NaN: field not provided.
418 */
419static inline float mavlink_msg_fuel_status_get_temperature(const mavlink_message_t* msg)
420{
421 return _MAV_RETURN_float(msg, 16);
422}
423
424/**
425 * @brief Get field fuel_type from fuel_status message
426 *
427 * @return Fuel type. Defines units for fuel capacity and consumption fields above.
428 */
429static inline uint32_t mavlink_msg_fuel_status_get_fuel_type(const mavlink_message_t* msg)
430{
431 return _MAV_RETURN_uint32_t(msg, 20);
432}
433
434/**
435 * @brief Decode a fuel_status message into a struct
436 *
437 * @param msg The message to decode
438 * @param fuel_status C-struct to decode the message contents into
439 */
440static inline void mavlink_msg_fuel_status_decode(const mavlink_message_t* msg, mavlink_fuel_status_t* fuel_status)
441{
442#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
443 fuel_status->maximum_fuel = mavlink_msg_fuel_status_get_maximum_fuel(msg);
444 fuel_status->consumed_fuel = mavlink_msg_fuel_status_get_consumed_fuel(msg);
445 fuel_status->remaining_fuel = mavlink_msg_fuel_status_get_remaining_fuel(msg);
446 fuel_status->flow_rate = mavlink_msg_fuel_status_get_flow_rate(msg);
447 fuel_status->temperature = mavlink_msg_fuel_status_get_temperature(msg);
448 fuel_status->fuel_type = mavlink_msg_fuel_status_get_fuel_type(msg);
449 fuel_status->id = mavlink_msg_fuel_status_get_id(msg);
450 fuel_status->percent_remaining = mavlink_msg_fuel_status_get_percent_remaining(msg);
451#else
452 uint8_t len = msg->len < MAVLINK_MSG_ID_FUEL_STATUS_LEN? msg->len : MAVLINK_MSG_ID_FUEL_STATUS_LEN;
453 memset(fuel_status, 0, MAVLINK_MSG_ID_FUEL_STATUS_LEN);
454 memcpy(fuel_status, _MAV_PAYLOAD(msg), len);
455#endif
456}