You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

335 lines
16 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. #pragma once
  2. #include <stdint.h>
  3. #include "zscanprotocol/zscanprotocol.hpp"
  4. namespace iflytop {
  5. namespace transmit_disfection_protocol {
  6. using namespace zscanprotocol;
  7. #define PROTOCOL_VERSION 6
  8. #define HEART_OVERTIME (30 * 1000)
  9. typedef enum {
  10. klarge_space_disinfection_machine = 1, // 大空间消毒机
  11. ksmall_space_disinfection_machine = 2, // 小空间消毒机
  12. kpipe_disinfection_machine = 3, // 管道式消毒机
  13. kdraw_bar_disinfection_box = 4, // 手持拉杆箱消毒机
  14. kh2o2_ext_sensor = 5, // 外部H2O2传感器
  15. } ProjID_t;
  16. typedef enum {
  17. kLargeSpaceDMLiquidCtrlBoard = 1, // 大空间消毒机液路板
  18. kLargeSpaceDMPowerCtrlBoard = 2, // 大空间消毒机电源板
  19. kSmallSpaceDMLiquidCtrlBoard = 3, // 小空间消毒机液路板
  20. kSmallSpaceDMPowerCtrlBoard = 4, // 小空间消毒机电源板
  21. kPipeDMLiquidCtrlBoard = 5, // 管道式消毒机液路板
  22. kPipeDMPowerCtrlBoard = 6, // 管道式消毒机电源板
  23. kDrawBarDMLiquidCtrlBoard = 7, // 手持拉杆箱消毒机液路板
  24. kDrawBarDMPowerCtrlBoard = 8, // 手持拉杆箱消毒机电源板
  25. kDrawBarDMExtBallValveCtrl = 9, // 手持拉杆箱消毒机外部球阀控制板
  26. kH2O2SensorBoard = 10, // H2O2传感器板
  27. } BoardTypeId_t;
  28. typedef enum {
  29. kFixBoardId_MainBoard = 1, // 主机
  30. kFixBoardId_LiquidCtrl = 2, // 液路板
  31. kFixBoardId_PowerControl = 3, // 电源板
  32. kFixBoardId_ExtBallValveCtrl = 4, // 外部球阀控制板
  33. kFixBoardId_H2O2SensorStart = 100, // H2O2传感器板
  34. } BoardId_t;
  35. static inline const char *ProjectIDToString(uint32_t id) {
  36. switch (id) {
  37. case klarge_space_disinfection_machine:
  38. return "large_space_disinfection_machine";
  39. case ksmall_space_disinfection_machine:
  40. return "small_space_disinfection_machine";
  41. case kpipe_disinfection_machine:
  42. return "pipe_disinfection_machine";
  43. case kdraw_bar_disinfection_box:
  44. return "draw_bar_disinfection_box";
  45. case kh2o2_ext_sensor:
  46. return "h2o2_ext_sensor";
  47. default:
  48. return "unkown";
  49. }
  50. }
  51. typedef enum {
  52. // 驱动器错误
  53. kerr_motor_reset_error = 100,
  54. kerr_motor_subdevice_offline = 101,
  55. kerr_motor_driver_error = 102,
  56. kerr_motor_undervoltage_error = 103,
  57. kerr_motor_unkown_error = 104,
  58. kerr_AirBlowerError = 200, // 空压机异常
  59. kerr_HeaterError = 201, // 加热片异常
  60. kerr_BlowerError = 202, // 鼓风机异常
  61. kerr_ProportionalValveError = 203, // 气密性测试专用空压机异常
  62. } ErrorCode_t;
  63. typedef enum {
  64. /***********************************************************************************************************************
  65. * *
  66. ***********************************************************************************************************************/
  67. kfn_read_board_info = 1, // cmd:no, ack:ack_read_board_info_data_t
  68. kfn_force_report = 2, // cmd:no, ack:none //!delete
  69. kfn_read_sysinfo = 3, // cmd:no, ack:ack_sysinfo_t
  70. kfn_read_taskinfo = 4, // cmd:taskoff, ack:ask_taskinfo_t
  71. kfn_heart_ping = 5, // cmd:pingindex, ack:ask_taskinfo_t
  72. kfn_clear_reset_flag = 6, // cmd:taskoff, ack:ask_taskinfo_t
  73. kreport_heatpacket_pong = 50, // cmd:no ack:no report:heatpacket_t
  74. kreport_exception_error = 51, // report:error_code,subid
  75. /***********************************************************************************************************************
  76. * *
  77. ***********************************************************************************************************************/
  78. /**
  79. * (id,)
  80. *
  81. *
  82. * TMC参数
  83. * TMC参数
  84. * ihold,irun,idelay
  85. *
  86. */
  87. kfn_pump_rotate = 100, // cmd: index rpm ack:none
  88. kfn_pump_stop = 101, // cmd: index rpm ack:none
  89. kfn_pump_set_ihold_irun_idelay = 102, // cmd: index irun,ihold,idelay ack:none
  90. kfn_pump_set_acc = 104, // cmd: index acc ack:none , delete
  91. kfn_pump_ping = 105, // cmd: index, ack:none
  92. kfn_pump_set_ramp = 106, // cmd: index,vs,a1,amx,v1 ack:none
  93. kfn_pump_set_tzw = 107, // cmd: index,timeZeroWait ack:none
  94. kfn_pump_set_subic_reg = 110, // cmd: index,val ack:none
  95. kfn_pump_get_subic_reg = 111, // cmd: index, ack:val
  96. /***********************************************************************************************************************
  97. * MINI真空泵 *
  98. ***********************************************************************************************************************/
  99. /**
  100. * @brief Spray liquid mini air compressor
  101. * /
  102. */
  103. kfn_sl_mini_ac_ctrl = 200, // cmd: power(0-100)
  104. /***********************************************************************************************************************
  105. * MINI真空泵 *
  106. ***********************************************************************************************************************/
  107. /**
  108. * @brief air Tightness Test AirCompressor
  109. * /
  110. *
  111. */
  112. kfn_atta_mini_air_compressor_ctrl = 300, // cmd: power(0-100)
  113. /***********************************************************************************************************************
  114. * *
  115. ***********************************************************************************************************************/
  116. kfn_psbus_read_data = 400, // cmd:subid ack:pressure(0.1pa)
  117. kfn_psbus_set_report_period_ms = 401, // cmd:period
  118. kfn_psbus_scan = 402, //
  119. kreport_pressure_data = 450, // report:subid pressure(0.1pa)
  120. /***********************************************************************************************************************
  121. * MINI_PWM风机控制 *
  122. ***********************************************************************************************************************/
  123. /**
  124. * @brief
  125. * /
  126. *
  127. *
  128. */
  129. kfn_mini_pwm_blower_ctrl = 500, // cmd: speed(0-100)
  130. kfn_mini_pwm_blower_read_fbcount = 501, // cmd: valve_state
  131. /***********************************************************************************************************************
  132. * *
  133. ***********************************************************************************************************************/
  134. /**
  135. * @brief
  136. * /
  137. *
  138. *
  139. *
  140. *
  141. *
  142. */
  143. kfn_heater_ctrl = 600, // cmd: power(0-100)
  144. kfn_heater_ctrl_safe_valve = 601, // cmd: valve_state
  145. kfn_heater_read_electric_current = 602, // report:electric_current(ma)
  146. kfn_heater_read_temperature_data = 603, // report:temperature(0.01)
  147. /***********************************************************************************************************************
  148. * H2O2传感器数值上报 *
  149. ***********************************************************************************************************************/
  150. kfn_h2o2_sensor_read_calibration_date = 700, // cmd:subid ack:year,month,day
  151. kfn_h2o2_sensor_read_sub_ic_errorcode = 701, // cmd:subid ack:errorcode
  152. kfn_h2o2_sensor_read_sub_ic_reg = 702, // cmd:subid,reg,num ack:errorcode
  153. kreport_h2o2_sensor_data = 750, // report:subid h2o2_sensor_data
  154. /***********************************************************************************************************************
  155. * *
  156. ***********************************************************************************************************************/
  157. kfn_triple_warning_light_ctl = 800, // cmd: r,g,b,warning
  158. /***********************************************************************************************************************
  159. * *
  160. ***********************************************************************************************************************/
  161. kfn_evaporation_tank_water_sensor_read_state = 900, // cmd: state
  162. kfn_device_bottom_water_sensor_read_state = 901, // cmd: state
  163. kreport_evaporation_bin_water_sensor = 950, // report:state //蒸发仓水浸 //report_evaporation_bin_water_sensor_data_t
  164. kreport_device_bottom_water_sensor = 951, // report:state //设备底部水浸 //report_device_bottom_water_sensor_data
  165. /***********************************************************************************************************************
  166. * *
  167. ***********************************************************************************************************************/
  168. kfn_blower_ctrl = 1000, // cmd: power(0-100)
  169. kfn_blower_ctrl_safe_valve = 1001, // cmd: valve_state
  170. kfn_blower_read_electric_current = 1002, // report:electric_current(ma)
  171. /***********************************************************************************************************************
  172. * *
  173. ***********************************************************************************************************************/
  174. kfn_air_compressor_ctrl = 1100, // cmd: power(0-100)
  175. kfn_air_compressor_ctrl_safe_valve = 1101, // cmd: valve_state
  176. kfn_air_compressor_read_electric_current = 1102, // report:electric_current(ma)
  177. #if 0
  178. /***********************************************************************************************************************
  179. * H2O2传感器数值上报 *
  180. ***********************************************************************************************************************/
  181. kreport_h2o2_data = 400, // report:subid h2o2_sensor_data
  182. /***********************************************************************************************************************
  183. * *
  184. ***********************************************************************************************************************/
  185. /**
  186. * @brief
  187. * /
  188. */
  189. kfn_electromagnetic_valve_ctrl = 900, // cmd: valve_state
  190. /***********************************************************************************************************************
  191. * *
  192. ***********************************************************************************************************************/
  193. /**
  194. * @brief
  195. * /
  196. */
  197. kfn_ball_valve_ctrl = 1000, // cmd: valve_state
  198. /***********************************************************************************************************************
  199. * *
  200. ***********************************************************************************************************************/
  201. /**
  202. * @brief
  203. * /
  204. *
  205. */
  206. kfn_proportional_valve_ctrl = 1100, // cmd: subid valve_state(0->100)
  207. kreport_proportional_valve_value = 1150, // cmd: subid valve_state(0->100)
  208. /***********************************************************************************************************************
  209. * *
  210. ***********************************************************************************************************************/
  211. kreport_evaporation_bin_water_sensor = 1200, // report:state //蒸发仓水浸
  212. kreport_device_bottom_water_sensor = 1201, // report:state //设备底部水浸
  213. #endif
  214. } cmd_t;
  215. #pragma pack(1)
  216. /***********************************************************************************************************************
  217. * ACK *
  218. ***********************************************************************************************************************/
  219. typedef struct {
  220. uint16_t boardType;
  221. uint16_t projectId;
  222. uint16_t protcol_version;
  223. uint16_t software_version;
  224. uint16_t hardware_version;
  225. } ack_read_board_info_data_t;
  226. typedef struct {
  227. uint8_t taskName[8];
  228. uint16_t stackRemindSize;
  229. uint16_t priority;
  230. uint8_t state;
  231. } ask_taskinfo_t;
  232. typedef struct {
  233. uint32_t total_heap_size;
  234. uint32_t free_heap_size;
  235. uint16_t taskNum;
  236. uint16_t sysHasRun;
  237. } ack_sysinfo_t;
  238. typedef struct {
  239. uint8_t numOnlineId;
  240. uint8_t onlineId[10];
  241. } ack_psbus_scan_t;
  242. /***********************************************************************************************************************
  243. * Report *
  244. ***********************************************************************************************************************/
  245. typedef struct {
  246. uint16_t heartIndex;
  247. uint8_t boardType;
  248. uint8_t flag; // 0:reset_flag
  249. } report_heatpacket_data_t;
  250. typedef struct {
  251. uint32_t ecode;
  252. uint16_t subid;
  253. } report_exeception_data_t;
  254. #if 1
  255. typedef struct {
  256. uint8_t sensorDataNum;
  257. struct {
  258. uint8_t subid;
  259. int16_t pressureVal;
  260. } data[];
  261. } report_pressure_data_t;
  262. #endif
  263. typedef struct {
  264. uint8_t sensor_error; // 传感器异常
  265. uint16_t h2o2; // ppm * 10
  266. uint16_t humid; // %RH * 10
  267. uint16_t temp; // °C * 10
  268. uint16_t saturation; // %RS * 10
  269. } report_h2o2_data_t;
  270. typedef struct {
  271. uint16_t temperature; // 0.01
  272. } report_heater_temperature_data_t;
  273. typedef struct {
  274. uint16_t subid; // 0->100
  275. uint16_t valve_state; // 0->100
  276. } report_proportional_valve_value_data_t;
  277. typedef struct {
  278. uint16_t state;
  279. } report_water_sensor_state_t;
  280. #pragma pack()
  281. } // namespace transmit_disfection_protocol
  282. } // namespace iflytop