mavlink_msg_param_map_rc.h 26 KB

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