mavlink_msg_qingxie_bms.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. #pragma once
  2. // MESSAGE QINGXIE_BMS PACKING
  3. #define MAVLINK_MSG_ID_QINGXIE_BMS 53300
  4. typedef struct __mavlink_qingxie_bms_t {
  5. uint16_t bat_voltage; /*< [cV] Battery voltage.*/
  6. uint16_t servo_current; /*< [cA] Servo current.*/
  7. uint16_t stack_voltage; /*< [cV] Stack voltage.*/
  8. uint16_t servo_voltage; /*< [cV] Servo voltage.*/
  9. uint16_t bat_refuel_current; /*< [cA] Battery refuel current.*/
  10. uint16_t gas_tank_pressure; /*< Gas tank pressure.*/
  11. uint16_t pipe_pressure; /*< Pipe pressure.*/
  12. uint16_t pcb_temp; /*< PCB temperature.*/
  13. uint16_t stack_temp; /*< Stack temperature.*/
  14. uint16_t work_status; /*< */
  15. uint16_t falt_status; /*< */
  16. uint8_t self_check; /*< */
  17. uint8_t Id; /*< */
  18. } mavlink_qingxie_bms_t;
  19. #define MAVLINK_MSG_ID_QINGXIE_BMS_LEN 24
  20. #define MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN 24
  21. #define MAVLINK_MSG_ID_53300_LEN 24
  22. #define MAVLINK_MSG_ID_53300_MIN_LEN 24
  23. #define MAVLINK_MSG_ID_QINGXIE_BMS_CRC 114
  24. #define MAVLINK_MSG_ID_53300_CRC 114
  25. #if MAVLINK_COMMAND_24BIT
  26. #define MAVLINK_MESSAGE_INFO_QINGXIE_BMS { \
  27. 53300, \
  28. "QINGXIE_BMS", \
  29. 13, \
  30. { { "bat_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_qingxie_bms_t, bat_voltage) }, \
  31. { "servo_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_qingxie_bms_t, servo_current) }, \
  32. { "stack_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_qingxie_bms_t, stack_voltage) }, \
  33. { "servo_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_qingxie_bms_t, servo_voltage) }, \
  34. { "bat_refuel_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_qingxie_bms_t, bat_refuel_current) }, \
  35. { "gas_tank_pressure", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_qingxie_bms_t, gas_tank_pressure) }, \
  36. { "pipe_pressure", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_qingxie_bms_t, pipe_pressure) }, \
  37. { "pcb_temp", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_qingxie_bms_t, pcb_temp) }, \
  38. { "stack_temp", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_qingxie_bms_t, stack_temp) }, \
  39. { "work_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_qingxie_bms_t, work_status) }, \
  40. { "falt_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_qingxie_bms_t, falt_status) }, \
  41. { "self_check", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_qingxie_bms_t, self_check) }, \
  42. { "Id", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_qingxie_bms_t, Id) }, \
  43. } \
  44. }
  45. #else
  46. #define MAVLINK_MESSAGE_INFO_QINGXIE_BMS { \
  47. "QINGXIE_BMS", \
  48. 13, \
  49. { { "bat_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_qingxie_bms_t, bat_voltage) }, \
  50. { "servo_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_qingxie_bms_t, servo_current) }, \
  51. { "stack_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_qingxie_bms_t, stack_voltage) }, \
  52. { "servo_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_qingxie_bms_t, servo_voltage) }, \
  53. { "bat_refuel_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_qingxie_bms_t, bat_refuel_current) }, \
  54. { "gas_tank_pressure", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_qingxie_bms_t, gas_tank_pressure) }, \
  55. { "pipe_pressure", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_qingxie_bms_t, pipe_pressure) }, \
  56. { "pcb_temp", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_qingxie_bms_t, pcb_temp) }, \
  57. { "stack_temp", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_qingxie_bms_t, stack_temp) }, \
  58. { "work_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_qingxie_bms_t, work_status) }, \
  59. { "falt_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_qingxie_bms_t, falt_status) }, \
  60. { "self_check", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_qingxie_bms_t, self_check) }, \
  61. { "Id", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_qingxie_bms_t, Id) }, \
  62. } \
  63. }
  64. #endif
  65. /**
  66. * @brief Pack a qingxie_bms message
  67. * @param system_id ID of this system
  68. * @param component_id ID of this component (e.g. 200 for IMU)
  69. * @param msg The MAVLink message to compress the data into
  70. *
  71. * @param bat_voltage [cV] Battery voltage.
  72. * @param servo_current [cA] Servo current.
  73. * @param stack_voltage [cV] Stack voltage.
  74. * @param servo_voltage [cV] Servo voltage.
  75. * @param bat_refuel_current [cA] Battery refuel current.
  76. * @param gas_tank_pressure Gas tank pressure.
  77. * @param pipe_pressure Pipe pressure.
  78. * @param pcb_temp PCB temperature.
  79. * @param stack_temp Stack temperature.
  80. * @param work_status
  81. * @param falt_status
  82. * @param self_check
  83. * @param Id
  84. * @return length of the message in bytes (excluding serial stream start sign)
  85. */
  86. static inline uint16_t mavlink_msg_qingxie_bms_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  87. uint16_t bat_voltage, uint16_t servo_current, uint16_t stack_voltage, uint16_t servo_voltage, uint16_t bat_refuel_current, uint16_t gas_tank_pressure, uint16_t pipe_pressure, uint16_t pcb_temp, uint16_t stack_temp, uint16_t work_status, uint16_t falt_status, uint8_t self_check, uint8_t Id)
  88. {
  89. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  90. char buf[MAVLINK_MSG_ID_QINGXIE_BMS_LEN];
  91. _mav_put_uint16_t(buf, 0, bat_voltage);
  92. _mav_put_uint16_t(buf, 2, servo_current);
  93. _mav_put_uint16_t(buf, 4, stack_voltage);
  94. _mav_put_uint16_t(buf, 6, servo_voltage);
  95. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  96. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  97. _mav_put_uint16_t(buf, 12, pipe_pressure);
  98. _mav_put_uint16_t(buf, 14, pcb_temp);
  99. _mav_put_uint16_t(buf, 16, stack_temp);
  100. _mav_put_uint16_t(buf, 18, work_status);
  101. _mav_put_uint16_t(buf, 20, falt_status);
  102. _mav_put_uint8_t(buf, 22, self_check);
  103. _mav_put_uint8_t(buf, 23, Id);
  104. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  105. #else
  106. mavlink_qingxie_bms_t packet;
  107. packet.bat_voltage = bat_voltage;
  108. packet.servo_current = servo_current;
  109. packet.stack_voltage = stack_voltage;
  110. packet.servo_voltage = servo_voltage;
  111. packet.bat_refuel_current = bat_refuel_current;
  112. packet.gas_tank_pressure = gas_tank_pressure;
  113. packet.pipe_pressure = pipe_pressure;
  114. packet.pcb_temp = pcb_temp;
  115. packet.stack_temp = stack_temp;
  116. packet.work_status = work_status;
  117. packet.falt_status = falt_status;
  118. packet.self_check = self_check;
  119. packet.Id = Id;
  120. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  121. #endif
  122. msg->msgid = MAVLINK_MSG_ID_QINGXIE_BMS;
  123. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_CRC);
  124. }
  125. /**
  126. * @brief Pack a qingxie_bms message
  127. * @param system_id ID of this system
  128. * @param component_id ID of this component (e.g. 200 for IMU)
  129. * @param status MAVLink status structure
  130. * @param msg The MAVLink message to compress the data into
  131. *
  132. * @param bat_voltage [cV] Battery voltage.
  133. * @param servo_current [cA] Servo current.
  134. * @param stack_voltage [cV] Stack voltage.
  135. * @param servo_voltage [cV] Servo voltage.
  136. * @param bat_refuel_current [cA] Battery refuel current.
  137. * @param gas_tank_pressure Gas tank pressure.
  138. * @param pipe_pressure Pipe pressure.
  139. * @param pcb_temp PCB temperature.
  140. * @param stack_temp Stack temperature.
  141. * @param work_status
  142. * @param falt_status
  143. * @param self_check
  144. * @param Id
  145. * @return length of the message in bytes (excluding serial stream start sign)
  146. */
  147. static inline uint16_t mavlink_msg_qingxie_bms_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  148. uint16_t bat_voltage, uint16_t servo_current, uint16_t stack_voltage, uint16_t servo_voltage, uint16_t bat_refuel_current, uint16_t gas_tank_pressure, uint16_t pipe_pressure, uint16_t pcb_temp, uint16_t stack_temp, uint16_t work_status, uint16_t falt_status, uint8_t self_check, uint8_t Id)
  149. {
  150. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  151. char buf[MAVLINK_MSG_ID_QINGXIE_BMS_LEN];
  152. _mav_put_uint16_t(buf, 0, bat_voltage);
  153. _mav_put_uint16_t(buf, 2, servo_current);
  154. _mav_put_uint16_t(buf, 4, stack_voltage);
  155. _mav_put_uint16_t(buf, 6, servo_voltage);
  156. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  157. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  158. _mav_put_uint16_t(buf, 12, pipe_pressure);
  159. _mav_put_uint16_t(buf, 14, pcb_temp);
  160. _mav_put_uint16_t(buf, 16, stack_temp);
  161. _mav_put_uint16_t(buf, 18, work_status);
  162. _mav_put_uint16_t(buf, 20, falt_status);
  163. _mav_put_uint8_t(buf, 22, self_check);
  164. _mav_put_uint8_t(buf, 23, Id);
  165. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  166. #else
  167. mavlink_qingxie_bms_t packet;
  168. packet.bat_voltage = bat_voltage;
  169. packet.servo_current = servo_current;
  170. packet.stack_voltage = stack_voltage;
  171. packet.servo_voltage = servo_voltage;
  172. packet.bat_refuel_current = bat_refuel_current;
  173. packet.gas_tank_pressure = gas_tank_pressure;
  174. packet.pipe_pressure = pipe_pressure;
  175. packet.pcb_temp = pcb_temp;
  176. packet.stack_temp = stack_temp;
  177. packet.work_status = work_status;
  178. packet.falt_status = falt_status;
  179. packet.self_check = self_check;
  180. packet.Id = Id;
  181. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  182. #endif
  183. msg->msgid = MAVLINK_MSG_ID_QINGXIE_BMS;
  184. #if MAVLINK_CRC_EXTRA
  185. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_CRC);
  186. #else
  187. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  188. #endif
  189. }
  190. /**
  191. * @brief Pack a qingxie_bms message on a channel
  192. * @param system_id ID of this system
  193. * @param component_id ID of this component (e.g. 200 for IMU)
  194. * @param chan The MAVLink channel this message will be sent over
  195. * @param msg The MAVLink message to compress the data into
  196. * @param bat_voltage [cV] Battery voltage.
  197. * @param servo_current [cA] Servo current.
  198. * @param stack_voltage [cV] Stack voltage.
  199. * @param servo_voltage [cV] Servo voltage.
  200. * @param bat_refuel_current [cA] Battery refuel current.
  201. * @param gas_tank_pressure Gas tank pressure.
  202. * @param pipe_pressure Pipe pressure.
  203. * @param pcb_temp PCB temperature.
  204. * @param stack_temp Stack temperature.
  205. * @param work_status
  206. * @param falt_status
  207. * @param self_check
  208. * @param Id
  209. * @return length of the message in bytes (excluding serial stream start sign)
  210. */
  211. static inline uint16_t mavlink_msg_qingxie_bms_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  212. mavlink_message_t* msg,
  213. uint16_t bat_voltage,uint16_t servo_current,uint16_t stack_voltage,uint16_t servo_voltage,uint16_t bat_refuel_current,uint16_t gas_tank_pressure,uint16_t pipe_pressure,uint16_t pcb_temp,uint16_t stack_temp,uint16_t work_status,uint16_t falt_status,uint8_t self_check,uint8_t Id)
  214. {
  215. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  216. char buf[MAVLINK_MSG_ID_QINGXIE_BMS_LEN];
  217. _mav_put_uint16_t(buf, 0, bat_voltage);
  218. _mav_put_uint16_t(buf, 2, servo_current);
  219. _mav_put_uint16_t(buf, 4, stack_voltage);
  220. _mav_put_uint16_t(buf, 6, servo_voltage);
  221. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  222. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  223. _mav_put_uint16_t(buf, 12, pipe_pressure);
  224. _mav_put_uint16_t(buf, 14, pcb_temp);
  225. _mav_put_uint16_t(buf, 16, stack_temp);
  226. _mav_put_uint16_t(buf, 18, work_status);
  227. _mav_put_uint16_t(buf, 20, falt_status);
  228. _mav_put_uint8_t(buf, 22, self_check);
  229. _mav_put_uint8_t(buf, 23, Id);
  230. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  231. #else
  232. mavlink_qingxie_bms_t packet;
  233. packet.bat_voltage = bat_voltage;
  234. packet.servo_current = servo_current;
  235. packet.stack_voltage = stack_voltage;
  236. packet.servo_voltage = servo_voltage;
  237. packet.bat_refuel_current = bat_refuel_current;
  238. packet.gas_tank_pressure = gas_tank_pressure;
  239. packet.pipe_pressure = pipe_pressure;
  240. packet.pcb_temp = pcb_temp;
  241. packet.stack_temp = stack_temp;
  242. packet.work_status = work_status;
  243. packet.falt_status = falt_status;
  244. packet.self_check = self_check;
  245. packet.Id = Id;
  246. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  247. #endif
  248. msg->msgid = MAVLINK_MSG_ID_QINGXIE_BMS;
  249. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_CRC);
  250. }
  251. /**
  252. * @brief Encode a qingxie_bms struct
  253. *
  254. * @param system_id ID of this system
  255. * @param component_id ID of this component (e.g. 200 for IMU)
  256. * @param msg The MAVLink message to compress the data into
  257. * @param qingxie_bms C-struct to read the message contents from
  258. */
  259. static inline uint16_t mavlink_msg_qingxie_bms_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_qingxie_bms_t* qingxie_bms)
  260. {
  261. return mavlink_msg_qingxie_bms_pack(system_id, component_id, msg, qingxie_bms->bat_voltage, qingxie_bms->servo_current, qingxie_bms->stack_voltage, qingxie_bms->servo_voltage, qingxie_bms->bat_refuel_current, qingxie_bms->gas_tank_pressure, qingxie_bms->pipe_pressure, qingxie_bms->pcb_temp, qingxie_bms->stack_temp, qingxie_bms->work_status, qingxie_bms->falt_status, qingxie_bms->self_check, qingxie_bms->Id);
  262. }
  263. /**
  264. * @brief Encode a qingxie_bms struct on a channel
  265. *
  266. * @param system_id ID of this system
  267. * @param component_id ID of this component (e.g. 200 for IMU)
  268. * @param chan The MAVLink channel this message will be sent over
  269. * @param msg The MAVLink message to compress the data into
  270. * @param qingxie_bms C-struct to read the message contents from
  271. */
  272. static inline uint16_t mavlink_msg_qingxie_bms_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_qingxie_bms_t* qingxie_bms)
  273. {
  274. return mavlink_msg_qingxie_bms_pack_chan(system_id, component_id, chan, msg, qingxie_bms->bat_voltage, qingxie_bms->servo_current, qingxie_bms->stack_voltage, qingxie_bms->servo_voltage, qingxie_bms->bat_refuel_current, qingxie_bms->gas_tank_pressure, qingxie_bms->pipe_pressure, qingxie_bms->pcb_temp, qingxie_bms->stack_temp, qingxie_bms->work_status, qingxie_bms->falt_status, qingxie_bms->self_check, qingxie_bms->Id);
  275. }
  276. /**
  277. * @brief Encode a qingxie_bms struct with provided status structure
  278. *
  279. * @param system_id ID of this system
  280. * @param component_id ID of this component (e.g. 200 for IMU)
  281. * @param status MAVLink status structure
  282. * @param msg The MAVLink message to compress the data into
  283. * @param qingxie_bms C-struct to read the message contents from
  284. */
  285. static inline uint16_t mavlink_msg_qingxie_bms_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_qingxie_bms_t* qingxie_bms)
  286. {
  287. return mavlink_msg_qingxie_bms_pack_status(system_id, component_id, _status, msg, qingxie_bms->bat_voltage, qingxie_bms->servo_current, qingxie_bms->stack_voltage, qingxie_bms->servo_voltage, qingxie_bms->bat_refuel_current, qingxie_bms->gas_tank_pressure, qingxie_bms->pipe_pressure, qingxie_bms->pcb_temp, qingxie_bms->stack_temp, qingxie_bms->work_status, qingxie_bms->falt_status, qingxie_bms->self_check, qingxie_bms->Id);
  288. }
  289. /**
  290. * @brief Send a qingxie_bms message
  291. * @param chan MAVLink channel to send the message
  292. *
  293. * @param bat_voltage [cV] Battery voltage.
  294. * @param servo_current [cA] Servo current.
  295. * @param stack_voltage [cV] Stack voltage.
  296. * @param servo_voltage [cV] Servo voltage.
  297. * @param bat_refuel_current [cA] Battery refuel current.
  298. * @param gas_tank_pressure Gas tank pressure.
  299. * @param pipe_pressure Pipe pressure.
  300. * @param pcb_temp PCB temperature.
  301. * @param stack_temp Stack temperature.
  302. * @param work_status
  303. * @param falt_status
  304. * @param self_check
  305. * @param Id
  306. */
  307. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  308. static inline void mavlink_msg_qingxie_bms_send(mavlink_channel_t chan, uint16_t bat_voltage, uint16_t servo_current, uint16_t stack_voltage, uint16_t servo_voltage, uint16_t bat_refuel_current, uint16_t gas_tank_pressure, uint16_t pipe_pressure, uint16_t pcb_temp, uint16_t stack_temp, uint16_t work_status, uint16_t falt_status, uint8_t self_check, uint8_t Id)
  309. {
  310. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  311. char buf[MAVLINK_MSG_ID_QINGXIE_BMS_LEN];
  312. _mav_put_uint16_t(buf, 0, bat_voltage);
  313. _mav_put_uint16_t(buf, 2, servo_current);
  314. _mav_put_uint16_t(buf, 4, stack_voltage);
  315. _mav_put_uint16_t(buf, 6, servo_voltage);
  316. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  317. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  318. _mav_put_uint16_t(buf, 12, pipe_pressure);
  319. _mav_put_uint16_t(buf, 14, pcb_temp);
  320. _mav_put_uint16_t(buf, 16, stack_temp);
  321. _mav_put_uint16_t(buf, 18, work_status);
  322. _mav_put_uint16_t(buf, 20, falt_status);
  323. _mav_put_uint8_t(buf, 22, self_check);
  324. _mav_put_uint8_t(buf, 23, Id);
  325. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_QINGXIE_BMS, buf, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_CRC);
  326. #else
  327. mavlink_qingxie_bms_t packet;
  328. packet.bat_voltage = bat_voltage;
  329. packet.servo_current = servo_current;
  330. packet.stack_voltage = stack_voltage;
  331. packet.servo_voltage = servo_voltage;
  332. packet.bat_refuel_current = bat_refuel_current;
  333. packet.gas_tank_pressure = gas_tank_pressure;
  334. packet.pipe_pressure = pipe_pressure;
  335. packet.pcb_temp = pcb_temp;
  336. packet.stack_temp = stack_temp;
  337. packet.work_status = work_status;
  338. packet.falt_status = falt_status;
  339. packet.self_check = self_check;
  340. packet.Id = Id;
  341. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_QINGXIE_BMS, (const char *)&packet, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_CRC);
  342. #endif
  343. }
  344. /**
  345. * @brief Send a qingxie_bms message
  346. * @param chan MAVLink channel to send the message
  347. * @param struct The MAVLink struct to serialize
  348. */
  349. static inline void mavlink_msg_qingxie_bms_send_struct(mavlink_channel_t chan, const mavlink_qingxie_bms_t* qingxie_bms)
  350. {
  351. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  352. mavlink_msg_qingxie_bms_send(chan, qingxie_bms->bat_voltage, qingxie_bms->servo_current, qingxie_bms->stack_voltage, qingxie_bms->servo_voltage, qingxie_bms->bat_refuel_current, qingxie_bms->gas_tank_pressure, qingxie_bms->pipe_pressure, qingxie_bms->pcb_temp, qingxie_bms->stack_temp, qingxie_bms->work_status, qingxie_bms->falt_status, qingxie_bms->self_check, qingxie_bms->Id);
  353. #else
  354. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_QINGXIE_BMS, (const char *)qingxie_bms, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_CRC);
  355. #endif
  356. }
  357. #if MAVLINK_MSG_ID_QINGXIE_BMS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  358. /*
  359. This variant of _send() can be used to save stack space by re-using
  360. memory from the receive buffer. The caller provides a
  361. mavlink_message_t which is the size of a full mavlink message. This
  362. is usually the receive buffer for the channel, and allows a reply to an
  363. incoming message with minimum stack space usage.
  364. */
  365. static inline void mavlink_msg_qingxie_bms_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t bat_voltage, uint16_t servo_current, uint16_t stack_voltage, uint16_t servo_voltage, uint16_t bat_refuel_current, uint16_t gas_tank_pressure, uint16_t pipe_pressure, uint16_t pcb_temp, uint16_t stack_temp, uint16_t work_status, uint16_t falt_status, uint8_t self_check, uint8_t Id)
  366. {
  367. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  368. char *buf = (char *)msgbuf;
  369. _mav_put_uint16_t(buf, 0, bat_voltage);
  370. _mav_put_uint16_t(buf, 2, servo_current);
  371. _mav_put_uint16_t(buf, 4, stack_voltage);
  372. _mav_put_uint16_t(buf, 6, servo_voltage);
  373. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  374. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  375. _mav_put_uint16_t(buf, 12, pipe_pressure);
  376. _mav_put_uint16_t(buf, 14, pcb_temp);
  377. _mav_put_uint16_t(buf, 16, stack_temp);
  378. _mav_put_uint16_t(buf, 18, work_status);
  379. _mav_put_uint16_t(buf, 20, falt_status);
  380. _mav_put_uint8_t(buf, 22, self_check);
  381. _mav_put_uint8_t(buf, 23, Id);
  382. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_QINGXIE_BMS, buf, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_CRC);
  383. #else
  384. mavlink_qingxie_bms_t *packet = (mavlink_qingxie_bms_t *)msgbuf;
  385. packet->bat_voltage = bat_voltage;
  386. packet->servo_current = servo_current;
  387. packet->stack_voltage = stack_voltage;
  388. packet->servo_voltage = servo_voltage;
  389. packet->bat_refuel_current = bat_refuel_current;
  390. packet->gas_tank_pressure = gas_tank_pressure;
  391. packet->pipe_pressure = pipe_pressure;
  392. packet->pcb_temp = pcb_temp;
  393. packet->stack_temp = stack_temp;
  394. packet->work_status = work_status;
  395. packet->falt_status = falt_status;
  396. packet->self_check = self_check;
  397. packet->Id = Id;
  398. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_QINGXIE_BMS, (const char *)packet, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_CRC);
  399. #endif
  400. }
  401. #endif
  402. #endif
  403. // MESSAGE QINGXIE_BMS UNPACKING
  404. /**
  405. * @brief Get field bat_voltage from qingxie_bms message
  406. *
  407. * @return [cV] Battery voltage.
  408. */
  409. static inline uint16_t mavlink_msg_qingxie_bms_get_bat_voltage(const mavlink_message_t* msg)
  410. {
  411. return _MAV_RETURN_uint16_t(msg, 0);
  412. }
  413. /**
  414. * @brief Get field servo_current from qingxie_bms message
  415. *
  416. * @return [cA] Servo current.
  417. */
  418. static inline uint16_t mavlink_msg_qingxie_bms_get_servo_current(const mavlink_message_t* msg)
  419. {
  420. return _MAV_RETURN_uint16_t(msg, 2);
  421. }
  422. /**
  423. * @brief Get field stack_voltage from qingxie_bms message
  424. *
  425. * @return [cV] Stack voltage.
  426. */
  427. static inline uint16_t mavlink_msg_qingxie_bms_get_stack_voltage(const mavlink_message_t* msg)
  428. {
  429. return _MAV_RETURN_uint16_t(msg, 4);
  430. }
  431. /**
  432. * @brief Get field servo_voltage from qingxie_bms message
  433. *
  434. * @return [cV] Servo voltage.
  435. */
  436. static inline uint16_t mavlink_msg_qingxie_bms_get_servo_voltage(const mavlink_message_t* msg)
  437. {
  438. return _MAV_RETURN_uint16_t(msg, 6);
  439. }
  440. /**
  441. * @brief Get field bat_refuel_current from qingxie_bms message
  442. *
  443. * @return [cA] Battery refuel current.
  444. */
  445. static inline uint16_t mavlink_msg_qingxie_bms_get_bat_refuel_current(const mavlink_message_t* msg)
  446. {
  447. return _MAV_RETURN_uint16_t(msg, 8);
  448. }
  449. /**
  450. * @brief Get field gas_tank_pressure from qingxie_bms message
  451. *
  452. * @return Gas tank pressure.
  453. */
  454. static inline uint16_t mavlink_msg_qingxie_bms_get_gas_tank_pressure(const mavlink_message_t* msg)
  455. {
  456. return _MAV_RETURN_uint16_t(msg, 10);
  457. }
  458. /**
  459. * @brief Get field pipe_pressure from qingxie_bms message
  460. *
  461. * @return Pipe pressure.
  462. */
  463. static inline uint16_t mavlink_msg_qingxie_bms_get_pipe_pressure(const mavlink_message_t* msg)
  464. {
  465. return _MAV_RETURN_uint16_t(msg, 12);
  466. }
  467. /**
  468. * @brief Get field pcb_temp from qingxie_bms message
  469. *
  470. * @return PCB temperature.
  471. */
  472. static inline uint16_t mavlink_msg_qingxie_bms_get_pcb_temp(const mavlink_message_t* msg)
  473. {
  474. return _MAV_RETURN_uint16_t(msg, 14);
  475. }
  476. /**
  477. * @brief Get field stack_temp from qingxie_bms message
  478. *
  479. * @return Stack temperature.
  480. */
  481. static inline uint16_t mavlink_msg_qingxie_bms_get_stack_temp(const mavlink_message_t* msg)
  482. {
  483. return _MAV_RETURN_uint16_t(msg, 16);
  484. }
  485. /**
  486. * @brief Get field work_status from qingxie_bms message
  487. *
  488. * @return
  489. */
  490. static inline uint16_t mavlink_msg_qingxie_bms_get_work_status(const mavlink_message_t* msg)
  491. {
  492. return _MAV_RETURN_uint16_t(msg, 18);
  493. }
  494. /**
  495. * @brief Get field falt_status from qingxie_bms message
  496. *
  497. * @return
  498. */
  499. static inline uint16_t mavlink_msg_qingxie_bms_get_falt_status(const mavlink_message_t* msg)
  500. {
  501. return _MAV_RETURN_uint16_t(msg, 20);
  502. }
  503. /**
  504. * @brief Get field self_check from qingxie_bms message
  505. *
  506. * @return
  507. */
  508. static inline uint8_t mavlink_msg_qingxie_bms_get_self_check(const mavlink_message_t* msg)
  509. {
  510. return _MAV_RETURN_uint8_t(msg, 22);
  511. }
  512. /**
  513. * @brief Get field Id from qingxie_bms message
  514. *
  515. * @return
  516. */
  517. static inline uint8_t mavlink_msg_qingxie_bms_get_Id(const mavlink_message_t* msg)
  518. {
  519. return _MAV_RETURN_uint8_t(msg, 23);
  520. }
  521. /**
  522. * @brief Decode a qingxie_bms message into a struct
  523. *
  524. * @param msg The message to decode
  525. * @param qingxie_bms C-struct to decode the message contents into
  526. */
  527. static inline void mavlink_msg_qingxie_bms_decode(const mavlink_message_t* msg, mavlink_qingxie_bms_t* qingxie_bms)
  528. {
  529. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  530. qingxie_bms->bat_voltage = mavlink_msg_qingxie_bms_get_bat_voltage(msg);
  531. qingxie_bms->servo_current = mavlink_msg_qingxie_bms_get_servo_current(msg);
  532. qingxie_bms->stack_voltage = mavlink_msg_qingxie_bms_get_stack_voltage(msg);
  533. qingxie_bms->servo_voltage = mavlink_msg_qingxie_bms_get_servo_voltage(msg);
  534. qingxie_bms->bat_refuel_current = mavlink_msg_qingxie_bms_get_bat_refuel_current(msg);
  535. qingxie_bms->gas_tank_pressure = mavlink_msg_qingxie_bms_get_gas_tank_pressure(msg);
  536. qingxie_bms->pipe_pressure = mavlink_msg_qingxie_bms_get_pipe_pressure(msg);
  537. qingxie_bms->pcb_temp = mavlink_msg_qingxie_bms_get_pcb_temp(msg);
  538. qingxie_bms->stack_temp = mavlink_msg_qingxie_bms_get_stack_temp(msg);
  539. qingxie_bms->work_status = mavlink_msg_qingxie_bms_get_work_status(msg);
  540. qingxie_bms->falt_status = mavlink_msg_qingxie_bms_get_falt_status(msg);
  541. qingxie_bms->self_check = mavlink_msg_qingxie_bms_get_self_check(msg);
  542. qingxie_bms->Id = mavlink_msg_qingxie_bms_get_Id(msg);
  543. #else
  544. uint8_t len = msg->len < MAVLINK_MSG_ID_QINGXIE_BMS_LEN? msg->len : MAVLINK_MSG_ID_QINGXIE_BMS_LEN;
  545. memset(qingxie_bms, 0, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  546. memcpy(qingxie_bms, _MAV_PAYLOAD(msg), len);
  547. #endif
  548. }