Browse Source

update

master
zhaohe 1 year ago
parent
commit
b0a5cf97b5
  1. 204
      iflytop_canbus_protocol.hpp

204
iflytop_canbus_protocol.hpp

@ -6,22 +6,13 @@
extern "C" {
#pragma pack(1)
#define PACKET_HEADER \
uint8_t ptype; \
uint16_t index; \
uint16_t board_id; \
uint16_t function_id;
typedef struct {
PACKET_HEADER
uint8_t params[];
uint8_t ptype;
uint8_t index;
uint16_t function_id;
uint8_t params[];
} zcanbus_packet_t;
typedef struct {
PACKET_HEADER
uint8_t boardType;
} heatpacket_t;
#pragma pack()
typedef enum {
@ -33,11 +24,12 @@ typedef enum {
} packet_type_t;
typedef enum {
kMainBoard = 0, // 主机
kBoardType_LiquidCtrl = 1, // 液路板
kBoardType_PowerControl = 2, // 电源板
kBoardType_ExtBallValveCtrl = 3, // 外部球阀控制板
kBoardType_H2O2Sensor = 4, // H2O2传感器板
kMainBoard = 0, // 主机
kBoardType_LiquidCtrl = 1, // 液路板
kBoardType_PowerControl = 2, // 电源板
kBoardType_PowerControlMiniBoard = 3, // 电源控制Mini板,用于拉杆箱箱消毒机
kBoardType_ExtBallValveCtrl = 4, // 外部球阀控制板
kBoardType_H2O2Sensor = 5, // H2O2传感器板
} BoardType_t;
typedef enum {
@ -51,8 +43,13 @@ typedef enum {
kerr_noerror = 0,
// 驱动器错误
kmotor_reset = 100,
kmotor_unkownError = 100,
kerr_motorReset = 100,
kerr_motorUnkownError = 101,
kerr_AirBlowerError = 200, // 空压机异常
kerr_HeaterError = 201, // 加热片异常
kerr_BlowerError = 202, // 鼓风机异常
kerr_ProportionalValveError = 203, // 气密性测试专用空压机异常
} ErrorCode_t;
@ -61,9 +58,9 @@ typedef enum {
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
kcmd_read_board_info = 1, // cmd:no, ack:read_board_info_ack_t
kreport_heatpacket = 50, // cmd:no ack:no report:heatpacket_t
kreport_error = 51, // report:error_code,subid
kcmd_read_board_info = 1, // cmd:no, ack:read_board_info_ack_t
kreport_heatpacket = 50, // cmd:no ack:no report:heatpacket_t
kreport_exception_error = 51, // report:error_code,subid
/***********************************************************************************************************************
* *
@ -84,60 +81,191 @@ typedef enum {
kcmd_pump_set_irun_ihold = 104, // cmd: irun,ihold,idelay
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
kcmd_triple_warning_light_ctl = 200, // cmd: r,g,b,warning
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
kreport_pressure_data = 300, // report:subid pressure(0.1pa)
/***********************************************************************************************************************
* H2O2传感器数值上报 *
***********************************************************************************************************************/
kreport_h2o2_data = 400, // report:subid h2o2_sensor_data
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
/**
* @brief
* /
*
*
*
*
*
*/
kcmd_heater_ctrl = 200, // cmd: power_state
kcmd_heater_is_support_temperature_sensor = 202, // cmd:no, ack:bool
kreport_heater_temperature_data = 250, // report:temperature(0.01)
kreport_heater_electric_current = 251, // report:electric_current(ma)
kcmd_heater_ctrl = 500, // cmd: power(0-100)
kcmd_heater_ctrl_safe_valve = 501, // cmd: valve_state
kreport_heater_temperature_data = 550, // report:temperature(0.01)
kreport_heater_electric_current = 551, // report:electric_current(ma)
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
/**
* @brief
* /
*
*
*/
kcmd_blower_ctrl = 600, // cmd: power(0-100)
kcmd_blower_ctrl_safe_valve = 601, // cmd: valve_state
kreport_blower_electric_current = 651, // report:electric_current(ma)
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
/**
* @brief airCompressor
* /
*
*
*
*/
kcmd_airCompressor_ctrl = 700, // cmd: power(0-100)
kcmd_airCompressor_ctrl_safe_valve = 701, // cmd: valve_state
kreport_airCompressor_electric_current = 751, // report:electric_current(ma)
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
/**
* @brief air Tightness Test AirCompressor
* /
*
*
*
*/
kcmd_ATTAirCompressor_ctrl = 800, // cmd: power(0-100)
kcmd_ATTAirCompressor_ctrl_safe_valve = 801, // cmd: valve_state
/***********************************************************************************************************************
* *
* *
***********************************************************************************************************************/
/**
* @brief
* /
*/
kcmd_electromagnetic_valve_ctrl = 900, // cmd: valve_state
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
kcmd_triple_warning_light_ctl = 300, // cmd: r,g,b,warning
/**
* @brief
* /
*/
kcmd_ball_valve_ctrl = 1000, // cmd: valve_state
/***********************************************************************************************************************
* *
* *
***********************************************************************************************************************/
kreport_pressure_data = 400, // report:subid pressure(0.1pa)
/**
* @brief
* /
*
*/
kcmd_proportional_valve_ctrl = 1100, // cmd: subid valve_state(0->100)
kreport_proportional_valve_value = 1150, // cmd: subid valve_state(0->100)
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
kreport_evaporation_bin_water_sensor = 1200, // report:state //蒸发仓水浸
kreport_device_bottom_water_sensor = 1201, // report:state //设备底部水浸
} cmd_t;
#define HEART_OVERTIME_MS (10 * 1000)
#pragma pack(1)
typedef struct {
PACKET_HEADER
uint8_t boardType;
} heatpacket_report_t;
/***********************************************************************************************************************
* ACK *
***********************************************************************************************************************/
typedef struct {
PACKET_HEADER
uint8_t boardType;
uint8_t projectId;
uint16_t protcol_version;
uint16_t software_version;
uint16_t hardware_version;
} read_board_info_ack_t;
} ack_read_board_info_data_t;
/***********************************************************************************************************************
* Report *
***********************************************************************************************************************/
typedef struct {
uint16_t boardType;
} report_heatpacket_data_t;
typedef struct {
uint16_t subid;
uint32_t ecode;
} report_exeception_data_t;
typedef struct {
uint16_t subid;
uint32_t pressure;
} report_pressure_data_t;
typedef struct {
uint16_t subid;
uint16_t h2o2; // ppm
uint16_t humid; // %RH * 100
uint16_t temp; // °C * 100
uint16_t saturation; // %RS * 100
} report_h2o2_data_t;
typedef struct {
uint16_t temperature; // 0.01
} report_heater_temperature_data_t;
typedef struct {
uint16_t electric_current; // ma
} report_heater_electric_current_data_t;
typedef struct {
uint16_t electric_current; // ma
} report_blower_electric_current_data_t;
typedef struct {
uint16_t electric_current; // ma
} report_airCompressor_electric_current_data_t;
typedef struct {
uint16_t subid; // 0->100
uint16_t valve_state; // 0->100
} report_proportional_valve_value_data_t;
typedef struct {
uint16_t state;
} report_evaporation_bin_water_sensor_data_t;
typedef struct {
uint16_t state;
} report_device_bottom_water_sensor_data_t;
#pragma pack()
}
Loading…
Cancel
Save