[88] | 1 | // MESSAGE PARAM_MAP_RC PACKING
|
---|
| 2 |
|
---|
| 3 | #define MAVLINK_MSG_ID_PARAM_MAP_RC 50
|
---|
| 4 |
|
---|
| 5 | typedef struct MAVLINK_PACKED __mavlink_param_map_rc_t
|
---|
| 6 | {
|
---|
| 7 | float param_value0; /*< Initial parameter value*/
|
---|
| 8 | float scale; /*< Scale, maps the RC range [-1, 1] to a parameter value*/
|
---|
| 9 | float param_value_min; /*< Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)*/
|
---|
| 10 | float param_value_max; /*< Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)*/
|
---|
| 11 | int16_t param_index; /*< Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.*/
|
---|
| 12 | uint8_t target_system; /*< System ID*/
|
---|
| 13 | uint8_t target_component; /*< Component ID*/
|
---|
| 14 | char param_id[16]; /*< Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string*/
|
---|
| 15 | uint8_t parameter_rc_channel_index; /*< Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.*/
|
---|
| 16 | } mavlink_param_map_rc_t;
|
---|
| 17 |
|
---|
| 18 | #define MAVLINK_MSG_ID_PARAM_MAP_RC_LEN 37
|
---|
| 19 | #define MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN 37
|
---|
| 20 | #define MAVLINK_MSG_ID_50_LEN 37
|
---|
| 21 | #define MAVLINK_MSG_ID_50_MIN_LEN 37
|
---|
| 22 |
|
---|
| 23 | #define MAVLINK_MSG_ID_PARAM_MAP_RC_CRC 78
|
---|
| 24 | #define MAVLINK_MSG_ID_50_CRC 78
|
---|
| 25 |
|
---|
| 26 | #define MAVLINK_MSG_PARAM_MAP_RC_FIELD_PARAM_ID_LEN 16
|
---|
| 27 |
|
---|
| 28 | #if MAVLINK_COMMAND_24BIT
|
---|
| 29 | #define MAVLINK_MESSAGE_INFO_PARAM_MAP_RC { \
|
---|
| 30 | 50, \
|
---|
| 31 | "PARAM_MAP_RC", \
|
---|
| 32 | 9, \
|
---|
| 33 | { { "param_value0", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_param_map_rc_t, param_value0) }, \
|
---|
| 34 | { "scale", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_param_map_rc_t, scale) }, \
|
---|
| 35 | { "param_value_min", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_param_map_rc_t, param_value_min) }, \
|
---|
| 36 | { "param_value_max", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_param_map_rc_t, param_value_max) }, \
|
---|
| 37 | { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_param_map_rc_t, param_index) }, \
|
---|
| 38 | { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_param_map_rc_t, target_system) }, \
|
---|
| 39 | { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_param_map_rc_t, target_component) }, \
|
---|
| 40 | { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 20, offsetof(mavlink_param_map_rc_t, param_id) }, \
|
---|
| 41 | { "parameter_rc_channel_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_param_map_rc_t, parameter_rc_channel_index) }, \
|
---|
| 42 | } \
|
---|
| 43 | }
|
---|
| 44 | #else
|
---|
| 45 | #define MAVLINK_MESSAGE_INFO_PARAM_MAP_RC { \
|
---|
| 46 | "PARAM_MAP_RC", \
|
---|
| 47 | 9, \
|
---|
| 48 | { { "param_value0", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_param_map_rc_t, param_value0) }, \
|
---|
| 49 | { "scale", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_param_map_rc_t, scale) }, \
|
---|
| 50 | { "param_value_min", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_param_map_rc_t, param_value_min) }, \
|
---|
| 51 | { "param_value_max", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_param_map_rc_t, param_value_max) }, \
|
---|
| 52 | { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_param_map_rc_t, param_index) }, \
|
---|
| 53 | { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_param_map_rc_t, target_system) }, \
|
---|
| 54 | { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_param_map_rc_t, target_component) }, \
|
---|
| 55 | { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 20, offsetof(mavlink_param_map_rc_t, param_id) }, \
|
---|
| 56 | { "parameter_rc_channel_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_param_map_rc_t, parameter_rc_channel_index) }, \
|
---|
| 57 | } \
|
---|
| 58 | }
|
---|
| 59 | #endif
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | * @brief Pack a param_map_rc message
|
---|
| 63 | * @param system_id ID of this system
|
---|
| 64 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 65 | * @param msg The MAVLink message to compress the data into
|
---|
| 66 | *
|
---|
| 67 | * @param target_system System ID
|
---|
| 68 | * @param target_component Component ID
|
---|
| 69 | * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
|
---|
| 70 | * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
|
---|
| 71 | * @param parameter_rc_channel_index Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
|
---|
| 72 | * @param param_value0 Initial parameter value
|
---|
| 73 | * @param scale Scale, maps the RC range [-1, 1] to a parameter value
|
---|
| 74 | * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
|
---|
| 75 | * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
|
---|
| 76 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 77 | */
|
---|
| 78 | static inline uint16_t mavlink_msg_param_map_rc_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
| 79 | uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t parameter_rc_channel_index, float param_value0, float scale, float param_value_min, float param_value_max)
|
---|
| 80 | {
|
---|
| 81 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 82 | char buf[MAVLINK_MSG_ID_PARAM_MAP_RC_LEN];
|
---|
| 83 | _mav_put_float(buf, 0, param_value0);
|
---|
| 84 | _mav_put_float(buf, 4, scale);
|
---|
| 85 | _mav_put_float(buf, 8, param_value_min);
|
---|
| 86 | _mav_put_float(buf, 12, param_value_max);
|
---|
| 87 | _mav_put_int16_t(buf, 16, param_index);
|
---|
| 88 | _mav_put_uint8_t(buf, 18, target_system);
|
---|
| 89 | _mav_put_uint8_t(buf, 19, target_component);
|
---|
| 90 | _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
|
---|
| 91 | _mav_put_char_array(buf, 20, param_id, 16);
|
---|
| 92 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
|
---|
| 93 | #else
|
---|
| 94 | mavlink_param_map_rc_t packet;
|
---|
| 95 | packet.param_value0 = param_value0;
|
---|
| 96 | packet.scale = scale;
|
---|
| 97 | packet.param_value_min = param_value_min;
|
---|
| 98 | packet.param_value_max = param_value_max;
|
---|
| 99 | packet.param_index = param_index;
|
---|
| 100 | packet.target_system = target_system;
|
---|
| 101 | packet.target_component = target_component;
|
---|
| 102 | packet.parameter_rc_channel_index = parameter_rc_channel_index;
|
---|
| 103 | mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
|
---|
| 104 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
|
---|
| 105 | #endif
|
---|
| 106 |
|
---|
| 107 | msg->msgid = MAVLINK_MSG_ID_PARAM_MAP_RC;
|
---|
| 108 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | /**
|
---|
| 112 | * @brief Pack a param_map_rc message on a channel
|
---|
| 113 | * @param system_id ID of this system
|
---|
| 114 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 115 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 116 | * @param msg The MAVLink message to compress the data into
|
---|
| 117 | * @param target_system System ID
|
---|
| 118 | * @param target_component Component ID
|
---|
| 119 | * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
|
---|
| 120 | * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
|
---|
| 121 | * @param parameter_rc_channel_index Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
|
---|
| 122 | * @param param_value0 Initial parameter value
|
---|
| 123 | * @param scale Scale, maps the RC range [-1, 1] to a parameter value
|
---|
| 124 | * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
|
---|
| 125 | * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
|
---|
| 126 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 127 | */
|
---|
| 128 | static inline uint16_t mavlink_msg_param_map_rc_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
| 129 | mavlink_message_t* msg,
|
---|
| 130 | uint8_t target_system,uint8_t target_component,const char *param_id,int16_t param_index,uint8_t parameter_rc_channel_index,float param_value0,float scale,float param_value_min,float param_value_max)
|
---|
| 131 | {
|
---|
| 132 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 133 | char buf[MAVLINK_MSG_ID_PARAM_MAP_RC_LEN];
|
---|
| 134 | _mav_put_float(buf, 0, param_value0);
|
---|
| 135 | _mav_put_float(buf, 4, scale);
|
---|
| 136 | _mav_put_float(buf, 8, param_value_min);
|
---|
| 137 | _mav_put_float(buf, 12, param_value_max);
|
---|
| 138 | _mav_put_int16_t(buf, 16, param_index);
|
---|
| 139 | _mav_put_uint8_t(buf, 18, target_system);
|
---|
| 140 | _mav_put_uint8_t(buf, 19, target_component);
|
---|
| 141 | _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
|
---|
| 142 | _mav_put_char_array(buf, 20, param_id, 16);
|
---|
| 143 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
|
---|
| 144 | #else
|
---|
| 145 | mavlink_param_map_rc_t packet;
|
---|
| 146 | packet.param_value0 = param_value0;
|
---|
| 147 | packet.scale = scale;
|
---|
| 148 | packet.param_value_min = param_value_min;
|
---|
| 149 | packet.param_value_max = param_value_max;
|
---|
| 150 | packet.param_index = param_index;
|
---|
| 151 | packet.target_system = target_system;
|
---|
| 152 | packet.target_component = target_component;
|
---|
| 153 | packet.parameter_rc_channel_index = parameter_rc_channel_index;
|
---|
| 154 | mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
|
---|
| 155 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
|
---|
| 156 | #endif
|
---|
| 157 |
|
---|
| 158 | msg->msgid = MAVLINK_MSG_ID_PARAM_MAP_RC;
|
---|
| 159 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | /**
|
---|
| 163 | * @brief Encode a param_map_rc struct
|
---|
| 164 | *
|
---|
| 165 | * @param system_id ID of this system
|
---|
| 166 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 167 | * @param msg The MAVLink message to compress the data into
|
---|
| 168 | * @param param_map_rc C-struct to read the message contents from
|
---|
| 169 | */
|
---|
| 170 | static inline uint16_t mavlink_msg_param_map_rc_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_map_rc_t* param_map_rc)
|
---|
| 171 | {
|
---|
| 172 | return mavlink_msg_param_map_rc_pack(system_id, component_id, msg, param_map_rc->target_system, param_map_rc->target_component, param_map_rc->param_id, param_map_rc->param_index, param_map_rc->parameter_rc_channel_index, param_map_rc->param_value0, param_map_rc->scale, param_map_rc->param_value_min, param_map_rc->param_value_max);
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | /**
|
---|
| 176 | * @brief Encode a param_map_rc struct on a channel
|
---|
| 177 | *
|
---|
| 178 | * @param system_id ID of this system
|
---|
| 179 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 180 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 181 | * @param msg The MAVLink message to compress the data into
|
---|
| 182 | * @param param_map_rc C-struct to read the message contents from
|
---|
| 183 | */
|
---|
| 184 | static inline uint16_t mavlink_msg_param_map_rc_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_map_rc_t* param_map_rc)
|
---|
| 185 | {
|
---|
| 186 | return mavlink_msg_param_map_rc_pack_chan(system_id, component_id, chan, msg, param_map_rc->target_system, param_map_rc->target_component, param_map_rc->param_id, param_map_rc->param_index, param_map_rc->parameter_rc_channel_index, param_map_rc->param_value0, param_map_rc->scale, param_map_rc->param_value_min, param_map_rc->param_value_max);
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | /**
|
---|
| 190 | * @brief Send a param_map_rc message
|
---|
| 191 | * @param chan MAVLink channel to send the message
|
---|
| 192 | *
|
---|
| 193 | * @param target_system System ID
|
---|
| 194 | * @param target_component Component ID
|
---|
| 195 | * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
|
---|
| 196 | * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
|
---|
| 197 | * @param parameter_rc_channel_index Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
|
---|
| 198 | * @param param_value0 Initial parameter value
|
---|
| 199 | * @param scale Scale, maps the RC range [-1, 1] to a parameter value
|
---|
| 200 | * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
|
---|
| 201 | * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
|
---|
| 202 | */
|
---|
| 203 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
| 204 |
|
---|
| 205 | static inline void mavlink_msg_param_map_rc_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t parameter_rc_channel_index, float param_value0, float scale, float param_value_min, float param_value_max)
|
---|
| 206 | {
|
---|
| 207 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 208 | char buf[MAVLINK_MSG_ID_PARAM_MAP_RC_LEN];
|
---|
| 209 | _mav_put_float(buf, 0, param_value0);
|
---|
| 210 | _mav_put_float(buf, 4, scale);
|
---|
| 211 | _mav_put_float(buf, 8, param_value_min);
|
---|
| 212 | _mav_put_float(buf, 12, param_value_max);
|
---|
| 213 | _mav_put_int16_t(buf, 16, param_index);
|
---|
| 214 | _mav_put_uint8_t(buf, 18, target_system);
|
---|
| 215 | _mav_put_uint8_t(buf, 19, target_component);
|
---|
| 216 | _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
|
---|
| 217 | _mav_put_char_array(buf, 20, param_id, 16);
|
---|
| 218 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, buf, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
|
---|
| 219 | #else
|
---|
| 220 | mavlink_param_map_rc_t packet;
|
---|
| 221 | packet.param_value0 = param_value0;
|
---|
| 222 | packet.scale = scale;
|
---|
| 223 | packet.param_value_min = param_value_min;
|
---|
| 224 | packet.param_value_max = param_value_max;
|
---|
| 225 | packet.param_index = param_index;
|
---|
| 226 | packet.target_system = target_system;
|
---|
| 227 | packet.target_component = target_component;
|
---|
| 228 | packet.parameter_rc_channel_index = parameter_rc_channel_index;
|
---|
| 229 | mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
|
---|
| 230 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)&packet, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
|
---|
| 231 | #endif
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 | /**
|
---|
| 235 | * @brief Send a param_map_rc message
|
---|
| 236 | * @param chan MAVLink channel to send the message
|
---|
| 237 | * @param struct The MAVLink struct to serialize
|
---|
| 238 | */
|
---|
| 239 | static inline void mavlink_msg_param_map_rc_send_struct(mavlink_channel_t chan, const mavlink_param_map_rc_t* param_map_rc)
|
---|
| 240 | {
|
---|
| 241 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 242 | mavlink_msg_param_map_rc_send(chan, param_map_rc->target_system, param_map_rc->target_component, param_map_rc->param_id, param_map_rc->param_index, param_map_rc->parameter_rc_channel_index, param_map_rc->param_value0, param_map_rc->scale, param_map_rc->param_value_min, param_map_rc->param_value_max);
|
---|
| 243 | #else
|
---|
| 244 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)param_map_rc, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
|
---|
| 245 | #endif
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | #if MAVLINK_MSG_ID_PARAM_MAP_RC_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
| 249 | /*
|
---|
| 250 | This varient of _send() can be used to save stack space by re-using
|
---|
| 251 | memory from the receive buffer. The caller provides a
|
---|
| 252 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
| 253 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
| 254 | incoming message with minimum stack space usage.
|
---|
| 255 | */
|
---|
| 256 | static inline void mavlink_msg_param_map_rc_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t parameter_rc_channel_index, float param_value0, float scale, float param_value_min, float param_value_max)
|
---|
| 257 | {
|
---|
| 258 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 259 | char *buf = (char *)msgbuf;
|
---|
| 260 | _mav_put_float(buf, 0, param_value0);
|
---|
| 261 | _mav_put_float(buf, 4, scale);
|
---|
| 262 | _mav_put_float(buf, 8, param_value_min);
|
---|
| 263 | _mav_put_float(buf, 12, param_value_max);
|
---|
| 264 | _mav_put_int16_t(buf, 16, param_index);
|
---|
| 265 | _mav_put_uint8_t(buf, 18, target_system);
|
---|
| 266 | _mav_put_uint8_t(buf, 19, target_component);
|
---|
| 267 | _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
|
---|
| 268 | _mav_put_char_array(buf, 20, param_id, 16);
|
---|
| 269 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, buf, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
|
---|
| 270 | #else
|
---|
| 271 | mavlink_param_map_rc_t *packet = (mavlink_param_map_rc_t *)msgbuf;
|
---|
| 272 | packet->param_value0 = param_value0;
|
---|
| 273 | packet->scale = scale;
|
---|
| 274 | packet->param_value_min = param_value_min;
|
---|
| 275 | packet->param_value_max = param_value_max;
|
---|
| 276 | packet->param_index = param_index;
|
---|
| 277 | packet->target_system = target_system;
|
---|
| 278 | packet->target_component = target_component;
|
---|
| 279 | packet->parameter_rc_channel_index = parameter_rc_channel_index;
|
---|
| 280 | mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
|
---|
| 281 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)packet, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
|
---|
| 282 | #endif
|
---|
| 283 | }
|
---|
| 284 | #endif
|
---|
| 285 |
|
---|
| 286 | #endif
|
---|
| 287 |
|
---|
| 288 | // MESSAGE PARAM_MAP_RC UNPACKING
|
---|
| 289 |
|
---|
| 290 |
|
---|
| 291 | /**
|
---|
| 292 | * @brief Get field target_system from param_map_rc message
|
---|
| 293 | *
|
---|
| 294 | * @return System ID
|
---|
| 295 | */
|
---|
| 296 | static inline uint8_t mavlink_msg_param_map_rc_get_target_system(const mavlink_message_t* msg)
|
---|
| 297 | {
|
---|
| 298 | return _MAV_RETURN_uint8_t(msg, 18);
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | /**
|
---|
| 302 | * @brief Get field target_component from param_map_rc message
|
---|
| 303 | *
|
---|
| 304 | * @return Component ID
|
---|
| 305 | */
|
---|
| 306 | static inline uint8_t mavlink_msg_param_map_rc_get_target_component(const mavlink_message_t* msg)
|
---|
| 307 | {
|
---|
| 308 | return _MAV_RETURN_uint8_t(msg, 19);
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | /**
|
---|
| 312 | * @brief Get field param_id from param_map_rc message
|
---|
| 313 | *
|
---|
| 314 | * @return Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
|
---|
| 315 | */
|
---|
| 316 | static inline uint16_t mavlink_msg_param_map_rc_get_param_id(const mavlink_message_t* msg, char *param_id)
|
---|
| 317 | {
|
---|
| 318 | return _MAV_RETURN_char_array(msg, param_id, 16, 20);
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | /**
|
---|
| 322 | * @brief Get field param_index from param_map_rc message
|
---|
| 323 | *
|
---|
| 324 | * @return Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
|
---|
| 325 | */
|
---|
| 326 | static inline int16_t mavlink_msg_param_map_rc_get_param_index(const mavlink_message_t* msg)
|
---|
| 327 | {
|
---|
| 328 | return _MAV_RETURN_int16_t(msg, 16);
|
---|
| 329 | }
|
---|
| 330 |
|
---|
| 331 | /**
|
---|
| 332 | * @brief Get field parameter_rc_channel_index from param_map_rc message
|
---|
| 333 | *
|
---|
| 334 | * @return Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
|
---|
| 335 | */
|
---|
| 336 | static inline uint8_t mavlink_msg_param_map_rc_get_parameter_rc_channel_index(const mavlink_message_t* msg)
|
---|
| 337 | {
|
---|
| 338 | return _MAV_RETURN_uint8_t(msg, 36);
|
---|
| 339 | }
|
---|
| 340 |
|
---|
| 341 | /**
|
---|
| 342 | * @brief Get field param_value0 from param_map_rc message
|
---|
| 343 | *
|
---|
| 344 | * @return Initial parameter value
|
---|
| 345 | */
|
---|
| 346 | static inline float mavlink_msg_param_map_rc_get_param_value0(const mavlink_message_t* msg)
|
---|
| 347 | {
|
---|
| 348 | return _MAV_RETURN_float(msg, 0);
|
---|
| 349 | }
|
---|
| 350 |
|
---|
| 351 | /**
|
---|
| 352 | * @brief Get field scale from param_map_rc message
|
---|
| 353 | *
|
---|
| 354 | * @return Scale, maps the RC range [-1, 1] to a parameter value
|
---|
| 355 | */
|
---|
| 356 | static inline float mavlink_msg_param_map_rc_get_scale(const mavlink_message_t* msg)
|
---|
| 357 | {
|
---|
| 358 | return _MAV_RETURN_float(msg, 4);
|
---|
| 359 | }
|
---|
| 360 |
|
---|
| 361 | /**
|
---|
| 362 | * @brief Get field param_value_min from param_map_rc message
|
---|
| 363 | *
|
---|
| 364 | * @return Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
|
---|
| 365 | */
|
---|
| 366 | static inline float mavlink_msg_param_map_rc_get_param_value_min(const mavlink_message_t* msg)
|
---|
| 367 | {
|
---|
| 368 | return _MAV_RETURN_float(msg, 8);
|
---|
| 369 | }
|
---|
| 370 |
|
---|
| 371 | /**
|
---|
| 372 | * @brief Get field param_value_max from param_map_rc message
|
---|
| 373 | *
|
---|
| 374 | * @return Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
|
---|
| 375 | */
|
---|
| 376 | static inline float mavlink_msg_param_map_rc_get_param_value_max(const mavlink_message_t* msg)
|
---|
| 377 | {
|
---|
| 378 | return _MAV_RETURN_float(msg, 12);
|
---|
| 379 | }
|
---|
| 380 |
|
---|
| 381 | /**
|
---|
| 382 | * @brief Decode a param_map_rc message into a struct
|
---|
| 383 | *
|
---|
| 384 | * @param msg The message to decode
|
---|
| 385 | * @param param_map_rc C-struct to decode the message contents into
|
---|
| 386 | */
|
---|
| 387 | static inline void mavlink_msg_param_map_rc_decode(const mavlink_message_t* msg, mavlink_param_map_rc_t* param_map_rc)
|
---|
| 388 | {
|
---|
| 389 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 390 | param_map_rc->param_value0 = mavlink_msg_param_map_rc_get_param_value0(msg);
|
---|
| 391 | param_map_rc->scale = mavlink_msg_param_map_rc_get_scale(msg);
|
---|
| 392 | param_map_rc->param_value_min = mavlink_msg_param_map_rc_get_param_value_min(msg);
|
---|
| 393 | param_map_rc->param_value_max = mavlink_msg_param_map_rc_get_param_value_max(msg);
|
---|
| 394 | param_map_rc->param_index = mavlink_msg_param_map_rc_get_param_index(msg);
|
---|
| 395 | param_map_rc->target_system = mavlink_msg_param_map_rc_get_target_system(msg);
|
---|
| 396 | param_map_rc->target_component = mavlink_msg_param_map_rc_get_target_component(msg);
|
---|
| 397 | mavlink_msg_param_map_rc_get_param_id(msg, param_map_rc->param_id);
|
---|
| 398 | param_map_rc->parameter_rc_channel_index = mavlink_msg_param_map_rc_get_parameter_rc_channel_index(msg);
|
---|
| 399 | #else
|
---|
| 400 | uint8_t len = msg->len < MAVLINK_MSG_ID_PARAM_MAP_RC_LEN? msg->len : MAVLINK_MSG_ID_PARAM_MAP_RC_LEN;
|
---|
| 401 | memset(param_map_rc, 0, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
|
---|
| 402 | memcpy(param_map_rc, _MAV_PAYLOAD(msg), len);
|
---|
| 403 | #endif
|
---|
| 404 | }
|
---|