mavlink_msg_qingxie_bms.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  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. uint16_t gass_mass; /*< [dg] */
  19. uint16_t gass_percent; /*< [%] */
  20. uint16_t runtime_remain; /*< */
  21. uint8_t fan_percent; /*< */
  22. uint8_t fan_rpm; /*< */
  23. uint8_t sys_run_state; /*< */
  24. uint8_t sys_fault_state; /*< */
  25. uint16_t sys_fault_code; /*< */
  26. uint16_t lipo_current; /*< [dA] */
  27. uint16_t total_runtime; /*< [dh] */
  28. } mavlink_qingxie_bms_t;
  29. #define MAVLINK_MSG_ID_QINGXIE_BMS_LEN 40
  30. #define MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN 24
  31. #define MAVLINK_MSG_ID_53300_LEN 40
  32. #define MAVLINK_MSG_ID_53300_MIN_LEN 24
  33. #define MAVLINK_MSG_ID_QINGXIE_BMS_CRC 114
  34. #define MAVLINK_MSG_ID_53300_CRC 114
  35. #if MAVLINK_COMMAND_24BIT
  36. #define MAVLINK_MESSAGE_INFO_QINGXIE_BMS { \
  37. 53300, \
  38. "QINGXIE_BMS", \
  39. 23, \
  40. { { "bat_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_qingxie_bms_t, bat_voltage) }, \
  41. { "servo_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_qingxie_bms_t, servo_current) }, \
  42. { "stack_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_qingxie_bms_t, stack_voltage) }, \
  43. { "servo_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_qingxie_bms_t, servo_voltage) }, \
  44. { "bat_refuel_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_qingxie_bms_t, bat_refuel_current) }, \
  45. { "gas_tank_pressure", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_qingxie_bms_t, gas_tank_pressure) }, \
  46. { "pipe_pressure", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_qingxie_bms_t, pipe_pressure) }, \
  47. { "pcb_temp", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_qingxie_bms_t, pcb_temp) }, \
  48. { "stack_temp", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_qingxie_bms_t, stack_temp) }, \
  49. { "work_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_qingxie_bms_t, work_status) }, \
  50. { "falt_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_qingxie_bms_t, falt_status) }, \
  51. { "self_check", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_qingxie_bms_t, self_check) }, \
  52. { "Id", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_qingxie_bms_t, Id) }, \
  53. { "gass_mass", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_qingxie_bms_t, gass_mass) }, \
  54. { "gass_percent", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_qingxie_bms_t, gass_percent) }, \
  55. { "runtime_remain", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_qingxie_bms_t, runtime_remain) }, \
  56. { "fan_percent", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_qingxie_bms_t, fan_percent) }, \
  57. { "fan_rpm", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_qingxie_bms_t, fan_rpm) }, \
  58. { "sys_run_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_qingxie_bms_t, sys_run_state) }, \
  59. { "sys_fault_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_qingxie_bms_t, sys_fault_state) }, \
  60. { "sys_fault_code", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_qingxie_bms_t, sys_fault_code) }, \
  61. { "lipo_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_qingxie_bms_t, lipo_current) }, \
  62. { "total_runtime", NULL, MAVLINK_TYPE_UINT16_T, 0, 38, offsetof(mavlink_qingxie_bms_t, total_runtime) }, \
  63. } \
  64. }
  65. #else
  66. #define MAVLINK_MESSAGE_INFO_QINGXIE_BMS { \
  67. "QINGXIE_BMS", \
  68. 23, \
  69. { { "bat_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_qingxie_bms_t, bat_voltage) }, \
  70. { "servo_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_qingxie_bms_t, servo_current) }, \
  71. { "stack_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_qingxie_bms_t, stack_voltage) }, \
  72. { "servo_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_qingxie_bms_t, servo_voltage) }, \
  73. { "bat_refuel_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_qingxie_bms_t, bat_refuel_current) }, \
  74. { "gas_tank_pressure", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_qingxie_bms_t, gas_tank_pressure) }, \
  75. { "pipe_pressure", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_qingxie_bms_t, pipe_pressure) }, \
  76. { "pcb_temp", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_qingxie_bms_t, pcb_temp) }, \
  77. { "stack_temp", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_qingxie_bms_t, stack_temp) }, \
  78. { "work_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_qingxie_bms_t, work_status) }, \
  79. { "falt_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_qingxie_bms_t, falt_status) }, \
  80. { "self_check", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_qingxie_bms_t, self_check) }, \
  81. { "Id", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_qingxie_bms_t, Id) }, \
  82. { "gass_mass", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_qingxie_bms_t, gass_mass) }, \
  83. { "gass_percent", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_qingxie_bms_t, gass_percent) }, \
  84. { "runtime_remain", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_qingxie_bms_t, runtime_remain) }, \
  85. { "fan_percent", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_qingxie_bms_t, fan_percent) }, \
  86. { "fan_rpm", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_qingxie_bms_t, fan_rpm) }, \
  87. { "sys_run_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_qingxie_bms_t, sys_run_state) }, \
  88. { "sys_fault_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_qingxie_bms_t, sys_fault_state) }, \
  89. { "sys_fault_code", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_qingxie_bms_t, sys_fault_code) }, \
  90. { "lipo_current", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_qingxie_bms_t, lipo_current) }, \
  91. { "total_runtime", NULL, MAVLINK_TYPE_UINT16_T, 0, 38, offsetof(mavlink_qingxie_bms_t, total_runtime) }, \
  92. } \
  93. }
  94. #endif
  95. /**
  96. * @brief Pack a qingxie_bms message
  97. * @param system_id ID of this system
  98. * @param component_id ID of this component (e.g. 200 for IMU)
  99. * @param msg The MAVLink message to compress the data into
  100. *
  101. * @param bat_voltage [cV] Battery voltage.
  102. * @param servo_current [cA] Servo current.
  103. * @param stack_voltage [cV] Stack voltage.
  104. * @param servo_voltage [cV] Servo voltage.
  105. * @param bat_refuel_current [cA] Battery refuel current.
  106. * @param gas_tank_pressure Gas tank pressure.
  107. * @param pipe_pressure Pipe pressure.
  108. * @param pcb_temp PCB temperature.
  109. * @param stack_temp Stack temperature.
  110. * @param work_status
  111. * @param falt_status
  112. * @param self_check
  113. * @param Id
  114. * @param gass_mass [dg]
  115. * @param gass_percent [%]
  116. * @param runtime_remain
  117. * @param fan_percent
  118. * @param fan_rpm
  119. * @param sys_run_state
  120. * @param sys_fault_state
  121. * @param sys_fault_code
  122. * @param lipo_current [dA]
  123. * @param total_runtime [dh]
  124. * @return length of the message in bytes (excluding serial stream start sign)
  125. */
  126. static inline uint16_t mavlink_msg_qingxie_bms_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  127. 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, uint16_t gass_mass, uint16_t gass_percent, uint16_t runtime_remain, uint8_t fan_percent, uint8_t fan_rpm, uint8_t sys_run_state, uint8_t sys_fault_state, uint16_t sys_fault_code, uint16_t lipo_current, uint16_t total_runtime)
  128. {
  129. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  130. char buf[MAVLINK_MSG_ID_QINGXIE_BMS_LEN];
  131. _mav_put_uint16_t(buf, 0, bat_voltage);
  132. _mav_put_uint16_t(buf, 2, servo_current);
  133. _mav_put_uint16_t(buf, 4, stack_voltage);
  134. _mav_put_uint16_t(buf, 6, servo_voltage);
  135. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  136. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  137. _mav_put_uint16_t(buf, 12, pipe_pressure);
  138. _mav_put_uint16_t(buf, 14, pcb_temp);
  139. _mav_put_uint16_t(buf, 16, stack_temp);
  140. _mav_put_uint16_t(buf, 18, work_status);
  141. _mav_put_uint16_t(buf, 20, falt_status);
  142. _mav_put_uint8_t(buf, 22, self_check);
  143. _mav_put_uint8_t(buf, 23, Id);
  144. _mav_put_uint16_t(buf, 24, gass_mass);
  145. _mav_put_uint16_t(buf, 26, gass_percent);
  146. _mav_put_uint16_t(buf, 28, runtime_remain);
  147. _mav_put_uint8_t(buf, 30, fan_percent);
  148. _mav_put_uint8_t(buf, 31, fan_rpm);
  149. _mav_put_uint8_t(buf, 32, sys_run_state);
  150. _mav_put_uint8_t(buf, 33, sys_fault_state);
  151. _mav_put_uint16_t(buf, 34, sys_fault_code);
  152. _mav_put_uint16_t(buf, 36, lipo_current);
  153. _mav_put_uint16_t(buf, 38, total_runtime);
  154. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  155. #else
  156. mavlink_qingxie_bms_t packet;
  157. packet.bat_voltage = bat_voltage;
  158. packet.servo_current = servo_current;
  159. packet.stack_voltage = stack_voltage;
  160. packet.servo_voltage = servo_voltage;
  161. packet.bat_refuel_current = bat_refuel_current;
  162. packet.gas_tank_pressure = gas_tank_pressure;
  163. packet.pipe_pressure = pipe_pressure;
  164. packet.pcb_temp = pcb_temp;
  165. packet.stack_temp = stack_temp;
  166. packet.work_status = work_status;
  167. packet.falt_status = falt_status;
  168. packet.self_check = self_check;
  169. packet.Id = Id;
  170. packet.gass_mass = gass_mass;
  171. packet.gass_percent = gass_percent;
  172. packet.runtime_remain = runtime_remain;
  173. packet.fan_percent = fan_percent;
  174. packet.fan_rpm = fan_rpm;
  175. packet.sys_run_state = sys_run_state;
  176. packet.sys_fault_state = sys_fault_state;
  177. packet.sys_fault_code = sys_fault_code;
  178. packet.lipo_current = lipo_current;
  179. packet.total_runtime = total_runtime;
  180. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  181. #endif
  182. msg->msgid = MAVLINK_MSG_ID_QINGXIE_BMS;
  183. 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);
  184. }
  185. /**
  186. * @brief Pack a qingxie_bms message
  187. * @param system_id ID of this system
  188. * @param component_id ID of this component (e.g. 200 for IMU)
  189. * @param status MAVLink status structure
  190. * @param msg The MAVLink message to compress the data into
  191. *
  192. * @param bat_voltage [cV] Battery voltage.
  193. * @param servo_current [cA] Servo current.
  194. * @param stack_voltage [cV] Stack voltage.
  195. * @param servo_voltage [cV] Servo voltage.
  196. * @param bat_refuel_current [cA] Battery refuel current.
  197. * @param gas_tank_pressure Gas tank pressure.
  198. * @param pipe_pressure Pipe pressure.
  199. * @param pcb_temp PCB temperature.
  200. * @param stack_temp Stack temperature.
  201. * @param work_status
  202. * @param falt_status
  203. * @param self_check
  204. * @param Id
  205. * @param gass_mass [dg]
  206. * @param gass_percent [%]
  207. * @param runtime_remain
  208. * @param fan_percent
  209. * @param fan_rpm
  210. * @param sys_run_state
  211. * @param sys_fault_state
  212. * @param sys_fault_code
  213. * @param lipo_current [dA]
  214. * @param total_runtime [dh]
  215. * @return length of the message in bytes (excluding serial stream start sign)
  216. */
  217. 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,
  218. 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, uint16_t gass_mass, uint16_t gass_percent, uint16_t runtime_remain, uint8_t fan_percent, uint8_t fan_rpm, uint8_t sys_run_state, uint8_t sys_fault_state, uint16_t sys_fault_code, uint16_t lipo_current, uint16_t total_runtime)
  219. {
  220. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  221. char buf[MAVLINK_MSG_ID_QINGXIE_BMS_LEN];
  222. _mav_put_uint16_t(buf, 0, bat_voltage);
  223. _mav_put_uint16_t(buf, 2, servo_current);
  224. _mav_put_uint16_t(buf, 4, stack_voltage);
  225. _mav_put_uint16_t(buf, 6, servo_voltage);
  226. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  227. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  228. _mav_put_uint16_t(buf, 12, pipe_pressure);
  229. _mav_put_uint16_t(buf, 14, pcb_temp);
  230. _mav_put_uint16_t(buf, 16, stack_temp);
  231. _mav_put_uint16_t(buf, 18, work_status);
  232. _mav_put_uint16_t(buf, 20, falt_status);
  233. _mav_put_uint8_t(buf, 22, self_check);
  234. _mav_put_uint8_t(buf, 23, Id);
  235. _mav_put_uint16_t(buf, 24, gass_mass);
  236. _mav_put_uint16_t(buf, 26, gass_percent);
  237. _mav_put_uint16_t(buf, 28, runtime_remain);
  238. _mav_put_uint8_t(buf, 30, fan_percent);
  239. _mav_put_uint8_t(buf, 31, fan_rpm);
  240. _mav_put_uint8_t(buf, 32, sys_run_state);
  241. _mav_put_uint8_t(buf, 33, sys_fault_state);
  242. _mav_put_uint16_t(buf, 34, sys_fault_code);
  243. _mav_put_uint16_t(buf, 36, lipo_current);
  244. _mav_put_uint16_t(buf, 38, total_runtime);
  245. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  246. #else
  247. mavlink_qingxie_bms_t packet;
  248. packet.bat_voltage = bat_voltage;
  249. packet.servo_current = servo_current;
  250. packet.stack_voltage = stack_voltage;
  251. packet.servo_voltage = servo_voltage;
  252. packet.bat_refuel_current = bat_refuel_current;
  253. packet.gas_tank_pressure = gas_tank_pressure;
  254. packet.pipe_pressure = pipe_pressure;
  255. packet.pcb_temp = pcb_temp;
  256. packet.stack_temp = stack_temp;
  257. packet.work_status = work_status;
  258. packet.falt_status = falt_status;
  259. packet.self_check = self_check;
  260. packet.Id = Id;
  261. packet.gass_mass = gass_mass;
  262. packet.gass_percent = gass_percent;
  263. packet.runtime_remain = runtime_remain;
  264. packet.fan_percent = fan_percent;
  265. packet.fan_rpm = fan_rpm;
  266. packet.sys_run_state = sys_run_state;
  267. packet.sys_fault_state = sys_fault_state;
  268. packet.sys_fault_code = sys_fault_code;
  269. packet.lipo_current = lipo_current;
  270. packet.total_runtime = total_runtime;
  271. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  272. #endif
  273. msg->msgid = MAVLINK_MSG_ID_QINGXIE_BMS;
  274. #if MAVLINK_CRC_EXTRA
  275. 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);
  276. #else
  277. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_QINGXIE_BMS_MIN_LEN, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  278. #endif
  279. }
  280. /**
  281. * @brief Pack a qingxie_bms message on a channel
  282. * @param system_id ID of this system
  283. * @param component_id ID of this component (e.g. 200 for IMU)
  284. * @param chan The MAVLink channel this message will be sent over
  285. * @param msg The MAVLink message to compress the data into
  286. * @param bat_voltage [cV] Battery voltage.
  287. * @param servo_current [cA] Servo current.
  288. * @param stack_voltage [cV] Stack voltage.
  289. * @param servo_voltage [cV] Servo voltage.
  290. * @param bat_refuel_current [cA] Battery refuel current.
  291. * @param gas_tank_pressure Gas tank pressure.
  292. * @param pipe_pressure Pipe pressure.
  293. * @param pcb_temp PCB temperature.
  294. * @param stack_temp Stack temperature.
  295. * @param work_status
  296. * @param falt_status
  297. * @param self_check
  298. * @param Id
  299. * @param gass_mass [dg]
  300. * @param gass_percent [%]
  301. * @param runtime_remain
  302. * @param fan_percent
  303. * @param fan_rpm
  304. * @param sys_run_state
  305. * @param sys_fault_state
  306. * @param sys_fault_code
  307. * @param lipo_current [dA]
  308. * @param total_runtime [dh]
  309. * @return length of the message in bytes (excluding serial stream start sign)
  310. */
  311. static inline uint16_t mavlink_msg_qingxie_bms_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  312. mavlink_message_t* msg,
  313. 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,uint16_t gass_mass,uint16_t gass_percent,uint16_t runtime_remain,uint8_t fan_percent,uint8_t fan_rpm,uint8_t sys_run_state,uint8_t sys_fault_state,uint16_t sys_fault_code,uint16_t lipo_current,uint16_t total_runtime)
  314. {
  315. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  316. char buf[MAVLINK_MSG_ID_QINGXIE_BMS_LEN];
  317. _mav_put_uint16_t(buf, 0, bat_voltage);
  318. _mav_put_uint16_t(buf, 2, servo_current);
  319. _mav_put_uint16_t(buf, 4, stack_voltage);
  320. _mav_put_uint16_t(buf, 6, servo_voltage);
  321. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  322. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  323. _mav_put_uint16_t(buf, 12, pipe_pressure);
  324. _mav_put_uint16_t(buf, 14, pcb_temp);
  325. _mav_put_uint16_t(buf, 16, stack_temp);
  326. _mav_put_uint16_t(buf, 18, work_status);
  327. _mav_put_uint16_t(buf, 20, falt_status);
  328. _mav_put_uint8_t(buf, 22, self_check);
  329. _mav_put_uint8_t(buf, 23, Id);
  330. _mav_put_uint16_t(buf, 24, gass_mass);
  331. _mav_put_uint16_t(buf, 26, gass_percent);
  332. _mav_put_uint16_t(buf, 28, runtime_remain);
  333. _mav_put_uint8_t(buf, 30, fan_percent);
  334. _mav_put_uint8_t(buf, 31, fan_rpm);
  335. _mav_put_uint8_t(buf, 32, sys_run_state);
  336. _mav_put_uint8_t(buf, 33, sys_fault_state);
  337. _mav_put_uint16_t(buf, 34, sys_fault_code);
  338. _mav_put_uint16_t(buf, 36, lipo_current);
  339. _mav_put_uint16_t(buf, 38, total_runtime);
  340. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  341. #else
  342. mavlink_qingxie_bms_t packet;
  343. packet.bat_voltage = bat_voltage;
  344. packet.servo_current = servo_current;
  345. packet.stack_voltage = stack_voltage;
  346. packet.servo_voltage = servo_voltage;
  347. packet.bat_refuel_current = bat_refuel_current;
  348. packet.gas_tank_pressure = gas_tank_pressure;
  349. packet.pipe_pressure = pipe_pressure;
  350. packet.pcb_temp = pcb_temp;
  351. packet.stack_temp = stack_temp;
  352. packet.work_status = work_status;
  353. packet.falt_status = falt_status;
  354. packet.self_check = self_check;
  355. packet.Id = Id;
  356. packet.gass_mass = gass_mass;
  357. packet.gass_percent = gass_percent;
  358. packet.runtime_remain = runtime_remain;
  359. packet.fan_percent = fan_percent;
  360. packet.fan_rpm = fan_rpm;
  361. packet.sys_run_state = sys_run_state;
  362. packet.sys_fault_state = sys_fault_state;
  363. packet.sys_fault_code = sys_fault_code;
  364. packet.lipo_current = lipo_current;
  365. packet.total_runtime = total_runtime;
  366. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  367. #endif
  368. msg->msgid = MAVLINK_MSG_ID_QINGXIE_BMS;
  369. 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);
  370. }
  371. /**
  372. * @brief Encode a qingxie_bms struct
  373. *
  374. * @param system_id ID of this system
  375. * @param component_id ID of this component (e.g. 200 for IMU)
  376. * @param msg The MAVLink message to compress the data into
  377. * @param qingxie_bms C-struct to read the message contents from
  378. */
  379. 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)
  380. {
  381. 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, qingxie_bms->gass_mass, qingxie_bms->gass_percent, qingxie_bms->runtime_remain, qingxie_bms->fan_percent, qingxie_bms->fan_rpm, qingxie_bms->sys_run_state, qingxie_bms->sys_fault_state, qingxie_bms->sys_fault_code, qingxie_bms->lipo_current, qingxie_bms->total_runtime);
  382. }
  383. /**
  384. * @brief Encode a qingxie_bms struct on a channel
  385. *
  386. * @param system_id ID of this system
  387. * @param component_id ID of this component (e.g. 200 for IMU)
  388. * @param chan The MAVLink channel this message will be sent over
  389. * @param msg The MAVLink message to compress the data into
  390. * @param qingxie_bms C-struct to read the message contents from
  391. */
  392. 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)
  393. {
  394. 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, qingxie_bms->gass_mass, qingxie_bms->gass_percent, qingxie_bms->runtime_remain, qingxie_bms->fan_percent, qingxie_bms->fan_rpm, qingxie_bms->sys_run_state, qingxie_bms->sys_fault_state, qingxie_bms->sys_fault_code, qingxie_bms->lipo_current, qingxie_bms->total_runtime);
  395. }
  396. /**
  397. * @brief Encode a qingxie_bms struct with provided status structure
  398. *
  399. * @param system_id ID of this system
  400. * @param component_id ID of this component (e.g. 200 for IMU)
  401. * @param status MAVLink status structure
  402. * @param msg The MAVLink message to compress the data into
  403. * @param qingxie_bms C-struct to read the message contents from
  404. */
  405. 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)
  406. {
  407. 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, qingxie_bms->gass_mass, qingxie_bms->gass_percent, qingxie_bms->runtime_remain, qingxie_bms->fan_percent, qingxie_bms->fan_rpm, qingxie_bms->sys_run_state, qingxie_bms->sys_fault_state, qingxie_bms->sys_fault_code, qingxie_bms->lipo_current, qingxie_bms->total_runtime);
  408. }
  409. /**
  410. * @brief Send a qingxie_bms message
  411. * @param chan MAVLink channel to send the message
  412. *
  413. * @param bat_voltage [cV] Battery voltage.
  414. * @param servo_current [cA] Servo current.
  415. * @param stack_voltage [cV] Stack voltage.
  416. * @param servo_voltage [cV] Servo voltage.
  417. * @param bat_refuel_current [cA] Battery refuel current.
  418. * @param gas_tank_pressure Gas tank pressure.
  419. * @param pipe_pressure Pipe pressure.
  420. * @param pcb_temp PCB temperature.
  421. * @param stack_temp Stack temperature.
  422. * @param work_status
  423. * @param falt_status
  424. * @param self_check
  425. * @param Id
  426. * @param gass_mass [dg]
  427. * @param gass_percent [%]
  428. * @param runtime_remain
  429. * @param fan_percent
  430. * @param fan_rpm
  431. * @param sys_run_state
  432. * @param sys_fault_state
  433. * @param sys_fault_code
  434. * @param lipo_current [dA]
  435. * @param total_runtime [dh]
  436. */
  437. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  438. 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, uint16_t gass_mass, uint16_t gass_percent, uint16_t runtime_remain, uint8_t fan_percent, uint8_t fan_rpm, uint8_t sys_run_state, uint8_t sys_fault_state, uint16_t sys_fault_code, uint16_t lipo_current, uint16_t total_runtime)
  439. {
  440. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  441. char buf[MAVLINK_MSG_ID_QINGXIE_BMS_LEN];
  442. _mav_put_uint16_t(buf, 0, bat_voltage);
  443. _mav_put_uint16_t(buf, 2, servo_current);
  444. _mav_put_uint16_t(buf, 4, stack_voltage);
  445. _mav_put_uint16_t(buf, 6, servo_voltage);
  446. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  447. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  448. _mav_put_uint16_t(buf, 12, pipe_pressure);
  449. _mav_put_uint16_t(buf, 14, pcb_temp);
  450. _mav_put_uint16_t(buf, 16, stack_temp);
  451. _mav_put_uint16_t(buf, 18, work_status);
  452. _mav_put_uint16_t(buf, 20, falt_status);
  453. _mav_put_uint8_t(buf, 22, self_check);
  454. _mav_put_uint8_t(buf, 23, Id);
  455. _mav_put_uint16_t(buf, 24, gass_mass);
  456. _mav_put_uint16_t(buf, 26, gass_percent);
  457. _mav_put_uint16_t(buf, 28, runtime_remain);
  458. _mav_put_uint8_t(buf, 30, fan_percent);
  459. _mav_put_uint8_t(buf, 31, fan_rpm);
  460. _mav_put_uint8_t(buf, 32, sys_run_state);
  461. _mav_put_uint8_t(buf, 33, sys_fault_state);
  462. _mav_put_uint16_t(buf, 34, sys_fault_code);
  463. _mav_put_uint16_t(buf, 36, lipo_current);
  464. _mav_put_uint16_t(buf, 38, total_runtime);
  465. _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);
  466. #else
  467. mavlink_qingxie_bms_t packet;
  468. packet.bat_voltage = bat_voltage;
  469. packet.servo_current = servo_current;
  470. packet.stack_voltage = stack_voltage;
  471. packet.servo_voltage = servo_voltage;
  472. packet.bat_refuel_current = bat_refuel_current;
  473. packet.gas_tank_pressure = gas_tank_pressure;
  474. packet.pipe_pressure = pipe_pressure;
  475. packet.pcb_temp = pcb_temp;
  476. packet.stack_temp = stack_temp;
  477. packet.work_status = work_status;
  478. packet.falt_status = falt_status;
  479. packet.self_check = self_check;
  480. packet.Id = Id;
  481. packet.gass_mass = gass_mass;
  482. packet.gass_percent = gass_percent;
  483. packet.runtime_remain = runtime_remain;
  484. packet.fan_percent = fan_percent;
  485. packet.fan_rpm = fan_rpm;
  486. packet.sys_run_state = sys_run_state;
  487. packet.sys_fault_state = sys_fault_state;
  488. packet.sys_fault_code = sys_fault_code;
  489. packet.lipo_current = lipo_current;
  490. packet.total_runtime = total_runtime;
  491. _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);
  492. #endif
  493. }
  494. /**
  495. * @brief Send a qingxie_bms message
  496. * @param chan MAVLink channel to send the message
  497. * @param struct The MAVLink struct to serialize
  498. */
  499. static inline void mavlink_msg_qingxie_bms_send_struct(mavlink_channel_t chan, const mavlink_qingxie_bms_t* qingxie_bms)
  500. {
  501. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  502. 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, qingxie_bms->gass_mass, qingxie_bms->gass_percent, qingxie_bms->runtime_remain, qingxie_bms->fan_percent, qingxie_bms->fan_rpm, qingxie_bms->sys_run_state, qingxie_bms->sys_fault_state, qingxie_bms->sys_fault_code, qingxie_bms->lipo_current, qingxie_bms->total_runtime);
  503. #else
  504. _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);
  505. #endif
  506. }
  507. #if MAVLINK_MSG_ID_QINGXIE_BMS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  508. /*
  509. This variant of _send() can be used to save stack space by re-using
  510. memory from the receive buffer. The caller provides a
  511. mavlink_message_t which is the size of a full mavlink message. This
  512. is usually the receive buffer for the channel, and allows a reply to an
  513. incoming message with minimum stack space usage.
  514. */
  515. 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, uint16_t gass_mass, uint16_t gass_percent, uint16_t runtime_remain, uint8_t fan_percent, uint8_t fan_rpm, uint8_t sys_run_state, uint8_t sys_fault_state, uint16_t sys_fault_code, uint16_t lipo_current, uint16_t total_runtime)
  516. {
  517. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  518. char *buf = (char *)msgbuf;
  519. _mav_put_uint16_t(buf, 0, bat_voltage);
  520. _mav_put_uint16_t(buf, 2, servo_current);
  521. _mav_put_uint16_t(buf, 4, stack_voltage);
  522. _mav_put_uint16_t(buf, 6, servo_voltage);
  523. _mav_put_uint16_t(buf, 8, bat_refuel_current);
  524. _mav_put_uint16_t(buf, 10, gas_tank_pressure);
  525. _mav_put_uint16_t(buf, 12, pipe_pressure);
  526. _mav_put_uint16_t(buf, 14, pcb_temp);
  527. _mav_put_uint16_t(buf, 16, stack_temp);
  528. _mav_put_uint16_t(buf, 18, work_status);
  529. _mav_put_uint16_t(buf, 20, falt_status);
  530. _mav_put_uint8_t(buf, 22, self_check);
  531. _mav_put_uint8_t(buf, 23, Id);
  532. _mav_put_uint16_t(buf, 24, gass_mass);
  533. _mav_put_uint16_t(buf, 26, gass_percent);
  534. _mav_put_uint16_t(buf, 28, runtime_remain);
  535. _mav_put_uint8_t(buf, 30, fan_percent);
  536. _mav_put_uint8_t(buf, 31, fan_rpm);
  537. _mav_put_uint8_t(buf, 32, sys_run_state);
  538. _mav_put_uint8_t(buf, 33, sys_fault_state);
  539. _mav_put_uint16_t(buf, 34, sys_fault_code);
  540. _mav_put_uint16_t(buf, 36, lipo_current);
  541. _mav_put_uint16_t(buf, 38, total_runtime);
  542. _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);
  543. #else
  544. mavlink_qingxie_bms_t *packet = (mavlink_qingxie_bms_t *)msgbuf;
  545. packet->bat_voltage = bat_voltage;
  546. packet->servo_current = servo_current;
  547. packet->stack_voltage = stack_voltage;
  548. packet->servo_voltage = servo_voltage;
  549. packet->bat_refuel_current = bat_refuel_current;
  550. packet->gas_tank_pressure = gas_tank_pressure;
  551. packet->pipe_pressure = pipe_pressure;
  552. packet->pcb_temp = pcb_temp;
  553. packet->stack_temp = stack_temp;
  554. packet->work_status = work_status;
  555. packet->falt_status = falt_status;
  556. packet->self_check = self_check;
  557. packet->Id = Id;
  558. packet->gass_mass = gass_mass;
  559. packet->gass_percent = gass_percent;
  560. packet->runtime_remain = runtime_remain;
  561. packet->fan_percent = fan_percent;
  562. packet->fan_rpm = fan_rpm;
  563. packet->sys_run_state = sys_run_state;
  564. packet->sys_fault_state = sys_fault_state;
  565. packet->sys_fault_code = sys_fault_code;
  566. packet->lipo_current = lipo_current;
  567. packet->total_runtime = total_runtime;
  568. _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);
  569. #endif
  570. }
  571. #endif
  572. #endif
  573. // MESSAGE QINGXIE_BMS UNPACKING
  574. /**
  575. * @brief Get field bat_voltage from qingxie_bms message
  576. *
  577. * @return [cV] Battery voltage.
  578. */
  579. static inline uint16_t mavlink_msg_qingxie_bms_get_bat_voltage(const mavlink_message_t* msg)
  580. {
  581. return _MAV_RETURN_uint16_t(msg, 0);
  582. }
  583. /**
  584. * @brief Get field servo_current from qingxie_bms message
  585. *
  586. * @return [cA] Servo current.
  587. */
  588. static inline uint16_t mavlink_msg_qingxie_bms_get_servo_current(const mavlink_message_t* msg)
  589. {
  590. return _MAV_RETURN_uint16_t(msg, 2);
  591. }
  592. /**
  593. * @brief Get field stack_voltage from qingxie_bms message
  594. *
  595. * @return [cV] Stack voltage.
  596. */
  597. static inline uint16_t mavlink_msg_qingxie_bms_get_stack_voltage(const mavlink_message_t* msg)
  598. {
  599. return _MAV_RETURN_uint16_t(msg, 4);
  600. }
  601. /**
  602. * @brief Get field servo_voltage from qingxie_bms message
  603. *
  604. * @return [cV] Servo voltage.
  605. */
  606. static inline uint16_t mavlink_msg_qingxie_bms_get_servo_voltage(const mavlink_message_t* msg)
  607. {
  608. return _MAV_RETURN_uint16_t(msg, 6);
  609. }
  610. /**
  611. * @brief Get field bat_refuel_current from qingxie_bms message
  612. *
  613. * @return [cA] Battery refuel current.
  614. */
  615. static inline uint16_t mavlink_msg_qingxie_bms_get_bat_refuel_current(const mavlink_message_t* msg)
  616. {
  617. return _MAV_RETURN_uint16_t(msg, 8);
  618. }
  619. /**
  620. * @brief Get field gas_tank_pressure from qingxie_bms message
  621. *
  622. * @return Gas tank pressure.
  623. */
  624. static inline uint16_t mavlink_msg_qingxie_bms_get_gas_tank_pressure(const mavlink_message_t* msg)
  625. {
  626. return _MAV_RETURN_uint16_t(msg, 10);
  627. }
  628. /**
  629. * @brief Get field pipe_pressure from qingxie_bms message
  630. *
  631. * @return Pipe pressure.
  632. */
  633. static inline uint16_t mavlink_msg_qingxie_bms_get_pipe_pressure(const mavlink_message_t* msg)
  634. {
  635. return _MAV_RETURN_uint16_t(msg, 12);
  636. }
  637. /**
  638. * @brief Get field pcb_temp from qingxie_bms message
  639. *
  640. * @return PCB temperature.
  641. */
  642. static inline uint16_t mavlink_msg_qingxie_bms_get_pcb_temp(const mavlink_message_t* msg)
  643. {
  644. return _MAV_RETURN_uint16_t(msg, 14);
  645. }
  646. /**
  647. * @brief Get field stack_temp from qingxie_bms message
  648. *
  649. * @return Stack temperature.
  650. */
  651. static inline uint16_t mavlink_msg_qingxie_bms_get_stack_temp(const mavlink_message_t* msg)
  652. {
  653. return _MAV_RETURN_uint16_t(msg, 16);
  654. }
  655. /**
  656. * @brief Get field work_status from qingxie_bms message
  657. *
  658. * @return
  659. */
  660. static inline uint16_t mavlink_msg_qingxie_bms_get_work_status(const mavlink_message_t* msg)
  661. {
  662. return _MAV_RETURN_uint16_t(msg, 18);
  663. }
  664. /**
  665. * @brief Get field falt_status from qingxie_bms message
  666. *
  667. * @return
  668. */
  669. static inline uint16_t mavlink_msg_qingxie_bms_get_falt_status(const mavlink_message_t* msg)
  670. {
  671. return _MAV_RETURN_uint16_t(msg, 20);
  672. }
  673. /**
  674. * @brief Get field self_check from qingxie_bms message
  675. *
  676. * @return
  677. */
  678. static inline uint8_t mavlink_msg_qingxie_bms_get_self_check(const mavlink_message_t* msg)
  679. {
  680. return _MAV_RETURN_uint8_t(msg, 22);
  681. }
  682. /**
  683. * @brief Get field Id from qingxie_bms message
  684. *
  685. * @return
  686. */
  687. static inline uint8_t mavlink_msg_qingxie_bms_get_Id(const mavlink_message_t* msg)
  688. {
  689. return _MAV_RETURN_uint8_t(msg, 23);
  690. }
  691. /**
  692. * @brief Get field gass_mass from qingxie_bms message
  693. *
  694. * @return [dg]
  695. */
  696. static inline uint16_t mavlink_msg_qingxie_bms_get_gass_mass(const mavlink_message_t* msg)
  697. {
  698. return _MAV_RETURN_uint16_t(msg, 24);
  699. }
  700. /**
  701. * @brief Get field gass_percent from qingxie_bms message
  702. *
  703. * @return [%]
  704. */
  705. static inline uint16_t mavlink_msg_qingxie_bms_get_gass_percent(const mavlink_message_t* msg)
  706. {
  707. return _MAV_RETURN_uint16_t(msg, 26);
  708. }
  709. /**
  710. * @brief Get field runtime_remain from qingxie_bms message
  711. *
  712. * @return
  713. */
  714. static inline uint16_t mavlink_msg_qingxie_bms_get_runtime_remain(const mavlink_message_t* msg)
  715. {
  716. return _MAV_RETURN_uint16_t(msg, 28);
  717. }
  718. /**
  719. * @brief Get field fan_percent from qingxie_bms message
  720. *
  721. * @return
  722. */
  723. static inline uint8_t mavlink_msg_qingxie_bms_get_fan_percent(const mavlink_message_t* msg)
  724. {
  725. return _MAV_RETURN_uint8_t(msg, 30);
  726. }
  727. /**
  728. * @brief Get field fan_rpm from qingxie_bms message
  729. *
  730. * @return
  731. */
  732. static inline uint8_t mavlink_msg_qingxie_bms_get_fan_rpm(const mavlink_message_t* msg)
  733. {
  734. return _MAV_RETURN_uint8_t(msg, 31);
  735. }
  736. /**
  737. * @brief Get field sys_run_state from qingxie_bms message
  738. *
  739. * @return
  740. */
  741. static inline uint8_t mavlink_msg_qingxie_bms_get_sys_run_state(const mavlink_message_t* msg)
  742. {
  743. return _MAV_RETURN_uint8_t(msg, 32);
  744. }
  745. /**
  746. * @brief Get field sys_fault_state from qingxie_bms message
  747. *
  748. * @return
  749. */
  750. static inline uint8_t mavlink_msg_qingxie_bms_get_sys_fault_state(const mavlink_message_t* msg)
  751. {
  752. return _MAV_RETURN_uint8_t(msg, 33);
  753. }
  754. /**
  755. * @brief Get field sys_fault_code from qingxie_bms message
  756. *
  757. * @return
  758. */
  759. static inline uint16_t mavlink_msg_qingxie_bms_get_sys_fault_code(const mavlink_message_t* msg)
  760. {
  761. return _MAV_RETURN_uint16_t(msg, 34);
  762. }
  763. /**
  764. * @brief Get field lipo_current from qingxie_bms message
  765. *
  766. * @return [dA]
  767. */
  768. static inline uint16_t mavlink_msg_qingxie_bms_get_lipo_current(const mavlink_message_t* msg)
  769. {
  770. return _MAV_RETURN_uint16_t(msg, 36);
  771. }
  772. /**
  773. * @brief Get field total_runtime from qingxie_bms message
  774. *
  775. * @return [dh]
  776. */
  777. static inline uint16_t mavlink_msg_qingxie_bms_get_total_runtime(const mavlink_message_t* msg)
  778. {
  779. return _MAV_RETURN_uint16_t(msg, 38);
  780. }
  781. /**
  782. * @brief Decode a qingxie_bms message into a struct
  783. *
  784. * @param msg The message to decode
  785. * @param qingxie_bms C-struct to decode the message contents into
  786. */
  787. static inline void mavlink_msg_qingxie_bms_decode(const mavlink_message_t* msg, mavlink_qingxie_bms_t* qingxie_bms)
  788. {
  789. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  790. qingxie_bms->bat_voltage = mavlink_msg_qingxie_bms_get_bat_voltage(msg);
  791. qingxie_bms->servo_current = mavlink_msg_qingxie_bms_get_servo_current(msg);
  792. qingxie_bms->stack_voltage = mavlink_msg_qingxie_bms_get_stack_voltage(msg);
  793. qingxie_bms->servo_voltage = mavlink_msg_qingxie_bms_get_servo_voltage(msg);
  794. qingxie_bms->bat_refuel_current = mavlink_msg_qingxie_bms_get_bat_refuel_current(msg);
  795. qingxie_bms->gas_tank_pressure = mavlink_msg_qingxie_bms_get_gas_tank_pressure(msg);
  796. qingxie_bms->pipe_pressure = mavlink_msg_qingxie_bms_get_pipe_pressure(msg);
  797. qingxie_bms->pcb_temp = mavlink_msg_qingxie_bms_get_pcb_temp(msg);
  798. qingxie_bms->stack_temp = mavlink_msg_qingxie_bms_get_stack_temp(msg);
  799. qingxie_bms->work_status = mavlink_msg_qingxie_bms_get_work_status(msg);
  800. qingxie_bms->falt_status = mavlink_msg_qingxie_bms_get_falt_status(msg);
  801. qingxie_bms->self_check = mavlink_msg_qingxie_bms_get_self_check(msg);
  802. qingxie_bms->Id = mavlink_msg_qingxie_bms_get_Id(msg);
  803. qingxie_bms->gass_mass = mavlink_msg_qingxie_bms_get_gass_mass(msg);
  804. qingxie_bms->gass_percent = mavlink_msg_qingxie_bms_get_gass_percent(msg);
  805. qingxie_bms->runtime_remain = mavlink_msg_qingxie_bms_get_runtime_remain(msg);
  806. qingxie_bms->fan_percent = mavlink_msg_qingxie_bms_get_fan_percent(msg);
  807. qingxie_bms->fan_rpm = mavlink_msg_qingxie_bms_get_fan_rpm(msg);
  808. qingxie_bms->sys_run_state = mavlink_msg_qingxie_bms_get_sys_run_state(msg);
  809. qingxie_bms->sys_fault_state = mavlink_msg_qingxie_bms_get_sys_fault_state(msg);
  810. qingxie_bms->sys_fault_code = mavlink_msg_qingxie_bms_get_sys_fault_code(msg);
  811. qingxie_bms->lipo_current = mavlink_msg_qingxie_bms_get_lipo_current(msg);
  812. qingxie_bms->total_runtime = mavlink_msg_qingxie_bms_get_total_runtime(msg);
  813. #else
  814. uint8_t len = msg->len < MAVLINK_MSG_ID_QINGXIE_BMS_LEN? msg->len : MAVLINK_MSG_ID_QINGXIE_BMS_LEN;
  815. memset(qingxie_bms, 0, MAVLINK_MSG_ID_QINGXIE_BMS_LEN);
  816. memcpy(qingxie_bms, _MAV_PAYLOAD(msg), len);
  817. #endif
  818. }