mavlink_msg_param_map_rc.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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 on a channel
  104. * @param system_id ID of this system
  105. * @param component_id ID of this component (e.g. 200 for IMU)
  106. * @param chan The MAVLink channel this message will be sent over
  107. * @param msg The MAVLink message to compress the data into
  108. * @param target_system System ID
  109. * @param target_component Component ID
  110. * @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
  111. * @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.
  112. * @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.
  113. * @param param_value0 Initial parameter value
  114. * @param scale Scale, maps the RC range [-1, 1] to a parameter value
  115. * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
  116. * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
  117. * @return length of the message in bytes (excluding serial stream start sign)
  118. */
  119. static inline uint16_t mavlink_msg_param_map_rc_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  120. 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. 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);
  150. }
  151. /**
  152. * @brief Encode a param_map_rc struct
  153. *
  154. * @param system_id ID of this system
  155. * @param component_id ID of this component (e.g. 200 for IMU)
  156. * @param msg The MAVLink message to compress the data into
  157. * @param param_map_rc C-struct to read the message contents from
  158. */
  159. 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)
  160. {
  161. 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);
  162. }
  163. /**
  164. * @brief Encode a param_map_rc struct on a channel
  165. *
  166. * @param system_id ID of this system
  167. * @param component_id ID of this component (e.g. 200 for IMU)
  168. * @param chan The MAVLink channel this message will be sent over
  169. * @param msg The MAVLink message to compress the data into
  170. * @param param_map_rc C-struct to read the message contents from
  171. */
  172. 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)
  173. {
  174. 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);
  175. }
  176. /**
  177. * @brief Send a param_map_rc message
  178. * @param chan MAVLink channel to send the message
  179. *
  180. * @param target_system System ID
  181. * @param target_component Component ID
  182. * @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
  183. * @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.
  184. * @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.
  185. * @param param_value0 Initial parameter value
  186. * @param scale Scale, maps the RC range [-1, 1] to a parameter value
  187. * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
  188. * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
  189. */
  190. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  191. 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)
  192. {
  193. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  194. char buf[MAVLINK_MSG_ID_PARAM_MAP_RC_LEN];
  195. _mav_put_float(buf, 0, param_value0);
  196. _mav_put_float(buf, 4, scale);
  197. _mav_put_float(buf, 8, param_value_min);
  198. _mav_put_float(buf, 12, param_value_max);
  199. _mav_put_int16_t(buf, 16, param_index);
  200. _mav_put_uint8_t(buf, 18, target_system);
  201. _mav_put_uint8_t(buf, 19, target_component);
  202. _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
  203. _mav_put_char_array(buf, 20, param_id, 16);
  204. _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);
  205. #else
  206. mavlink_param_map_rc_t packet;
  207. packet.param_value0 = param_value0;
  208. packet.scale = scale;
  209. packet.param_value_min = param_value_min;
  210. packet.param_value_max = param_value_max;
  211. packet.param_index = param_index;
  212. packet.target_system = target_system;
  213. packet.target_component = target_component;
  214. packet.parameter_rc_channel_index = parameter_rc_channel_index;
  215. mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
  216. _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);
  217. #endif
  218. }
  219. /**
  220. * @brief Send a param_map_rc message
  221. * @param chan MAVLink channel to send the message
  222. * @param struct The MAVLink struct to serialize
  223. */
  224. static inline void mavlink_msg_param_map_rc_send_struct(mavlink_channel_t chan, const mavlink_param_map_rc_t* param_map_rc)
  225. {
  226. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  227. 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);
  228. #else
  229. _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);
  230. #endif
  231. }
  232. #if MAVLINK_MSG_ID_PARAM_MAP_RC_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  233. /*
  234. This variant of _send() can be used to save stack space by re-using
  235. memory from the receive buffer. The caller provides a
  236. mavlink_message_t which is the size of a full mavlink message. This
  237. is usually the receive buffer for the channel, and allows a reply to an
  238. incoming message with minimum stack space usage.
  239. */
  240. 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)
  241. {
  242. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  243. char *buf = (char *)msgbuf;
  244. _mav_put_float(buf, 0, param_value0);
  245. _mav_put_float(buf, 4, scale);
  246. _mav_put_float(buf, 8, param_value_min);
  247. _mav_put_float(buf, 12, param_value_max);
  248. _mav_put_int16_t(buf, 16, param_index);
  249. _mav_put_uint8_t(buf, 18, target_system);
  250. _mav_put_uint8_t(buf, 19, target_component);
  251. _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
  252. _mav_put_char_array(buf, 20, param_id, 16);
  253. _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);
  254. #else
  255. mavlink_param_map_rc_t *packet = (mavlink_param_map_rc_t *)msgbuf;
  256. packet->param_value0 = param_value0;
  257. packet->scale = scale;
  258. packet->param_value_min = param_value_min;
  259. packet->param_value_max = param_value_max;
  260. packet->param_index = param_index;
  261. packet->target_system = target_system;
  262. packet->target_component = target_component;
  263. packet->parameter_rc_channel_index = parameter_rc_channel_index;
  264. mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
  265. _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);
  266. #endif
  267. }
  268. #endif
  269. #endif
  270. // MESSAGE PARAM_MAP_RC UNPACKING
  271. /**
  272. * @brief Get field target_system from param_map_rc message
  273. *
  274. * @return System ID
  275. */
  276. static inline uint8_t mavlink_msg_param_map_rc_get_target_system(const mavlink_message_t* msg)
  277. {
  278. return _MAV_RETURN_uint8_t(msg, 18);
  279. }
  280. /**
  281. * @brief Get field target_component from param_map_rc message
  282. *
  283. * @return Component ID
  284. */
  285. static inline uint8_t mavlink_msg_param_map_rc_get_target_component(const mavlink_message_t* msg)
  286. {
  287. return _MAV_RETURN_uint8_t(msg, 19);
  288. }
  289. /**
  290. * @brief Get field param_id from param_map_rc message
  291. *
  292. * @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
  293. */
  294. static inline uint16_t mavlink_msg_param_map_rc_get_param_id(const mavlink_message_t* msg, char *param_id)
  295. {
  296. return _MAV_RETURN_char_array(msg, param_id, 16, 20);
  297. }
  298. /**
  299. * @brief Get field param_index from param_map_rc message
  300. *
  301. * @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.
  302. */
  303. static inline int16_t mavlink_msg_param_map_rc_get_param_index(const mavlink_message_t* msg)
  304. {
  305. return _MAV_RETURN_int16_t(msg, 16);
  306. }
  307. /**
  308. * @brief Get field parameter_rc_channel_index from param_map_rc message
  309. *
  310. * @return Index of parameter RC channel. Not equal to the RC channel id. Typically corresponds to a potentiometer-knob on the RC.
  311. */
  312. static inline uint8_t mavlink_msg_param_map_rc_get_parameter_rc_channel_index(const mavlink_message_t* msg)
  313. {
  314. return _MAV_RETURN_uint8_t(msg, 36);
  315. }
  316. /**
  317. * @brief Get field param_value0 from param_map_rc message
  318. *
  319. * @return Initial parameter value
  320. */
  321. static inline float mavlink_msg_param_map_rc_get_param_value0(const mavlink_message_t* msg)
  322. {
  323. return _MAV_RETURN_float(msg, 0);
  324. }
  325. /**
  326. * @brief Get field scale from param_map_rc message
  327. *
  328. * @return Scale, maps the RC range [-1, 1] to a parameter value
  329. */
  330. static inline float mavlink_msg_param_map_rc_get_scale(const mavlink_message_t* msg)
  331. {
  332. return _MAV_RETURN_float(msg, 4);
  333. }
  334. /**
  335. * @brief Get field param_value_min from param_map_rc message
  336. *
  337. * @return Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
  338. */
  339. static inline float mavlink_msg_param_map_rc_get_param_value_min(const mavlink_message_t* msg)
  340. {
  341. return _MAV_RETURN_float(msg, 8);
  342. }
  343. /**
  344. * @brief Get field param_value_max from param_map_rc message
  345. *
  346. * @return Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
  347. */
  348. static inline float mavlink_msg_param_map_rc_get_param_value_max(const mavlink_message_t* msg)
  349. {
  350. return _MAV_RETURN_float(msg, 12);
  351. }
  352. /**
  353. * @brief Decode a param_map_rc message into a struct
  354. *
  355. * @param msg The message to decode
  356. * @param param_map_rc C-struct to decode the message contents into
  357. */
  358. static inline void mavlink_msg_param_map_rc_decode(const mavlink_message_t* msg, mavlink_param_map_rc_t* param_map_rc)
  359. {
  360. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  361. param_map_rc->param_value0 = mavlink_msg_param_map_rc_get_param_value0(msg);
  362. param_map_rc->scale = mavlink_msg_param_map_rc_get_scale(msg);
  363. param_map_rc->param_value_min = mavlink_msg_param_map_rc_get_param_value_min(msg);
  364. param_map_rc->param_value_max = mavlink_msg_param_map_rc_get_param_value_max(msg);
  365. param_map_rc->param_index = mavlink_msg_param_map_rc_get_param_index(msg);
  366. param_map_rc->target_system = mavlink_msg_param_map_rc_get_target_system(msg);
  367. param_map_rc->target_component = mavlink_msg_param_map_rc_get_target_component(msg);
  368. mavlink_msg_param_map_rc_get_param_id(msg, param_map_rc->param_id);
  369. param_map_rc->parameter_rc_channel_index = mavlink_msg_param_map_rc_get_parameter_rc_channel_index(msg);
  370. #else
  371. uint8_t len = msg->len < MAVLINK_MSG_ID_PARAM_MAP_RC_LEN? msg->len : MAVLINK_MSG_ID_PARAM_MAP_RC_LEN;
  372. memset(param_map_rc, 0, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
  373. memcpy(param_map_rc, _MAV_PAYLOAD(msg), len);
  374. #endif
  375. }