aboutsummaryrefslogtreecommitdiff
path: root/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h
diff options
context:
space:
mode:
Diffstat (limited to 'mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h')
-rw-r--r--mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h b/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h
index 6c2667473..8672f8b8a 100644
--- a/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h
+++ b/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h
@@ -300,6 +300,66 @@ static inline void mavlink_msg_hil_sensor_send(mavlink_channel_t chan, uint64_t
#endif
}
+#if MAVLINK_MSG_ID_HIL_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN
+/*
+ This varient of _send() can be used to save stack space by re-using
+ memory from the receive buffer. The caller provides a
+ mavlink_message_t which is the size of a full mavlink message. This
+ is usually the receive buffer for the channel, and allows a reply to an
+ incoming message with minimum stack space usage.
+ */
+static inline void mavlink_msg_hil_sensor_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint32_t fields_updated)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+ char *buf = (char *)msgbuf;
+ _mav_put_uint64_t(buf, 0, time_usec);
+ _mav_put_float(buf, 8, xacc);
+ _mav_put_float(buf, 12, yacc);
+ _mav_put_float(buf, 16, zacc);
+ _mav_put_float(buf, 20, xgyro);
+ _mav_put_float(buf, 24, ygyro);
+ _mav_put_float(buf, 28, zgyro);
+ _mav_put_float(buf, 32, xmag);
+ _mav_put_float(buf, 36, ymag);
+ _mav_put_float(buf, 40, zmag);
+ _mav_put_float(buf, 44, abs_pressure);
+ _mav_put_float(buf, 48, diff_pressure);
+ _mav_put_float(buf, 52, pressure_alt);
+ _mav_put_float(buf, 56, temperature);
+ _mav_put_uint32_t(buf, 60, fields_updated);
+
+#if MAVLINK_CRC_EXTRA
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC);
+#else
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
+#endif
+#else
+ mavlink_hil_sensor_t *packet = (mavlink_hil_sensor_t *)msgbuf;
+ packet->time_usec = time_usec;
+ packet->xacc = xacc;
+ packet->yacc = yacc;
+ packet->zacc = zacc;
+ packet->xgyro = xgyro;
+ packet->ygyro = ygyro;
+ packet->zgyro = zgyro;
+ packet->xmag = xmag;
+ packet->ymag = ymag;
+ packet->zmag = zmag;
+ packet->abs_pressure = abs_pressure;
+ packet->diff_pressure = diff_pressure;
+ packet->pressure_alt = pressure_alt;
+ packet->temperature = temperature;
+ packet->fields_updated = fields_updated;
+
+#if MAVLINK_CRC_EXTRA
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, (const char *)packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC);
+#else
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, (const char *)packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
+#endif
+#endif
+}
+#endif
+
#endif
// MESSAGE HIL_SENSOR UNPACKING