Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_generator_status.h
blobef960e13cf9d61c768ed1b4a93b76e15a49600b3
1 #pragma once
2 // MESSAGE GENERATOR_STATUS PACKING
4 #define MAVLINK_MSG_ID_GENERATOR_STATUS 373
7 typedef struct __mavlink_generator_status_t {
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;
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
26 #define MAVLINK_MSG_ID_GENERATOR_STATUS_CRC 117
27 #define MAVLINK_MSG_ID_373_CRC 117
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 } \
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 } \
66 #endif
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
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)
87 static 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)
90 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
91 char buf[MAVLINK_MSG_ID_GENERATOR_STATUS_LEN];
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);
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;
119 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
120 #endif
122 msg->msgid = MAVLINK_MSG_ID_GENERATOR_STATUS;
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);
127 * @brief Pack a generator_status message on a channel
128 * @param system_id ID of this system
129 * @param component_id ID of this component (e.g. 200 for IMU)
130 * @param chan The MAVLink channel this message will be sent over
131 * @param msg The MAVLink message to compress the data into
132 * @param status Status flags.
133 * @param generator_speed [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.
134 * @param battery_current [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.
135 * @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
136 * @param power_generated [W] The power being generated. NaN: field not provided
137 * @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.
138 * @param rectifier_temperature [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.
139 * @param bat_current_setpoint [A] The target battery current. Positive for out. Negative for in. NaN: field not provided
140 * @param generator_temperature [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.
141 * @param runtime [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.
142 * @param time_until_maintenance [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.
143 * @return length of the message in bytes (excluding serial stream start sign)
145 static inline uint16_t mavlink_msg_generator_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
146 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)
149 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
150 char buf[MAVLINK_MSG_ID_GENERATOR_STATUS_LEN];
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);
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;
178 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
179 #endif
181 msg->msgid = MAVLINK_MSG_ID_GENERATOR_STATUS;
182 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);
186 * @brief Encode a generator_status struct
188 * @param system_id ID of this system
189 * @param component_id ID of this component (e.g. 200 for IMU)
190 * @param msg The MAVLink message to compress the data into
191 * @param generator_status C-struct to read the message contents from
193 static 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)
195 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);
199 * @brief Encode a generator_status struct on a channel
201 * @param system_id ID of this system
202 * @param component_id ID of this component (e.g. 200 for IMU)
203 * @param chan The MAVLink channel this message will be sent over
204 * @param msg The MAVLink message to compress the data into
205 * @param generator_status C-struct to read the message contents from
207 static 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)
209 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);
213 * @brief Send a generator_status message
214 * @param chan MAVLink channel to send the message
216 * @param status Status flags.
217 * @param generator_speed [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.
218 * @param battery_current [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.
219 * @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
220 * @param power_generated [W] The power being generated. NaN: field not provided
221 * @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.
222 * @param rectifier_temperature [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.
223 * @param bat_current_setpoint [A] The target battery current. Positive for out. Negative for in. NaN: field not provided
224 * @param generator_temperature [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.
225 * @param runtime [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.
226 * @param time_until_maintenance [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.
228 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
230 static 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)
232 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
233 char buf[MAVLINK_MSG_ID_GENERATOR_STATUS_LEN];
234 _mav_put_uint64_t(buf, 0, status);
235 _mav_put_float(buf, 8, battery_current);
236 _mav_put_float(buf, 12, load_current);
237 _mav_put_float(buf, 16, power_generated);
238 _mav_put_float(buf, 20, bus_voltage);
239 _mav_put_float(buf, 24, bat_current_setpoint);
240 _mav_put_uint32_t(buf, 28, runtime);
241 _mav_put_int32_t(buf, 32, time_until_maintenance);
242 _mav_put_uint16_t(buf, 36, generator_speed);
243 _mav_put_int16_t(buf, 38, rectifier_temperature);
244 _mav_put_int16_t(buf, 40, generator_temperature);
246 _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);
247 #else
248 mavlink_generator_status_t packet;
249 packet.status = status;
250 packet.battery_current = battery_current;
251 packet.load_current = load_current;
252 packet.power_generated = power_generated;
253 packet.bus_voltage = bus_voltage;
254 packet.bat_current_setpoint = bat_current_setpoint;
255 packet.runtime = runtime;
256 packet.time_until_maintenance = time_until_maintenance;
257 packet.generator_speed = generator_speed;
258 packet.rectifier_temperature = rectifier_temperature;
259 packet.generator_temperature = generator_temperature;
261 _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);
262 #endif
266 * @brief Send a generator_status message
267 * @param chan MAVLink channel to send the message
268 * @param struct The MAVLink struct to serialize
270 static inline void mavlink_msg_generator_status_send_struct(mavlink_channel_t chan, const mavlink_generator_status_t* generator_status)
272 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
273 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);
274 #else
275 _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);
276 #endif
279 #if MAVLINK_MSG_ID_GENERATOR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
281 This varient of _send() can be used to save stack space by re-using
282 memory from the receive buffer. The caller provides a
283 mavlink_message_t which is the size of a full mavlink message. This
284 is usually the receive buffer for the channel, and allows a reply to an
285 incoming message with minimum stack space usage.
287 static 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)
289 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
290 char *buf = (char *)msgbuf;
291 _mav_put_uint64_t(buf, 0, status);
292 _mav_put_float(buf, 8, battery_current);
293 _mav_put_float(buf, 12, load_current);
294 _mav_put_float(buf, 16, power_generated);
295 _mav_put_float(buf, 20, bus_voltage);
296 _mav_put_float(buf, 24, bat_current_setpoint);
297 _mav_put_uint32_t(buf, 28, runtime);
298 _mav_put_int32_t(buf, 32, time_until_maintenance);
299 _mav_put_uint16_t(buf, 36, generator_speed);
300 _mav_put_int16_t(buf, 38, rectifier_temperature);
301 _mav_put_int16_t(buf, 40, generator_temperature);
303 _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);
304 #else
305 mavlink_generator_status_t *packet = (mavlink_generator_status_t *)msgbuf;
306 packet->status = status;
307 packet->battery_current = battery_current;
308 packet->load_current = load_current;
309 packet->power_generated = power_generated;
310 packet->bus_voltage = bus_voltage;
311 packet->bat_current_setpoint = bat_current_setpoint;
312 packet->runtime = runtime;
313 packet->time_until_maintenance = time_until_maintenance;
314 packet->generator_speed = generator_speed;
315 packet->rectifier_temperature = rectifier_temperature;
316 packet->generator_temperature = generator_temperature;
318 _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);
319 #endif
321 #endif
323 #endif
325 // MESSAGE GENERATOR_STATUS UNPACKING
329 * @brief Get field status from generator_status message
331 * @return Status flags.
333 static inline uint64_t mavlink_msg_generator_status_get_status(const mavlink_message_t* msg)
335 return _MAV_RETURN_uint64_t(msg, 0);
339 * @brief Get field generator_speed from generator_status message
341 * @return [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided.
343 static inline uint16_t mavlink_msg_generator_status_get_generator_speed(const mavlink_message_t* msg)
345 return _MAV_RETURN_uint16_t(msg, 36);
349 * @brief Get field battery_current from generator_status message
351 * @return [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided.
353 static inline float mavlink_msg_generator_status_get_battery_current(const mavlink_message_t* msg)
355 return _MAV_RETURN_float(msg, 8);
359 * @brief Get field load_current from generator_status message
361 * @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
363 static inline float mavlink_msg_generator_status_get_load_current(const mavlink_message_t* msg)
365 return _MAV_RETURN_float(msg, 12);
369 * @brief Get field power_generated from generator_status message
371 * @return [W] The power being generated. NaN: field not provided
373 static inline float mavlink_msg_generator_status_get_power_generated(const mavlink_message_t* msg)
375 return _MAV_RETURN_float(msg, 16);
379 * @brief Get field bus_voltage from generator_status message
381 * @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.
383 static inline float mavlink_msg_generator_status_get_bus_voltage(const mavlink_message_t* msg)
385 return _MAV_RETURN_float(msg, 20);
389 * @brief Get field rectifier_temperature from generator_status message
391 * @return [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided.
393 static inline int16_t mavlink_msg_generator_status_get_rectifier_temperature(const mavlink_message_t* msg)
395 return _MAV_RETURN_int16_t(msg, 38);
399 * @brief Get field bat_current_setpoint from generator_status message
401 * @return [A] The target battery current. Positive for out. Negative for in. NaN: field not provided
403 static inline float mavlink_msg_generator_status_get_bat_current_setpoint(const mavlink_message_t* msg)
405 return _MAV_RETURN_float(msg, 24);
409 * @brief Get field generator_temperature from generator_status message
411 * @return [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided.
413 static inline int16_t mavlink_msg_generator_status_get_generator_temperature(const mavlink_message_t* msg)
415 return _MAV_RETURN_int16_t(msg, 40);
419 * @brief Get field runtime from generator_status message
421 * @return [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided.
423 static inline uint32_t mavlink_msg_generator_status_get_runtime(const mavlink_message_t* msg)
425 return _MAV_RETURN_uint32_t(msg, 28);
429 * @brief Get field time_until_maintenance from generator_status message
431 * @return [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided.
433 static inline int32_t mavlink_msg_generator_status_get_time_until_maintenance(const mavlink_message_t* msg)
435 return _MAV_RETURN_int32_t(msg, 32);
439 * @brief Decode a generator_status message into a struct
441 * @param msg The message to decode
442 * @param generator_status C-struct to decode the message contents into
444 static inline void mavlink_msg_generator_status_decode(const mavlink_message_t* msg, mavlink_generator_status_t* generator_status)
446 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
447 generator_status->status = mavlink_msg_generator_status_get_status(msg);
448 generator_status->battery_current = mavlink_msg_generator_status_get_battery_current(msg);
449 generator_status->load_current = mavlink_msg_generator_status_get_load_current(msg);
450 generator_status->power_generated = mavlink_msg_generator_status_get_power_generated(msg);
451 generator_status->bus_voltage = mavlink_msg_generator_status_get_bus_voltage(msg);
452 generator_status->bat_current_setpoint = mavlink_msg_generator_status_get_bat_current_setpoint(msg);
453 generator_status->runtime = mavlink_msg_generator_status_get_runtime(msg);
454 generator_status->time_until_maintenance = mavlink_msg_generator_status_get_time_until_maintenance(msg);
455 generator_status->generator_speed = mavlink_msg_generator_status_get_generator_speed(msg);
456 generator_status->rectifier_temperature = mavlink_msg_generator_status_get_rectifier_temperature(msg);
457 generator_status->generator_temperature = mavlink_msg_generator_status_get_generator_temperature(msg);
458 #else
459 uint8_t len = msg->len < MAVLINK_MSG_ID_GENERATOR_STATUS_LEN? msg->len : MAVLINK_MSG_ID_GENERATOR_STATUS_LEN;
460 memset(generator_status, 0, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN);
461 memcpy(generator_status, _MAV_PAYLOAD(msg), len);
462 #endif