aboutsummaryrefslogtreecommitdiff
path: root/mavlink/include/mavlink/v1.0/common/mavlink_msg_vfr_hud.h
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-07-07 00:05:29 +0200
committerLorenz Meier <lm@inf.ethz.ch>2014-07-07 00:05:29 +0200
commit5559e568b6e5502ad51ec96fd531876c1191d641 (patch)
treebc6356b5bed0481cced4a7d7e7ef99bd225d91a7 /mavlink/include/mavlink/v1.0/common/mavlink_msg_vfr_hud.h
parent863385dbc4243c8ecb19890a0dfce4a0b7ead9d6 (diff)
parentd67089b23f58ac152253f58c5deaebbd57db0362 (diff)
downloadpx4-firmware-safelink.tar.gz
px4-firmware-safelink.tar.bz2
px4-firmware-safelink.zip
Merged master into safelinksafelink
Diffstat (limited to 'mavlink/include/mavlink/v1.0/common/mavlink_msg_vfr_hud.h')
-rw-r--r--mavlink/include/mavlink/v1.0/common/mavlink_msg_vfr_hud.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/mavlink/include/mavlink/v1.0/common/mavlink_msg_vfr_hud.h b/mavlink/include/mavlink/v1.0/common/mavlink_msg_vfr_hud.h
index 5b1093a3d..b130ee50b 100644
--- a/mavlink/include/mavlink/v1.0/common/mavlink_msg_vfr_hud.h
+++ b/mavlink/include/mavlink/v1.0/common/mavlink_msg_vfr_hud.h
@@ -201,6 +201,48 @@ static inline void mavlink_msg_vfr_hud_send(mavlink_channel_t chan, float airspe
#endif
}
+#if MAVLINK_MSG_ID_VFR_HUD_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_vfr_hud_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float airspeed, float groundspeed, int16_t heading, uint16_t throttle, float alt, float climb)
+{
+#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
+ char *buf = (char *)msgbuf;
+ _mav_put_float(buf, 0, airspeed);
+ _mav_put_float(buf, 4, groundspeed);
+ _mav_put_float(buf, 8, alt);
+ _mav_put_float(buf, 12, climb);
+ _mav_put_int16_t(buf, 16, heading);
+ _mav_put_uint16_t(buf, 18, throttle);
+
+#if MAVLINK_CRC_EXTRA
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VFR_HUD, buf, MAVLINK_MSG_ID_VFR_HUD_LEN, MAVLINK_MSG_ID_VFR_HUD_CRC);
+#else
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VFR_HUD, buf, MAVLINK_MSG_ID_VFR_HUD_LEN);
+#endif
+#else
+ mavlink_vfr_hud_t *packet = (mavlink_vfr_hud_t *)msgbuf;
+ packet->airspeed = airspeed;
+ packet->groundspeed = groundspeed;
+ packet->alt = alt;
+ packet->climb = climb;
+ packet->heading = heading;
+ packet->throttle = throttle;
+
+#if MAVLINK_CRC_EXTRA
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VFR_HUD, (const char *)packet, MAVLINK_MSG_ID_VFR_HUD_LEN, MAVLINK_MSG_ID_VFR_HUD_CRC);
+#else
+ _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VFR_HUD, (const char *)packet, MAVLINK_MSG_ID_VFR_HUD_LEN);
+#endif
+#endif
+}
+#endif
+
#endif
// MESSAGE VFR_HUD UNPACKING