Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_generator_status.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE GENERATOR_STATUS PACKING
3
4#define MAVLINK_MSG_ID_GENERATOR_STATUS 373
5
6
8 uint64_t status; /*< Status flags.*/
9 float battery_current; /*< [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.*/
10 float load_current; /*< [A] Current going to the UAV. If battery current not available this is the DC current from the generator. Positive for out. Negative for in. NaN: field not provided*/
11 float power_generated; /*< [W] The power being generated. NaN: field not provided*/
12 float bus_voltage; /*< [V] Voltage of the bus seen at the generator, or battery bus if battery bus is controlled by generator and at a different voltage to main bus.*/
13 float bat_current_setpoint; /*< [A] The target battery current. Positive for out. Negative for in. NaN: field not provided*/
14 uint32_t runtime; /*< [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.*/
15 int32_t time_until_maintenance; /*< [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.*/
16 uint16_t generator_speed; /*< [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.*/
17 int16_t rectifier_temperature; /*< [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.*/
18 int16_t generator_temperature; /*< [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.*/
19} mavlink_generator_status_t;
20
21#define MAVLINK_MSG_ID_GENERATOR_STATUS_LEN 42
22#define MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN 42
23#define MAVLINK_MSG_ID_373_LEN 42
24#define MAVLINK_MSG_ID_373_MIN_LEN 42
25
26#define MAVLINK_MSG_ID_GENERATOR_STATUS_CRC 117
27#define MAVLINK_MSG_ID_373_CRC 117
28
29
30
31#if MAVLINK_COMMAND_24BIT
32#define MAVLINK_MESSAGE_INFO_GENERATOR_STATUS {
33 373,
34 "GENERATOR_STATUS",
35 11,
36 { { "status", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_generator_status_t, status) },
37 { "generator_speed", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_generator_status_t, generator_speed) },
38 { "battery_current", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_generator_status_t, battery_current) },
39 { "load_current", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_generator_status_t, load_current) },
40 { "power_generated", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_generator_status_t, power_generated) },
41 { "bus_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_generator_status_t, bus_voltage) },
42 { "rectifier_temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_generator_status_t, rectifier_temperature) },
43 { "bat_current_setpoint", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_generator_status_t, bat_current_setpoint) },
44 { "generator_temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_generator_status_t, generator_temperature) },
45 { "runtime", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_generator_status_t, runtime) },
46 { "time_until_maintenance", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_generator_status_t, time_until_maintenance) },
47 } \
48}
49#else
50#define MAVLINK_MESSAGE_INFO_GENERATOR_STATUS {
51 "GENERATOR_STATUS",
52 11,
53 { { "status", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_generator_status_t, status) },
54 { "generator_speed", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_generator_status_t, generator_speed) },
55 { "battery_current", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_generator_status_t, battery_current) },
56 { "load_current", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_generator_status_t, load_current) },
57 { "power_generated", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_generator_status_t, power_generated) },
58 { "bus_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_generator_status_t, bus_voltage) },
59 { "rectifier_temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_generator_status_t, rectifier_temperature) },
60 { "bat_current_setpoint", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_generator_status_t, bat_current_setpoint) },
61 { "generator_temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_generator_status_t, generator_temperature) },
62 { "runtime", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_generator_status_t, runtime) },
63 { "time_until_maintenance", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_generator_status_t, time_until_maintenance) },
64 } \
65}
66#endif
67
68/**
69 * @brief Pack a generator_status message
70 * @param system_id ID of this system
71 * @param component_id ID of this component (e.g. 200 for IMU)
72 * @param msg The MAVLink message to compress the data into
73 *
74 * @param status Status flags.
75 * @param generator_speed [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.
76 * @param battery_current [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.
77 * @param load_current [A] Current going to the UAV. If battery current not available this is the DC current from the generator. Positive for out. Negative for in. NaN: field not provided
78 * @param power_generated [W] The power being generated. NaN: field not provided
79 * @param bus_voltage [V] Voltage of the bus seen at the generator, or battery bus if battery bus is controlled by generator and at a different voltage to main bus.
80 * @param rectifier_temperature [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.
81 * @param bat_current_setpoint [A] The target battery current. Positive for out. Negative for in. NaN: field not provided
82 * @param generator_temperature [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.
83 * @param runtime [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.
84 * @param time_until_maintenance [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.
85 * @return length of the message in bytes (excluding serial stream start sign)
86 */
87static inline uint16_t mavlink_msg_generator_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
88 uint64_t status, uint16_t generator_speed, float battery_current, float load_current, float power_generated, float bus_voltage, int16_t rectifier_temperature, float bat_current_setpoint, int16_t generator_temperature, uint32_t runtime, int32_t time_until_maintenance)
89{
90#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
92 _mav_put_uint64_t(buf, 0, status);
93 _mav_put_float(buf, 8, battery_current);
94 _mav_put_float(buf, 12, load_current);
95 _mav_put_float(buf, 16, power_generated);
96 _mav_put_float(buf, 20, bus_voltage);
97 _mav_put_float(buf, 24, bat_current_setpoint);
98 _mav_put_uint32_t(buf, 28, runtime);
99 _mav_put_int32_t(buf, 32, time_until_maintenance);
100 _mav_put_uint16_t(buf, 36, generator_speed);
101 _mav_put_int16_t(buf, 38, rectifier_temperature);
102 _mav_put_int16_t(buf, 40, generator_temperature);
103
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
105#else
106 mavlink_generator_status_t packet;
107 packet.status = status;
108 packet.battery_current = battery_current;
109 packet.load_current = load_current;
110 packet.power_generated = power_generated;
111 packet.bus_voltage = bus_voltage;
112 packet.bat_current_setpoint = bat_current_setpoint;
113 packet.runtime = runtime;
114 packet.time_until_maintenance = time_until_maintenance;
115 packet.generator_speed = generator_speed;
116 packet.rectifier_temperature = rectifier_temperature;
117 packet.generator_temperature = generator_temperature;
118
119 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
120#endif
121
123 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC);
124}
125
126/**
127 * @brief Pack a generator_status message
128 * @param system_id ID of this system
129 * @param component_id ID of this component (e.g. 200 for IMU)
130 * @param status MAVLink status structure
131 * @param msg The MAVLink message to compress the data into
132 *
133 * @param status Status flags.
134 * @param generator_speed [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.
135 * @param battery_current [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.
136 * @param load_current [A] Current going to the UAV. If battery current not available this is the DC current from the generator. Positive for out. Negative for in. NaN: field not provided
137 * @param power_generated [W] The power being generated. NaN: field not provided
138 * @param bus_voltage [V] Voltage of the bus seen at the generator, or battery bus if battery bus is controlled by generator and at a different voltage to main bus.
139 * @param rectifier_temperature [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.
140 * @param bat_current_setpoint [A] The target battery current. Positive for out. Negative for in. NaN: field not provided
141 * @param generator_temperature [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.
142 * @param runtime [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.
143 * @param time_until_maintenance [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.
144 * @return length of the message in bytes (excluding serial stream start sign)
145 */
146static inline uint16_t mavlink_msg_generator_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
147 uint64_t status, uint16_t generator_speed, float battery_current, float load_current, float power_generated, float bus_voltage, int16_t rectifier_temperature, float bat_current_setpoint, int16_t generator_temperature, uint32_t runtime, int32_t time_until_maintenance)
148{
149#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
151 _mav_put_uint64_t(buf, 0, status);
152 _mav_put_float(buf, 8, battery_current);
153 _mav_put_float(buf, 12, load_current);
154 _mav_put_float(buf, 16, power_generated);
155 _mav_put_float(buf, 20, bus_voltage);
156 _mav_put_float(buf, 24, bat_current_setpoint);
157 _mav_put_uint32_t(buf, 28, runtime);
158 _mav_put_int32_t(buf, 32, time_until_maintenance);
159 _mav_put_uint16_t(buf, 36, generator_speed);
160 _mav_put_int16_t(buf, 38, rectifier_temperature);
161 _mav_put_int16_t(buf, 40, generator_temperature);
162
163 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
164#else
165 mavlink_generator_status_t packet;
166 packet.status = status;
167 packet.battery_current = battery_current;
168 packet.load_current = load_current;
169 packet.power_generated = power_generated;
170 packet.bus_voltage = bus_voltage;
171 packet.bat_current_setpoint = bat_current_setpoint;
172 packet.runtime = runtime;
173 packet.time_until_maintenance = time_until_maintenance;
174 packet.generator_speed = generator_speed;
175 packet.rectifier_temperature = rectifier_temperature;
176 packet.generator_temperature = generator_temperature;
177
178 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
179#endif
180
182#if MAVLINK_CRC_EXTRA
183 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC);
184#else
185 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
186#endif
187}
188
189/**
190 * @brief Pack a generator_status message on a channel
191 * @param system_id ID of this system
192 * @param component_id ID of this component (e.g. 200 for IMU)
193 * @param chan The MAVLink channel this message will be sent over
194 * @param msg The MAVLink message to compress the data into
195 * @param status Status flags.
196 * @param generator_speed [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.
197 * @param battery_current [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.
198 * @param load_current [A] Current going to the UAV. If battery current not available this is the DC current from the generator. Positive for out. Negative for in. NaN: field not provided
199 * @param power_generated [W] The power being generated. NaN: field not provided
200 * @param bus_voltage [V] Voltage of the bus seen at the generator, or battery bus if battery bus is controlled by generator and at a different voltage to main bus.
201 * @param rectifier_temperature [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.
202 * @param bat_current_setpoint [A] The target battery current. Positive for out. Negative for in. NaN: field not provided
203 * @param generator_temperature [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.
204 * @param runtime [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.
205 * @param time_until_maintenance [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.
206 * @return length of the message in bytes (excluding serial stream start sign)
207 */
208static inline uint16_t mavlink_msg_generator_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
209 mavlink_message_t* msg,
210 uint64_t status,uint16_t generator_speed,float battery_current,float load_current,float power_generated,float bus_voltage,int16_t rectifier_temperature,float bat_current_setpoint,int16_t generator_temperature,uint32_t runtime,int32_t time_until_maintenance)
211{
212#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
214 _mav_put_uint64_t(buf, 0, status);
215 _mav_put_float(buf, 8, battery_current);
216 _mav_put_float(buf, 12, load_current);
217 _mav_put_float(buf, 16, power_generated);
218 _mav_put_float(buf, 20, bus_voltage);
219 _mav_put_float(buf, 24, bat_current_setpoint);
220 _mav_put_uint32_t(buf, 28, runtime);
221 _mav_put_int32_t(buf, 32, time_until_maintenance);
222 _mav_put_uint16_t(buf, 36, generator_speed);
223 _mav_put_int16_t(buf, 38, rectifier_temperature);
224 _mav_put_int16_t(buf, 40, generator_temperature);
225
226 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
227#else
228 mavlink_generator_status_t packet;
229 packet.status = status;
230 packet.battery_current = battery_current;
231 packet.load_current = load_current;
232 packet.power_generated = power_generated;
233 packet.bus_voltage = bus_voltage;
234 packet.bat_current_setpoint = bat_current_setpoint;
235 packet.runtime = runtime;
236 packet.time_until_maintenance = time_until_maintenance;
237 packet.generator_speed = generator_speed;
238 packet.rectifier_temperature = rectifier_temperature;
239 packet.generator_temperature = generator_temperature;
240
241 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
242#endif
243
245 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC);
246}
247
248/**
249 * @brief Encode a generator_status struct
250 *
251 * @param system_id ID of this system
252 * @param component_id ID of this component (e.g. 200 for IMU)
253 * @param msg The MAVLink message to compress the data into
254 * @param generator_status C-struct to read the message contents from
255 */
256static inline uint16_t mavlink_msg_generator_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_generator_status_t* generator_status)
257{
258 return mavlink_msg_generator_status_pack(system_id, component_id, msg, generator_status->status, generator_status->generator_speed, generator_status->battery_current, generator_status->load_current, generator_status->power_generated, generator_status->bus_voltage, generator_status->rectifier_temperature, generator_status->bat_current_setpoint, generator_status->generator_temperature, generator_status->runtime, generator_status->time_until_maintenance);
259}
260
261/**
262 * @brief Encode a generator_status struct on a channel
263 *
264 * @param system_id ID of this system
265 * @param component_id ID of this component (e.g. 200 for IMU)
266 * @param chan The MAVLink channel this message will be sent over
267 * @param msg The MAVLink message to compress the data into
268 * @param generator_status C-struct to read the message contents from
269 */
270static inline uint16_t mavlink_msg_generator_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_generator_status_t* generator_status)
271{
272 return mavlink_msg_generator_status_pack_chan(system_id, component_id, chan, msg, generator_status->status, generator_status->generator_speed, generator_status->battery_current, generator_status->load_current, generator_status->power_generated, generator_status->bus_voltage, generator_status->rectifier_temperature, generator_status->bat_current_setpoint, generator_status->generator_temperature, generator_status->runtime, generator_status->time_until_maintenance);
273}
274
275/**
276 * @brief Encode a generator_status struct with provided status structure
277 *
278 * @param system_id ID of this system
279 * @param component_id ID of this component (e.g. 200 for IMU)
280 * @param status MAVLink status structure
281 * @param msg The MAVLink message to compress the data into
282 * @param generator_status C-struct to read the message contents from
283 */
284static inline uint16_t mavlink_msg_generator_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_generator_status_t* generator_status)
285{
286 return mavlink_msg_generator_status_pack_status(system_id, component_id, _status, msg, generator_status->status, generator_status->generator_speed, generator_status->battery_current, generator_status->load_current, generator_status->power_generated, generator_status->bus_voltage, generator_status->rectifier_temperature, generator_status->bat_current_setpoint, generator_status->generator_temperature, generator_status->runtime, generator_status->time_until_maintenance);
287}
288
289/**
290 * @brief Send a generator_status message
291 * @param chan MAVLink channel to send the message
292 *
293 * @param status Status flags.
294 * @param generator_speed [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.
295 * @param battery_current [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.
296 * @param load_current [A] Current going to the UAV. If battery current not available this is the DC current from the generator. Positive for out. Negative for in. NaN: field not provided
297 * @param power_generated [W] The power being generated. NaN: field not provided
298 * @param bus_voltage [V] Voltage of the bus seen at the generator, or battery bus if battery bus is controlled by generator and at a different voltage to main bus.
299 * @param rectifier_temperature [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.
300 * @param bat_current_setpoint [A] The target battery current. Positive for out. Negative for in. NaN: field not provided
301 * @param generator_temperature [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.
302 * @param runtime [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.
303 * @param time_until_maintenance [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.
304 */
305#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
306
307static inline void mavlink_msg_generator_status_send(mavlink_channel_t chan, uint64_t status, uint16_t generator_speed, float battery_current, float load_current, float power_generated, float bus_voltage, int16_t rectifier_temperature, float bat_current_setpoint, int16_t generator_temperature, uint32_t runtime, int32_t time_until_maintenance)
308{
309#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
310 char buf[MAVLINK_MSG_ID_GENERATOR_STATUS_LEN];
311 _mav_put_uint64_t(buf, 0, status);
312 _mav_put_float(buf, 8, battery_current);
313 _mav_put_float(buf, 12, load_current);
314 _mav_put_float(buf, 16, power_generated);
315 _mav_put_float(buf, 20, bus_voltage);
316 _mav_put_float(buf, 24, bat_current_setpoint);
317 _mav_put_uint32_t(buf, 28, runtime);
318 _mav_put_int32_t(buf, 32, time_until_maintenance);
319 _mav_put_uint16_t(buf, 36, generator_speed);
320 _mav_put_int16_t(buf, 38, rectifier_temperature);
321 _mav_put_int16_t(buf, 40, generator_temperature);
322
323 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GENERATOR_STATUS, buf, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC);
324#else
325 mavlink_generator_status_t packet;
326 packet.status = status;
327 packet.battery_current = battery_current;
328 packet.load_current = load_current;
329 packet.power_generated = power_generated;
330 packet.bus_voltage = bus_voltage;
331 packet.bat_current_setpoint = bat_current_setpoint;
332 packet.runtime = runtime;
333 packet.time_until_maintenance = time_until_maintenance;
334 packet.generator_speed = generator_speed;
335 packet.rectifier_temperature = rectifier_temperature;
336 packet.generator_temperature = generator_temperature;
337
338 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GENERATOR_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC);
339#endif
340}
341
342/**
343 * @brief Send a generator_status message
344 * @param chan MAVLink channel to send the message
345 * @param struct The MAVLink struct to serialize
346 */
347static inline void mavlink_msg_generator_status_send_struct(mavlink_channel_t chan, const mavlink_generator_status_t* generator_status)
348{
349#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
350 mavlink_msg_generator_status_send(chan, generator_status->status, generator_status->generator_speed, generator_status->battery_current, generator_status->load_current, generator_status->power_generated, generator_status->bus_voltage, generator_status->rectifier_temperature, generator_status->bat_current_setpoint, generator_status->generator_temperature, generator_status->runtime, generator_status->time_until_maintenance);
351#else
352 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GENERATOR_STATUS, (const char *)generator_status, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC);
353#endif
354}
355
356#if MAVLINK_MSG_ID_GENERATOR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
357/*
358 This variant of _send() can be used to save stack space by reusing
359 memory from the receive buffer. The caller provides a
360 mavlink_message_t which is the size of a full mavlink message. This
361 is usually the receive buffer for the channel, and allows a reply to an
362 incoming message with minimum stack space usage.
363 */
364static inline void mavlink_msg_generator_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t status, uint16_t generator_speed, float battery_current, float load_current, float power_generated, float bus_voltage, int16_t rectifier_temperature, float bat_current_setpoint, int16_t generator_temperature, uint32_t runtime, int32_t time_until_maintenance)
365{
366#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
367 char *buf = (char *)msgbuf;
368 _mav_put_uint64_t(buf, 0, status);
369 _mav_put_float(buf, 8, battery_current);
370 _mav_put_float(buf, 12, load_current);
371 _mav_put_float(buf, 16, power_generated);
372 _mav_put_float(buf, 20, bus_voltage);
373 _mav_put_float(buf, 24, bat_current_setpoint);
374 _mav_put_uint32_t(buf, 28, runtime);
375 _mav_put_int32_t(buf, 32, time_until_maintenance);
376 _mav_put_uint16_t(buf, 36, generator_speed);
377 _mav_put_int16_t(buf, 38, rectifier_temperature);
378 _mav_put_int16_t(buf, 40, generator_temperature);
379
380 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GENERATOR_STATUS, buf, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC);
381#else
382 mavlink_generator_status_t *packet = (mavlink_generator_status_t *)msgbuf;
383 packet->status = status;
384 packet->battery_current = battery_current;
385 packet->load_current = load_current;
386 packet->power_generated = power_generated;
387 packet->bus_voltage = bus_voltage;
388 packet->bat_current_setpoint = bat_current_setpoint;
389 packet->runtime = runtime;
390 packet->time_until_maintenance = time_until_maintenance;
391 packet->generator_speed = generator_speed;
392 packet->rectifier_temperature = rectifier_temperature;
393 packet->generator_temperature = generator_temperature;
394
395 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GENERATOR_STATUS, (const char *)packet, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC);
396#endif
397}
398#endif
399
400#endif
401
402// MESSAGE GENERATOR_STATUS UNPACKING
403
404
405/**
406 * @brief Get field status from generator_status message
407 *
408 * @return Status flags.
409 */
410static inline uint64_t mavlink_msg_generator_status_get_status(const mavlink_message_t* msg)
411{
412 return _MAV_RETURN_uint64_t(msg, 0);
413}
414
415/**
416 * @brief Get field generator_speed from generator_status message
417 *
418 * @return [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.
419 */
420static inline uint16_t mavlink_msg_generator_status_get_generator_speed(const mavlink_message_t* msg)
421{
422 return _MAV_RETURN_uint16_t(msg, 36);
423}
424
425/**
426 * @brief Get field battery_current from generator_status message
427 *
428 * @return [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.
429 */
430static inline float mavlink_msg_generator_status_get_battery_current(const mavlink_message_t* msg)
431{
432 return _MAV_RETURN_float(msg, 8);
433}
434
435/**
436 * @brief Get field load_current from generator_status message
437 *
438 * @return [A] Current going to the UAV. If battery current not available this is the DC current from the generator. Positive for out. Negative for in. NaN: field not provided
439 */
440static inline float mavlink_msg_generator_status_get_load_current(const mavlink_message_t* msg)
441{
442 return _MAV_RETURN_float(msg, 12);
443}
444
445/**
446 * @brief Get field power_generated from generator_status message
447 *
448 * @return [W] The power being generated. NaN: field not provided
449 */
450static inline float mavlink_msg_generator_status_get_power_generated(const mavlink_message_t* msg)
451{
452 return _MAV_RETURN_float(msg, 16);
453}
454
455/**
456 * @brief Get field bus_voltage from generator_status message
457 *
458 * @return [V] Voltage of the bus seen at the generator, or battery bus if battery bus is controlled by generator and at a different voltage to main bus.
459 */
460static inline float mavlink_msg_generator_status_get_bus_voltage(const mavlink_message_t* msg)
461{
462 return _MAV_RETURN_float(msg, 20);
463}
464
465/**
466 * @brief Get field rectifier_temperature from generator_status message
467 *
468 * @return [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.
469 */
470static inline int16_t mavlink_msg_generator_status_get_rectifier_temperature(const mavlink_message_t* msg)
471{
472 return _MAV_RETURN_int16_t(msg, 38);
473}
474
475/**
476 * @brief Get field bat_current_setpoint from generator_status message
477 *
478 * @return [A] The target battery current. Positive for out. Negative for in. NaN: field not provided
479 */
480static inline float mavlink_msg_generator_status_get_bat_current_setpoint(const mavlink_message_t* msg)
481{
482 return _MAV_RETURN_float(msg, 24);
483}
484
485/**
486 * @brief Get field generator_temperature from generator_status message
487 *
488 * @return [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.
489 */
490static inline int16_t mavlink_msg_generator_status_get_generator_temperature(const mavlink_message_t* msg)
491{
492 return _MAV_RETURN_int16_t(msg, 40);
493}
494
495/**
496 * @brief Get field runtime from generator_status message
497 *
498 * @return [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.
499 */
500static inline uint32_t mavlink_msg_generator_status_get_runtime(const mavlink_message_t* msg)
501{
502 return _MAV_RETURN_uint32_t(msg, 28);
503}
504
505/**
506 * @brief Get field time_until_maintenance from generator_status message
507 *
508 * @return [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.
509 */
510static inline int32_t mavlink_msg_generator_status_get_time_until_maintenance(const mavlink_message_t* msg)
511{
512 return _MAV_RETURN_int32_t(msg, 32);
513}
514
515/**
516 * @brief Decode a generator_status message into a struct
517 *
518 * @param msg The message to decode
519 * @param generator_status C-struct to decode the message contents into
520 */
521static inline void mavlink_msg_generator_status_decode(const mavlink_message_t* msg, mavlink_generator_status_t* generator_status)
522{
523#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
524 generator_status->status = mavlink_msg_generator_status_get_status(msg);
525 generator_status->battery_current = mavlink_msg_generator_status_get_battery_current(msg);
526 generator_status->load_current = mavlink_msg_generator_status_get_load_current(msg);
527 generator_status->power_generated = mavlink_msg_generator_status_get_power_generated(msg);
528 generator_status->bus_voltage = mavlink_msg_generator_status_get_bus_voltage(msg);
529 generator_status->bat_current_setpoint = mavlink_msg_generator_status_get_bat_current_setpoint(msg);
530 generator_status->runtime = mavlink_msg_generator_status_get_runtime(msg);
531 generator_status->time_until_maintenance = mavlink_msg_generator_status_get_time_until_maintenance(msg);
532 generator_status->generator_speed = mavlink_msg_generator_status_get_generator_speed(msg);
533 generator_status->rectifier_temperature = mavlink_msg_generator_status_get_rectifier_temperature(msg);
534 generator_status->generator_temperature = mavlink_msg_generator_status_get_generator_temperature(msg);
535#else
536 uint8_t len = msg->len < MAVLINK_MSG_ID_GENERATOR_STATUS_LEN? msg->len : MAVLINK_MSG_ID_GENERATOR_STATUS_LEN;
537 memset(generator_status, 0, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
538 memcpy(generator_status, _MAV_PAYLOAD(msg), len);
539#endif
540}