aboutsummaryrefslogtreecommitdiff
path: root/mavlink/include/mavlink/v1.0/common/mavlink_msg_state_correction.h
diff options
context:
space:
mode:
Diffstat (limited to 'mavlink/include/mavlink/v1.0/common/mavlink_msg_state_correction.h')
-rw-r--r--mavlink/include/mavlink/v1.0/common/mavlink_msg_state_correction.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/mavlink/include/mavlink/v1.0/common/mavlink_msg_state_correction.h b/mavlink/include/mavlink/v1.0/common/mavlink_msg_state_correction.h
index 2db627b96..be2629dd8 100644
--- a/mavlink/include/mavlink/v1.0/common/mavlink_msg_state_correction.h
+++ b/mavlink/include/mavlink/v1.0/common/mavlink_msg_state_correction.h
@@ -234,6 +234,54 @@ static inline void mavlink_msg_state_correction_send(mavlink_channel_t chan, flo
#endif
}
+#if MAVLINK_MSG_ID_STATE_CORRECTION_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_state_correction_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float xErr, float yErr, float zErr, float rollErr, float pitchErr, float yawErr, float vxErr, float vyErr, float vzErr)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+ char *buf = (char *)msgbuf;
+ _mav_put_float(buf, 0, xErr);
+ _mav_put_float(buf, 4, yErr);
+ _mav_put_float(buf, 8, zErr);
+ _mav_put_float(buf, 12, rollErr);
+ _mav_put_float(buf, 16, pitchErr);
+ _mav_put_float(buf, 20, yawErr);
+ _mav_put_float(buf, 24, vxErr);
+ _mav_put_float(buf, 28, vyErr);
+ _mav_put_float(buf, 32, vzErr);
+
+#if MAVLINK_CRC_EXTRA
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATE_CORRECTION, buf, MAVLINK_MSG_ID_STATE_CORRECTION_LEN, MAVLINK_MSG_ID_STATE_CORRECTION_CRC);
+#else
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATE_CORRECTION, buf, MAVLINK_MSG_ID_STATE_CORRECTION_LEN);
+#endif
+#else
+ mavlink_state_correction_t *packet = (mavlink_state_correction_t *)msgbuf;
+ packet->xErr = xErr;
+ packet->yErr = yErr;
+ packet->zErr = zErr;
+ packet->rollErr = rollErr;
+ packet->pitchErr = pitchErr;
+ packet->yawErr = yawErr;
+ packet->vxErr = vxErr;
+ packet->vyErr = vyErr;
+ packet->vzErr = vzErr;
+
+#if MAVLINK_CRC_EXTRA
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATE_CORRECTION, (const char *)packet, MAVLINK_MSG_ID_STATE_CORRECTION_LEN, MAVLINK_MSG_ID_STATE_CORRECTION_CRC);
+#else
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATE_CORRECTION, (const char *)packet, MAVLINK_MSG_ID_STATE_CORRECTION_LEN);
+#endif
+#endif
+}
+#endif
+
#endif
// MESSAGE STATE_CORRECTION UNPACKING