commit
fe4173bbfe
2 changed files with 372 additions and 0 deletions
@ -0,0 +1,372 @@ |
|||
#pragma once
|
|||
#include <stdint.h>
|
|||
#include "zscanprotocol/zscanprotocol.hpp"
|
|||
|
|||
#define PROTOCOL_VERSION 6
|
|||
#define HEART_OVERTIME (30 * 1000)
|
|||
|
|||
typedef enum { |
|||
klarge_space_disinfection_machine = 1, // 大空间消毒机
|
|||
ksmall_space_disinfection_machine = 2, // 小空间消毒机
|
|||
kpipe_disinfection_machine = 3, // 管道式消毒机
|
|||
kdraw_bar_disinfection_box = 4, // 手持拉杆箱消毒机
|
|||
kh2o2_ext_sensor = 5, // 外部H2O2传感器
|
|||
} ProjID_t; |
|||
|
|||
typedef enum { |
|||
kBoardType_LiquidCtrl = 1, // 液路板
|
|||
kBoardType_PowerControl = 2, // 电源板
|
|||
kBoardType_PowerControlMiniBoard = 3, // 电源控制Mini板,用于拉杆箱箱消毒机
|
|||
kBoardType_ExtBallValveCtrl = 4, // 外部球阀控制板
|
|||
kBoardType_H2O2Sensor = 5, // H2O2传感器板
|
|||
} BoardType_t; |
|||
|
|||
typedef enum { |
|||
kFixBoardId_MainBoard = 1, // 主机
|
|||
kFixBoardId_LiquidCtrl = 2, // 液路板
|
|||
kFixBoardId_PowerControl = 3, // 电源板
|
|||
kFixBoardId_ExtBallValveCtrl = 4, // 外部球阀控制板
|
|||
kFixBoardId_H2O2SensorStart = 100, // H2O2传感器板
|
|||
} BoardId_t; |
|||
|
|||
static inline const char *BoardTypeToString(uint32_t type) { |
|||
switch (type) { |
|||
case kBoardType_LiquidCtrl: |
|||
return "LiquidCtrl"; |
|||
case kBoardType_PowerControl: |
|||
return "PowerControl"; |
|||
case kBoardType_PowerControlMiniBoard: |
|||
return "PowerControlMiniBoard"; |
|||
case kBoardType_ExtBallValveCtrl: |
|||
return "ExtBallValveCtrl"; |
|||
case kBoardType_H2O2Sensor: |
|||
return "H2O2Sensor"; |
|||
default: |
|||
return "unkown"; |
|||
} |
|||
} |
|||
|
|||
static inline const char *ProjectIDToString(uint32_t id) { |
|||
switch (id) { |
|||
case klarge_space_disinfection_machine: |
|||
return "large_space_disinfection_machine"; |
|||
case ksmall_space_disinfection_machine: |
|||
return "small_space_disinfection_machine"; |
|||
case kpipe_disinfection_machine: |
|||
return "pipe_disinfection_machine"; |
|||
case kdraw_bar_disinfection_box: |
|||
return "draw_bar_disinfection_box"; |
|||
case kh2o2_ext_sensor: |
|||
return "h2o2_ext_sensor"; |
|||
default: |
|||
return "unkown"; |
|||
} |
|||
} |
|||
|
|||
typedef enum { |
|||
kerr_noerror = 0, |
|||
kerr_overtime = 1, |
|||
kerr_invalid_param = 2, |
|||
kerr_invalid_param_num = 3, |
|||
kerr_subdevice_offline = 4, |
|||
kerr_function_not_support = 5, |
|||
|
|||
// 驱动器错误
|
|||
kerr_motor_reset_error = 100, |
|||
kerr_motor_subdevice_offline = 101, |
|||
kerr_motor_driver_error = 102, |
|||
kerr_motor_undervoltage_error = 103, |
|||
kerr_motor_unkown_error = 104, |
|||
|
|||
kerr_AirBlowerError = 200, // 空压机异常
|
|||
kerr_HeaterError = 201, // 加热片异常
|
|||
kerr_BlowerError = 202, // 鼓风机异常
|
|||
kerr_ProportionalValveError = 203, // 气密性测试专用空压机异常
|
|||
|
|||
} ErrorCode_t; |
|||
|
|||
static inline const char *ErrorCodeToString(uint32_t code) { |
|||
switch (code) { |
|||
case kerr_noerror: |
|||
return "noerror"; |
|||
case kerr_overtime: |
|||
return "overtime"; |
|||
case kerr_invalid_param: |
|||
return "invalid_param"; |
|||
case kerr_invalid_param_num: |
|||
return "invalid_param_num"; |
|||
case kerr_subdevice_offline: |
|||
return "subdevice_offline"; |
|||
case kerr_function_not_support: |
|||
return "function_not_support"; |
|||
|
|||
case kerr_motor_reset_error: |
|||
return "motor_reset_error"; |
|||
case kerr_motor_subdevice_offline: |
|||
return "motor_subdevice_offline"; |
|||
case kerr_motor_driver_error: |
|||
return "motor_driver_error"; |
|||
case kerr_motor_undervoltage_error: |
|||
return "motor_undervoltage_error"; |
|||
case kerr_AirBlowerError: |
|||
return "AirBlowerError"; |
|||
case kerr_HeaterError: |
|||
return "HeaterError"; |
|||
case kerr_BlowerError: |
|||
return "BlowerError"; |
|||
case kerr_ProportionalValveError: |
|||
return "ProportionalValveError"; |
|||
default: |
|||
return "unkown"; |
|||
} |
|||
} |
|||
typedef enum { |
|||
|
|||
/***********************************************************************************************************************
|
|||
* 板子基本操作 * |
|||
***********************************************************************************************************************/ |
|||
kfn_read_board_info = 1, // cmd:no, ack:ack_read_board_info_data_t
|
|||
kfn_force_report = 2, // cmd:no, ack:none //!delete
|
|||
kfn_read_sysinfo = 3, // cmd:no, ack:ack_sysinfo_t
|
|||
kfn_read_taskinfo = 4, // cmd:taskoff, ack:ask_taskinfo_t
|
|||
kfn_heart_ping = 5, // cmd:pingindex, ack:ask_taskinfo_t
|
|||
kfn_clear_reset_flag = 6, // cmd:taskoff, ack:ask_taskinfo_t
|
|||
kreport_heatpacket_pong = 50, // cmd:no ack:no report:heatpacket_t
|
|||
kreport_exception_error = 51, // report:error_code,subid
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 蠕动泵控制 * |
|||
***********************************************************************************************************************/ |
|||
/**
|
|||
* 旋转(id,速度) |
|||
* 停止 |
|||
* |
|||
* 设置TMC参数 |
|||
* 读取TMC参数 |
|||
* 设置ihold,irun,idelay |
|||
* |
|||
*/ |
|||
kfn_pump_rotate = 100, // cmd: index rpm ack:none
|
|||
kfn_pump_stop = 101, // cmd: index rpm ack:none
|
|||
kfn_pump_set_ihold_irun_idelay = 102, // cmd: index irun,ihold,idelay ack:none
|
|||
kfn_pump_set_acc = 104, // cmd: index acc ack:none
|
|||
kfn_pump_ping = 105, // cmd: index, ack:none
|
|||
|
|||
kfn_pump_set_subic_reg = 110, // cmd: index,val ack:none
|
|||
kfn_pump_get_subic_reg = 111, // cmd: index, ack:val
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 喷液MINI真空泵 * |
|||
***********************************************************************************************************************/ |
|||
/**
|
|||
* @brief Spray liquid mini air compressor |
|||
* 打开/关闭 |
|||
*/ |
|||
kfn_sl_mini_ac_ctrl = 200, // cmd: power(0-100)
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 气密性测试MINI真空泵 * |
|||
***********************************************************************************************************************/ |
|||
/**
|
|||
* @brief air Tightness Test AirCompressor |
|||
* 打开/关闭 |
|||
* 电流上报 |
|||
*/ |
|||
kfn_atta_mini_air_compressor_ctrl = 300, // cmd: power(0-100)
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 压力传感器数据上报 * |
|||
***********************************************************************************************************************/ |
|||
kfn_pressure_sensor_bus_read_data = 400, // cmd:subid ack:pressure(0.1pa)
|
|||
kfn_pressure_sensor_bus_set_report_period_ms = 401, // cmd:period
|
|||
kreport_pressure_data = 450, // report:subid pressure(0.1pa)
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* MINI_PWM风机控制 * |
|||
***********************************************************************************************************************/ |
|||
/**
|
|||
* @brief 风机控制 |
|||
* 打开/关闭 |
|||
* 安全继电器控制 |
|||
* 电流上报 |
|||
*/ |
|||
kfn_mini_pwm_blower_ctrl = 500, // cmd: speed(0-100)
|
|||
kfn_mini_pwm_blower_read_fbcount = 501, // cmd: valve_state
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 加热片控制 * |
|||
***********************************************************************************************************************/ |
|||
/**
|
|||
* @brief 加热片控制 |
|||
* 打开/关闭 |
|||
* 安全继电器控制 |
|||
* 是否支持读取温度 |
|||
* |
|||
* 电流上报 |
|||
* 温度上报 |
|||
*/ |
|||
kfn_heater_ctrl = 600, // cmd: power(0-100)
|
|||
kfn_heater_ctrl_safe_valve = 601, // cmd: valve_state
|
|||
kfn_heater_read_electric_current = 602, // report:electric_current(ma)
|
|||
kfn_heater_read_temperature_data = 603, // report:temperature(0.01)
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* H2O2传感器数值上报 * |
|||
***********************************************************************************************************************/ |
|||
kfn_h2o2_sensor_read_calibration_date = 700, // cmd:subid ack:year,month,day
|
|||
kfn_h2o2_sensor_read_sub_ic_errorcode = 701, // cmd:subid ack:errorcode
|
|||
kfn_h2o2_sensor_read_sub_ic_reg = 702, // cmd:subid,reg,num ack:errorcode
|
|||
kreport_h2o2_sensor_data = 750, // report:subid h2o2_sensor_data
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 报警指示灯控制 * |
|||
***********************************************************************************************************************/ |
|||
kfn_triple_warning_light_ctl = 800, // cmd: r,g,b,warning
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 水浸传感器 * |
|||
***********************************************************************************************************************/ |
|||
|
|||
kfn_evaporation_bin_water_sensor_read_state = 900, // cmd: state
|
|||
kfn_device_bottom_water_sensor_read_state = 901, // cmd: state
|
|||
kreport_evaporation_bin_water_sensor = 950, // report:state //蒸发仓水浸 //report_evaporation_bin_water_sensor_data_t
|
|||
kreport_device_bottom_water_sensor = 951, // report:state //设备底部水浸 //report_device_bottom_water_sensor_data
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 鼓风机控制 * |
|||
***********************************************************************************************************************/ |
|||
kfn_blower_ctrl = 1000, // cmd: power(0-100)
|
|||
kfn_blower_ctrl_safe_valve = 1001, // cmd: valve_state
|
|||
kfn_blower_read_electric_current = 1002, // report:electric_current(ma)
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 空压机 * |
|||
***********************************************************************************************************************/ |
|||
kfn_air_compressor_ctrl = 1100, // cmd: power(0-100)
|
|||
kfn_air_compressor_ctrl_safe_valve = 1101, // cmd: valve_state
|
|||
kfn_air_compressor_read_electric_current = 1102, // report:electric_current(ma)
|
|||
|
|||
#if 0
|
|||
/***********************************************************************************************************************
|
|||
* H2O2传感器数值上报 * |
|||
***********************************************************************************************************************/ |
|||
kreport_h2o2_data = 400, // report:subid h2o2_sensor_data
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 电磁阀控制 * |
|||
***********************************************************************************************************************/ |
|||
|
|||
/**
|
|||
* @brief 电磁阀控制 |
|||
* 打开/关闭 |
|||
*/ |
|||
kfn_electromagnetic_valve_ctrl = 900, // cmd: valve_state
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 球阀控制 * |
|||
***********************************************************************************************************************/ |
|||
|
|||
/**
|
|||
* @brief 电磁阀控制 |
|||
* 打开/关闭 |
|||
*/ |
|||
kfn_ball_valve_ctrl = 1000, // cmd: valve_state
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* 比例阀控制 * |
|||
***********************************************************************************************************************/ |
|||
|
|||
/**
|
|||
* @brief 比例阀控制 |
|||
* 打开/关闭 |
|||
* 比例阀当前比例上报 |
|||
*/ |
|||
|
|||
kfn_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 //设备底部水浸
|
|||
|
|||
#endif
|
|||
|
|||
} cmd_t; |
|||
|
|||
#pragma pack(1)
|
|||
|
|||
/***********************************************************************************************************************
|
|||
* ACK * |
|||
***********************************************************************************************************************/ |
|||
typedef struct { |
|||
uint16_t boardType; |
|||
uint16_t projectId; |
|||
uint16_t protcol_version; |
|||
uint16_t software_version; |
|||
uint16_t hardware_version; |
|||
} ack_read_board_info_data_t; |
|||
|
|||
typedef struct { |
|||
uint8_t taskName[8]; |
|||
uint16_t stackRemindSize; |
|||
uint16_t priority; |
|||
uint8_t state; |
|||
} ask_taskinfo_t; |
|||
|
|||
typedef struct { |
|||
uint32_t total_heap_size; |
|||
uint32_t free_heap_size; |
|||
uint16_t taskNum; |
|||
uint16_t sysHasRun; |
|||
} ack_sysinfo_t; |
|||
|
|||
/***********************************************************************************************************************
|
|||
* Report * |
|||
***********************************************************************************************************************/ |
|||
|
|||
typedef struct { |
|||
uint16_t heartIndex; |
|||
uint8_t boardType; |
|||
uint8_t flag; // 0:reset_flag
|
|||
} report_heatpacket_data_t; |
|||
|
|||
typedef struct { |
|||
uint32_t ecode; |
|||
uint16_t subid; |
|||
} report_exeception_data_t; |
|||
|
|||
#if 1
|
|||
typedef struct { |
|||
uint8_t sensorDataNum; |
|||
struct { |
|||
uint8_t subid; |
|||
int16_t pressureVal; |
|||
} data[]; |
|||
} report_pressure_data_t; |
|||
#endif
|
|||
|
|||
typedef struct { |
|||
uint8_t sensor_error; // 传感器异常
|
|||
uint16_t h2o2; // ppm * 10
|
|||
uint16_t humid; // %RH * 10
|
|||
uint16_t temp; // °C * 10
|
|||
uint16_t saturation; // %RS * 10
|
|||
} report_h2o2_data_t; |
|||
|
|||
typedef struct { |
|||
uint16_t temperature; // 0.01
|
|||
} report_heater_temperature_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_water_sensor_state_t; |
|||
|
|||
#pragma pack()
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue