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.

139 lines
5.0 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. #define PROTOCOL_VERSION 1
  4. extern "C" {
  5. #pragma pack(1)
  6. typedef struct {
  7. uint8_t ptype;
  8. uint16_t index;
  9. uint16_t board_id;
  10. uint16_t function_id;
  11. uint8_t params[];
  12. } zcanbus_packet_t;
  13. typedef struct {
  14. zcanbus_packet_t packet;
  15. uint8_t boardType;
  16. } heatpacket_t;
  17. #pragma pack()
  18. typedef enum {
  19. kcmd,
  20. kreceipt,
  21. kerror_receipt,
  22. kreport,
  23. kheat, // 心跳
  24. } packet_type_t;
  25. typedef enum {
  26. kMainBoard = 0, // 主机
  27. kBoardType_LiquidCtrl = 1, // 液路板
  28. kBoardType_PowerControl = 2, // 电源板
  29. kBoardType_ExtBallValveCtrl = 3, // 外部球阀控制板
  30. kBoardType_H2O2Sensor = 4, // H2O2传感器板
  31. } BoardType_t;
  32. typedef enum {
  33. klarge_space_disinfection_machine = 1, // 大空间消毒机
  34. ksmall_space_disinfection_machine = 2, // 小空间消毒机
  35. kpipe_disinfection_machine = 3, // 管道式消毒机
  36. kdraw_bar_disinfection_box = 4, // 手持拉杆箱消毒机
  37. } ProjectID_t;
  38. typedef enum {
  39. kerr_noerror = 0,
  40. // 驱动器错误
  41. kmotor_reset = 100,
  42. kmotor_unkownError = 100,
  43. } ErrorCode_t;
  44. typedef enum {
  45. /***********************************************************************************************************************
  46. * *
  47. ***********************************************************************************************************************/
  48. kcmd_read_board_info = 1, // cmd:no, ack:read_board_info_ack_t
  49. kreport_heatpacket = 50, // cmd:no ack:no report:heatpacket_t
  50. kreport_error = 51, // report:error_code,subid
  51. /***********************************************************************************************************************
  52. * *
  53. ***********************************************************************************************************************/
  54. /**
  55. * (id,)
  56. *
  57. *
  58. * TMC参数
  59. * TMC参数
  60. * ihold,irun,idelay
  61. *
  62. */
  63. kcmd_pump_rotate = 100, // cmd: rpm
  64. kcmd_pump_stop = 101, // cmd: rpm
  65. kcmd_pump_set_subic_reg = 102, // cmd: add,val
  66. kcmd_pump_get_subic_reg = 103, // cmd: add,ack:val
  67. kcmd_pump_set_irun_ihold = 104, // cmd: irun,ihold,idelay
  68. /***********************************************************************************************************************
  69. * *
  70. ***********************************************************************************************************************/
  71. /**
  72. * @brief
  73. * /
  74. *
  75. *
  76. *
  77. *
  78. */
  79. kcmd_heater_ctrl = 200, // cmd: power_state
  80. kcmd_heater_is_support_temperature_sensor = 202, // cmd:no, ack:bool
  81. kreport_heater_temperature_data = 250, // report:temperature(0.01)
  82. kreport_heater_electric_current = 251, // report:electric_current(ma)
  83. /***********************************************************************************************************************
  84. * *
  85. ***********************************************************************************************************************/
  86. /**
  87. * @brief
  88. * /
  89. *
  90. *
  91. */
  92. /***********************************************************************************************************************
  93. * *
  94. ***********************************************************************************************************************/
  95. kcmd_triple_warning_light_ctl = 300, // cmd: r,g,b,warning
  96. /***********************************************************************************************************************
  97. * *
  98. ***********************************************************************************************************************/
  99. kreport_pressure_data = 400, // report:subid pressure(0.1pa)
  100. } cmd_t;
  101. #define HEART_OVERTIME_MS (10 * 1000)
  102. #pragma pack(1)
  103. typedef struct {
  104. zcanbus_packet_t packet;
  105. uint8_t boardType;
  106. } heatpacket_report_t;
  107. typedef struct {
  108. zcanbus_packet_t packet;
  109. uint8_t boardType;
  110. uint8_t projectId;
  111. uint16_t protcol_version;
  112. uint16_t software_version;
  113. uint16_t hardware_version;
  114. } read_board_info_ack_t;
  115. #pragma pack()
  116. }