Commit 2977b93b authored by LM's avatar LM

Updated MAVLink to latest draft

parent ce112d3a
......@@ -20,7 +20,7 @@ extern "C" {
#endif
#ifndef MAVLINK_MESSAGE_INFO
#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_SYSTEM_TIME_UTC, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {}, {}, {}, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_SET_FLIGHT_MODE, MAVLINK_MESSAGE_INFO_SET_SAFETY_MODE, {}, {}, {}, {}, {}, {}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, {}, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_LOCAL_POSITION, MAVLINK_MESSAGE_INFO_GPS_RAW, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION, {}, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_WAYPOINT, MAVLINK_MESSAGE_INFO_WAYPOINT_REQUEST, MAVLINK_MESSAGE_INFO_WAYPOINT_SET_CURRENT, MAVLINK_MESSAGE_INFO_WAYPOINT_CURRENT, MAVLINK_MESSAGE_INFO_WAYPOINT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_WAYPOINT_COUNT, MAVLINK_MESSAGE_INFO_WAYPOINT_CLEAR_ALL, MAVLINK_MESSAGE_INFO_WAYPOINT_REACHED, MAVLINK_MESSAGE_INFO_WAYPOINT_ACK, MAVLINK_MESSAGE_INFO_GPS_SET_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_LOCAL_ORIGIN_SET, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT_SET, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, {}, {}, {}, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_POSITION_TARGET, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {}, {}, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_SHORT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {}, {}, {}, {}, {}, {}, {}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS, MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG}
#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_SYSTEM_TIME_UTC, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_SET_FLIGHT_MODE, MAVLINK_MESSAGE_INFO_SET_SAFETY_MODE, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_LOCAL_POSITION, MAVLINK_MESSAGE_INFO_GPS_RAW, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_WAYPOINT, MAVLINK_MESSAGE_INFO_WAYPOINT_REQUEST, MAVLINK_MESSAGE_INFO_WAYPOINT_SET_CURRENT, MAVLINK_MESSAGE_INFO_WAYPOINT_CURRENT, MAVLINK_MESSAGE_INFO_WAYPOINT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_WAYPOINT_COUNT, MAVLINK_MESSAGE_INFO_WAYPOINT_CLEAR_ALL, MAVLINK_MESSAGE_INFO_WAYPOINT_REACHED, MAVLINK_MESSAGE_INFO_WAYPOINT_ACK, MAVLINK_MESSAGE_INFO_GPS_SET_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_LOCAL_ORIGIN_SET, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT_SET, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_POSITION_TARGET, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {"EMPTY",0,{}}, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_SHORT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS, MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, {"EMPTY",0,{}}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG}
#endif
#include "../protocol.h"
......
......@@ -13,6 +13,10 @@
#define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
#endif
#ifndef MAVLINK_ALIGNED_FIELDS
#define MAVLINK_ALIGNED_FIELDS 1
#endif
#ifndef MAVLINK_CRC_EXTRA
#define MAVLINK_CRC_EXTRA 1
#endif
......
......@@ -125,49 +125,6 @@ static inline uint16_t mavlink_msg_sensor_offsets_pack_chan(uint8_t system_id, u
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 42, 134);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a sensor_offsets message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param mag_ofs_x magnetometer X offset
* @param mag_ofs_y magnetometer Y offset
* @param mag_ofs_z magnetometer Z offset
* @param mag_declination magnetic declination (radians)
* @param raw_press raw pressure from barometer
* @param raw_temp raw temperature from barometer
* @param gyro_cal_x gyro X calibration
* @param gyro_cal_y gyro Y calibration
* @param gyro_cal_z gyro Z calibration
* @param accel_cal_x accel X calibration
* @param accel_cal_y accel Y calibration
* @param accel_cal_z accel Z calibration
*/
static inline void mavlink_msg_sensor_offsets_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
int16_t mag_ofs_x,int16_t mag_ofs_y,int16_t mag_ofs_z,float mag_declination,int32_t raw_press,int32_t raw_temp,float gyro_cal_x,float gyro_cal_y,float gyro_cal_z,float accel_cal_x,float accel_cal_y,float accel_cal_z)
{
msg->msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS;
put_float_by_index(msg, 0, mag_declination); // magnetic declination (radians)
put_int32_t_by_index(msg, 4, raw_press); // raw pressure from barometer
put_int32_t_by_index(msg, 8, raw_temp); // raw temperature from barometer
put_float_by_index(msg, 12, gyro_cal_x); // gyro X calibration
put_float_by_index(msg, 16, gyro_cal_y); // gyro Y calibration
put_float_by_index(msg, 20, gyro_cal_z); // gyro Z calibration
put_float_by_index(msg, 24, accel_cal_x); // accel X calibration
put_float_by_index(msg, 28, accel_cal_y); // accel Y calibration
put_float_by_index(msg, 32, accel_cal_z); // accel Z calibration
put_int16_t_by_index(msg, 36, mag_ofs_x); // magnetometer X offset
put_int16_t_by_index(msg, 38, mag_ofs_y); // magnetometer Y offset
put_int16_t_by_index(msg, 40, mag_ofs_z); // magnetometer Z offset
mavlink_finalize_message_chan_send(msg, chan, 42, 134);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a sensor_offsets struct into a message
*
......@@ -203,7 +160,22 @@ static inline uint16_t mavlink_msg_sensor_offsets_encode(uint8_t system_id, uint
static inline void mavlink_msg_sensor_offsets_send(mavlink_channel_t chan, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z, float mag_declination, int32_t raw_press, int32_t raw_temp, float gyro_cal_x, float gyro_cal_y, float gyro_cal_z, float accel_cal_x, float accel_cal_y, float accel_cal_z)
{
MAVLINK_ALIGNED_MESSAGE(msg, 42);
mavlink_msg_sensor_offsets_pack_chan_send(chan, msg, mag_ofs_x, mag_ofs_y, mag_ofs_z, mag_declination, raw_press, raw_temp, gyro_cal_x, gyro_cal_y, gyro_cal_z, accel_cal_x, accel_cal_y, accel_cal_z);
msg->msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS;
put_float_by_index(msg, 0, mag_declination); // magnetic declination (radians)
put_int32_t_by_index(msg, 4, raw_press); // raw pressure from barometer
put_int32_t_by_index(msg, 8, raw_temp); // raw temperature from barometer
put_float_by_index(msg, 12, gyro_cal_x); // gyro X calibration
put_float_by_index(msg, 16, gyro_cal_y); // gyro Y calibration
put_float_by_index(msg, 20, gyro_cal_z); // gyro Z calibration
put_float_by_index(msg, 24, accel_cal_x); // accel X calibration
put_float_by_index(msg, 28, accel_cal_y); // accel Y calibration
put_float_by_index(msg, 32, accel_cal_z); // accel Z calibration
put_int16_t_by_index(msg, 36, mag_ofs_x); // magnetometer X offset
put_int16_t_by_index(msg, 38, mag_ofs_y); // magnetometer Y offset
put_int16_t_by_index(msg, 40, mag_ofs_z); // magnetometer Z offset
mavlink_finalize_message_chan_send(msg, chan, 42, 134);
}
#endif
......
......@@ -83,35 +83,6 @@ static inline uint16_t mavlink_msg_set_mag_offsets_pack_chan(uint8_t system_id,
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 8, 219);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a set_mag_offsets message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System ID
* @param target_component Component ID
* @param mag_ofs_x magnetometer X offset
* @param mag_ofs_y magnetometer Y offset
* @param mag_ofs_z magnetometer Z offset
*/
static inline void mavlink_msg_set_mag_offsets_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t target_component,int16_t mag_ofs_x,int16_t mag_ofs_y,int16_t mag_ofs_z)
{
msg->msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS;
put_int16_t_by_index(msg, 0, mag_ofs_x); // magnetometer X offset
put_int16_t_by_index(msg, 2, mag_ofs_y); // magnetometer Y offset
put_int16_t_by_index(msg, 4, mag_ofs_z); // magnetometer Z offset
put_uint8_t_by_index(msg, 6, target_system); // System ID
put_uint8_t_by_index(msg, 7, target_component); // Component ID
mavlink_finalize_message_chan_send(msg, chan, 8, 219);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a set_mag_offsets struct into a message
*
......@@ -140,7 +111,15 @@ static inline uint16_t mavlink_msg_set_mag_offsets_encode(uint8_t system_id, uin
static inline void mavlink_msg_set_mag_offsets_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z)
{
MAVLINK_ALIGNED_MESSAGE(msg, 8);
mavlink_msg_set_mag_offsets_pack_chan_send(chan, msg, target_system, target_component, mag_ofs_x, mag_ofs_y, mag_ofs_z);
msg->msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS;
put_int16_t_by_index(msg, 0, mag_ofs_x); // magnetometer X offset
put_int16_t_by_index(msg, 2, mag_ofs_y); // magnetometer Y offset
put_int16_t_by_index(msg, 4, mag_ofs_z); // magnetometer Z offset
put_uint8_t_by_index(msg, 6, target_system); // System ID
put_uint8_t_by_index(msg, 7, target_component); // Component ID
mavlink_finalize_message_chan_send(msg, chan, 8, 219);
}
#endif
......
......@@ -55,8 +55,7 @@ static void mavlink_test_sensor_offsets(uint8_t system_id, uint8_t component_id)
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
}
mavlink_msg_sensor_offsets_pack_chan_send(MAVLINK_COMM_1, &msg , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
mavlink_msg_sensor_offsets_send(MAVLINK_COMM_2 , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
mavlink_msg_sensor_offsets_send(MAVLINK_COMM_1 , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
}
static void mavlink_test_set_mag_offsets(uint8_t system_id, uint8_t component_id)
......@@ -83,8 +82,7 @@ static void mavlink_test_set_mag_offsets(uint8_t system_id, uint8_t component_id
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
}
mavlink_msg_set_mag_offsets_pack_chan_send(MAVLINK_COMM_1, &msg , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
mavlink_msg_set_mag_offsets_send(MAVLINK_COMM_2 , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
mavlink_msg_set_mag_offsets_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
}
static void mavlink_test_ardupilotmega(uint8_t system_id, uint8_t component_id)
......
......@@ -5,7 +5,7 @@
#ifndef MAVLINK_VERSION_H
#define MAVLINK_VERSION_H
#define MAVLINK_BUILD_DATE "Sat Aug 27 10:06:30 2011"
#define MAVLINK_BUILD_DATE "Mon Aug 29 10:37:55 2011"
#define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
#include "mavlink.h"
......
......@@ -54,7 +54,7 @@ static inline void crc_init(uint16_t* crcAccum)
* @param length length of the byte array
* @return the checksum over the buffer bytes
**/
static inline uint16_t crc_calculate(uint8_t* pBuffer, int length)
static inline uint16_t crc_calculate(uint8_t* pBuffer, uint16_t length)
{
uint16_t crcTmp;
crc_init(&crcTmp);
......
This diff is collapsed.
/** @file
* @brief MAVLink comm protocol built from common.xml
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Fri Aug 26 14:04:08 2011
*/
#ifndef MAVLINK_H
#define MAVLINK_H
......@@ -14,6 +13,10 @@
#define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
#endif
#ifndef MAVLINK_ALIGNED_FIELDS
#define MAVLINK_ALIGNED_FIELDS 1
#endif
#ifndef MAVLINK_CRC_EXTRA
#define MAVLINK_CRC_EXTRA 1
#endif
......
......@@ -95,39 +95,6 @@ static inline uint16_t mavlink_msg_attitude_pack_chan(uint8_t system_id, uint8_t
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 32, 66);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a attitude message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param roll Roll angle (rad)
* @param pitch Pitch angle (rad)
* @param yaw Yaw angle (rad)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
*/
static inline void mavlink_msg_attitude_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
uint64_t usec,float roll,float pitch,float yaw,float rollspeed,float pitchspeed,float yawspeed)
{
msg->msgid = MAVLINK_MSG_ID_ATTITUDE;
put_uint64_t_by_index(msg, 0, usec); // Timestamp (microseconds since UNIX epoch or microseconds since system boot)
put_float_by_index(msg, 8, roll); // Roll angle (rad)
put_float_by_index(msg, 12, pitch); // Pitch angle (rad)
put_float_by_index(msg, 16, yaw); // Yaw angle (rad)
put_float_by_index(msg, 20, rollspeed); // Roll angular speed (rad/s)
put_float_by_index(msg, 24, pitchspeed); // Pitch angular speed (rad/s)
put_float_by_index(msg, 28, yawspeed); // Yaw angular speed (rad/s)
mavlink_finalize_message_chan_send(msg, chan, 32, 66);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a attitude struct into a message
*
......@@ -158,7 +125,17 @@ static inline uint16_t mavlink_msg_attitude_encode(uint8_t system_id, uint8_t co
static inline void mavlink_msg_attitude_send(mavlink_channel_t chan, uint64_t usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
{
MAVLINK_ALIGNED_MESSAGE(msg, 32);
mavlink_msg_attitude_pack_chan_send(chan, msg, usec, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed);
msg->msgid = MAVLINK_MSG_ID_ATTITUDE;
put_uint64_t_by_index(msg, 0, usec); // Timestamp (microseconds since UNIX epoch or microseconds since system boot)
put_float_by_index(msg, 8, roll); // Roll angle (rad)
put_float_by_index(msg, 12, pitch); // Pitch angle (rad)
put_float_by_index(msg, 16, yaw); // Yaw angle (rad)
put_float_by_index(msg, 20, rollspeed); // Roll angular speed (rad/s)
put_float_by_index(msg, 24, pitchspeed); // Pitch angular speed (rad/s)
put_float_by_index(msg, 28, yawspeed); // Yaw angular speed (rad/s)
mavlink_finalize_message_chan_send(msg, chan, 32, 66);
}
#endif
......
......@@ -59,27 +59,6 @@ static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id, uint8_t
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 32, 119);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a auth_key message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param key key
*/
static inline void mavlink_msg_auth_key_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
const char *key)
{
msg->msgid = MAVLINK_MSG_ID_AUTH_KEY;
put_char_array_by_index(msg, 0, key, 32); // key
mavlink_finalize_message_chan_send(msg, chan, 32, 119);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a auth_key struct into a message
*
......@@ -104,7 +83,11 @@ static inline uint16_t mavlink_msg_auth_key_encode(uint8_t system_id, uint8_t co
static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char *key)
{
MAVLINK_ALIGNED_MESSAGE(msg, 32);
mavlink_msg_auth_key_pack_chan_send(chan, msg, key);
msg->msgid = MAVLINK_MSG_ID_AUTH_KEY;
put_char_array_by_index(msg, 0, key, 32); // key
mavlink_finalize_message_chan_send(msg, chan, 32, 119);
}
#endif
......
......@@ -77,33 +77,6 @@ static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t sys
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 28, 217);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a change_operator_control message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System the GCS requests control for
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
* @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
* @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
*/
static inline void mavlink_msg_change_operator_control_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t control_request,uint8_t version,const char *passkey)
{
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
put_uint8_t_by_index(msg, 0, target_system); // System the GCS requests control for
put_uint8_t_by_index(msg, 1, control_request); // 0: request control of this MAV, 1: Release control of this MAV
put_uint8_t_by_index(msg, 2, version); // 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
put_char_array_by_index(msg, 3, passkey, 25); // Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
mavlink_finalize_message_chan_send(msg, chan, 28, 217);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a change_operator_control struct into a message
*
......@@ -131,7 +104,14 @@ static inline uint16_t mavlink_msg_change_operator_control_encode(uint8_t system
static inline void mavlink_msg_change_operator_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
{
MAVLINK_ALIGNED_MESSAGE(msg, 28);
mavlink_msg_change_operator_control_pack_chan_send(chan, msg, target_system, control_request, version, passkey);
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
put_uint8_t_by_index(msg, 0, target_system); // System the GCS requests control for
put_uint8_t_by_index(msg, 1, control_request); // 0: request control of this MAV, 1: Release control of this MAV
put_uint8_t_by_index(msg, 2, version); // 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
put_char_array_by_index(msg, 3, passkey, 25); // Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
mavlink_finalize_message_chan_send(msg, chan, 28, 217);
}
#endif
......
......@@ -71,31 +71,6 @@ static inline uint16_t mavlink_msg_change_operator_control_ack_pack_chan(uint8_t
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 3, 104);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a change_operator_control_ack message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param gcs_system_id ID of the GCS this message
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
* @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
*/
static inline void mavlink_msg_change_operator_control_ack_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
uint8_t gcs_system_id,uint8_t control_request,uint8_t ack)
{
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
put_uint8_t_by_index(msg, 0, gcs_system_id); // ID of the GCS this message
put_uint8_t_by_index(msg, 1, control_request); // 0: request control of this MAV, 1: Release control of this MAV
put_uint8_t_by_index(msg, 2, ack); // 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
mavlink_finalize_message_chan_send(msg, chan, 3, 104);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a change_operator_control_ack struct into a message
*
......@@ -122,7 +97,13 @@ static inline uint16_t mavlink_msg_change_operator_control_ack_encode(uint8_t sy
static inline void mavlink_msg_change_operator_control_ack_send(mavlink_channel_t chan, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
{
MAVLINK_ALIGNED_MESSAGE(msg, 3);
mavlink_msg_change_operator_control_ack_pack_chan_send(chan, msg, gcs_system_id, control_request, ack);
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
put_uint8_t_by_index(msg, 0, gcs_system_id); // ID of the GCS this message
put_uint8_t_by_index(msg, 1, control_request); // 0: request control of this MAV, 1: Release control of this MAV
put_uint8_t_by_index(msg, 2, ack); // 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
mavlink_finalize_message_chan_send(msg, chan, 3, 104);
}
#endif
......
......@@ -65,29 +65,6 @@ static inline uint16_t mavlink_msg_command_ack_pack_chan(uint8_t system_id, uint
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 8, 8);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a command_ack message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param command Current airspeed in m/s
* @param result 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
*/
static inline void mavlink_msg_command_ack_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
float command,float result)
{
msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK;
put_float_by_index(msg, 0, command); // Current airspeed in m/s
put_float_by_index(msg, 4, result); // 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
mavlink_finalize_message_chan_send(msg, chan, 8, 8);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a command_ack struct into a message
*
......@@ -113,7 +90,12 @@ static inline uint16_t mavlink_msg_command_ack_encode(uint8_t system_id, uint8_t
static inline void mavlink_msg_command_ack_send(mavlink_channel_t chan, float command, float result)
{
MAVLINK_ALIGNED_MESSAGE(msg, 8);
mavlink_msg_command_ack_pack_chan_send(chan, msg, command, result);
msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK;
put_float_by_index(msg, 0, command); // Current airspeed in m/s
put_float_by_index(msg, 4, result); // 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
mavlink_finalize_message_chan_send(msg, chan, 8, 8);
}
#endif
......
......@@ -119,47 +119,6 @@ static inline uint16_t mavlink_msg_command_long_pack_chan(uint8_t system_id, uin
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 32, 168);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a command_long message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System which should execute the command
* @param target_component Component which should execute the command, 0 for all components
* @param command Command ID, as defined by MAV_CMD enum.
* @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
* @param param1 Parameter 1, as defined by MAV_CMD enum.
* @param param2 Parameter 2, as defined by MAV_CMD enum.
* @param param3 Parameter 3, as defined by MAV_CMD enum.
* @param param4 Parameter 4, as defined by MAV_CMD enum.
* @param param5 Parameter 5, as defined by MAV_CMD enum.
* @param param6 Parameter 6, as defined by MAV_CMD enum.
* @param param7 Parameter 7, as defined by MAV_CMD enum.
*/
static inline void mavlink_msg_command_long_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t target_component,uint8_t command,uint8_t confirmation,float param1,float param2,float param3,float param4,float param5,float param6,float param7)
{
msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
put_float_by_index(msg, 0, param1); // Parameter 1, as defined by MAV_CMD enum.
put_float_by_index(msg, 4, param2); // Parameter 2, as defined by MAV_CMD enum.
put_float_by_index(msg, 8, param3); // Parameter 3, as defined by MAV_CMD enum.
put_float_by_index(msg, 12, param4); // Parameter 4, as defined by MAV_CMD enum.
put_float_by_index(msg, 16, param5); // Parameter 5, as defined by MAV_CMD enum.
put_float_by_index(msg, 20, param6); // Parameter 6, as defined by MAV_CMD enum.
put_float_by_index(msg, 24, param7); // Parameter 7, as defined by MAV_CMD enum.
put_uint8_t_by_index(msg, 28, target_system); // System which should execute the command
put_uint8_t_by_index(msg, 29, target_component); // Component which should execute the command, 0 for all components
put_uint8_t_by_index(msg, 30, command); // Command ID, as defined by MAV_CMD enum.
put_uint8_t_by_index(msg, 31, confirmation); // 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
mavlink_finalize_message_chan_send(msg, chan, 32, 168);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a command_long struct into a message
*
......@@ -194,7 +153,21 @@ static inline uint16_t mavlink_msg_command_long_encode(uint8_t system_id, uint8_
static inline void mavlink_msg_command_long_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
{
MAVLINK_ALIGNED_MESSAGE(msg, 32);
mavlink_msg_command_long_pack_chan_send(chan, msg, target_system, target_component, command, confirmation, param1, param2, param3, param4, param5, param6, param7);
msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
put_float_by_index(msg, 0, param1); // Parameter 1, as defined by MAV_CMD enum.
put_float_by_index(msg, 4, param2); // Parameter 2, as defined by MAV_CMD enum.
put_float_by_index(msg, 8, param3); // Parameter 3, as defined by MAV_CMD enum.
put_float_by_index(msg, 12, param4); // Parameter 4, as defined by MAV_CMD enum.
put_float_by_index(msg, 16, param5); // Parameter 5, as defined by MAV_CMD enum.
put_float_by_index(msg, 20, param6); // Parameter 6, as defined by MAV_CMD enum.
put_float_by_index(msg, 24, param7); // Parameter 7, as defined by MAV_CMD enum.
put_uint8_t_by_index(msg, 28, target_system); // System which should execute the command
put_uint8_t_by_index(msg, 29, target_component); // Component which should execute the command, 0 for all components
put_uint8_t_by_index(msg, 30, command); // Command ID, as defined by MAV_CMD enum.
put_uint8_t_by_index(msg, 31, confirmation); // 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
mavlink_finalize_message_chan_send(msg, chan, 32, 168);
}
#endif
......
......@@ -101,41 +101,6 @@ static inline uint16_t mavlink_msg_command_short_pack_chan(uint8_t system_id, ui
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 20, 160);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a command_short message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System which should execute the command
* @param target_component Component which should execute the command, 0 for all components
* @param command Command ID, as defined by MAV_CMD enum.
* @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
* @param param1 Parameter 1, as defined by MAV_CMD enum.
* @param param2 Parameter 2, as defined by MAV_CMD enum.
* @param param3 Parameter 3, as defined by MAV_CMD enum.
* @param param4 Parameter 4, as defined by MAV_CMD enum.
*/
static inline void mavlink_msg_command_short_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t target_component,uint8_t command,uint8_t confirmation,float param1,float param2,float param3,float param4)
{
msg->msgid = MAVLINK_MSG_ID_COMMAND_SHORT;
put_float_by_index(msg, 0, param1); // Parameter 1, as defined by MAV_CMD enum.
put_float_by_index(msg, 4, param2); // Parameter 2, as defined by MAV_CMD enum.
put_float_by_index(msg, 8, param3); // Parameter 3, as defined by MAV_CMD enum.
put_float_by_index(msg, 12, param4); // Parameter 4, as defined by MAV_CMD enum.
put_uint8_t_by_index(msg, 16, target_system); // System which should execute the command
put_uint8_t_by_index(msg, 17, target_component); // Component which should execute the command, 0 for all components
put_uint8_t_by_index(msg, 18, command); // Command ID, as defined by MAV_CMD enum.
put_uint8_t_by_index(msg, 19, confirmation); // 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
mavlink_finalize_message_chan_send(msg, chan, 20, 160);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Encode a command_short struct into a message
*
......@@ -167,7 +132,18 @@ static inline uint16_t mavlink_msg_command_short_encode(uint8_t system_id, uint8
static inline void mavlink_msg_command_short_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t command, uint8_t confirmation, float param1, float param2, float param3, float param4)
{
MAVLINK_ALIGNED_MESSAGE(msg, 20);
mavlink_msg_command_short_pack_chan_send(chan, msg, target_system, target_component, command, confirmation, param1, param2, param3, param4);
msg->msgid = MAVLINK_MSG_ID_COMMAND_SHORT;
put_float_by_index(msg, 0, param1); // Parameter 1, as defined by MAV_CMD enum.
put_float_by_index(msg, 4, param2); // Parameter 2, as defined by MAV_CMD enum.
put_float_by_index(msg, 8, param3); // Parameter 3, as defined by MAV_CMD enum.
put_float_by_index(msg, 12, param4); // Parameter 4, as defined by MAV_CMD enum.
put_uint8_t_by_index(msg, 16, target_system); // System which should execute the command
put_uint8_t_by_index(msg, 17, target_component); // Component which should execute the command, 0 for all components
put_uint8_t_by_index(msg, 18, command); // Command ID, as defined by MAV_CMD enum.
put_uint8_t_by_index(msg, 19, confirmation); // 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
mavlink_finalize_message_chan_send(msg, chan, 20, 160);
}
#endif
......
......@@ -71,31 +71,6 @@ static inline uint16_t mavlink_msg_data_stream_pack_chan(uint8_t system_id, uint
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 4, 21);
}
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
/**
* @brief Pack a data_stream message on a channel and send
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param stream_id The ID of the requested data stream
* @param message_rate The requested interval between two messages of this type
* @param on_off 1 stream is enabled, 0 stream is stopped.
*/
static inline void mavlink_msg_data_stream_pack_chan_send(mavlink_channel_t chan,
mavlink_message_t* msg,
uint8_t stream_id,uint16_t message_rate,uint8_t on_off)
{
msg->msgid = MAVLINK_MSG_ID_DATA_STREAM;
put_uint16_t_by_index(msg, 0, message_rate); // The requested interval between two messages of this type
put_uint8_t_by_index(msg, 2, stream_id); // The ID of the requested data stream
put_uint8_t_by_index(msg, 3, on_off); // 1 stream is enabled, 0 stream is stopped.
mavlink_finalize_message_chan_send(msg, chan, 4, 21);
}
#endif // MAVLINK_USE_CONVENIENCE_FUNCTIONS