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
139 lines
5.0 KiB
#pragma once
|
|
#include <stdint.h>
|
|
|
|
#define PROTOCOL_VERSION 1
|
|
|
|
extern "C" {
|
|
#pragma pack(1)
|
|
typedef struct {
|
|
uint8_t ptype;
|
|
uint16_t index;
|
|
uint16_t board_id;
|
|
uint16_t function_id;
|
|
uint8_t params[];
|
|
} zcanbus_packet_t;
|
|
|
|
typedef struct {
|
|
zcanbus_packet_t packet;
|
|
uint8_t boardType;
|
|
} heatpacket_t;
|
|
|
|
#pragma pack()
|
|
|
|
typedef enum {
|
|
kcmd,
|
|
kreceipt,
|
|
kerror_receipt,
|
|
kreport,
|
|
kheat, // 心跳
|
|
} packet_type_t;
|
|
|
|
typedef enum {
|
|
kMainBoard = 0, // 主机
|
|
kBoardType_LiquidCtrl = 1, // 液路板
|
|
kBoardType_PowerControl = 2, // 电源板
|
|
kBoardType_ExtBallValveCtrl = 3, // 外部球阀控制板
|
|
kBoardType_H2O2Sensor = 4, // H2O2传感器板
|
|
} BoardType_t;
|
|
|
|
typedef enum {
|
|
klarge_space_disinfection_machine = 1, // 大空间消毒机
|
|
ksmall_space_disinfection_machine = 2, // 小空间消毒机
|
|
kpipe_disinfection_machine = 3, // 管道式消毒机
|
|
kdraw_bar_disinfection_box = 4, // 手持拉杆箱消毒机
|
|
} ProjectID_t;
|
|
|
|
typedef enum {
|
|
kerr_noerror = 0,
|
|
|
|
// 驱动器错误
|
|
kmotor_reset = 100,
|
|
kmotor_unkownError = 100,
|
|
|
|
} ErrorCode_t;
|
|
|
|
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
|
|
|
|
/***********************************************************************************************************************
|
|
* 蠕动泵控制 *
|
|
***********************************************************************************************************************/
|
|
/**
|
|
* 旋转(id,速度)
|
|
* 停止
|
|
*
|
|
* 设置TMC参数
|
|
* 读取TMC参数
|
|
* 设置ihold,irun,idelay
|
|
*
|
|
*/
|
|
kcmd_pump_rotate = 100, // cmd: rpm
|
|
kcmd_pump_stop = 101, // cmd: rpm
|
|
kcmd_pump_set_subic_reg = 102, // cmd: add,val
|
|
kcmd_pump_get_subic_reg = 103, // cmd: add,ack:val
|
|
kcmd_pump_set_irun_ihold = 104, // cmd: irun,ihold,idelay
|
|
|
|
/***********************************************************************************************************************
|
|
* 加热片控制 *
|
|
***********************************************************************************************************************/
|
|
/**
|
|
* @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)
|
|
|
|
/***********************************************************************************************************************
|
|
* 风机控制 *
|
|
***********************************************************************************************************************/
|
|
|
|
/**
|
|
* @brief 风机控制
|
|
* 打开/关闭
|
|
* 电流上报
|
|
*
|
|
*/
|
|
|
|
/***********************************************************************************************************************
|
|
* 报警指示灯控制 *
|
|
***********************************************************************************************************************/
|
|
kcmd_triple_warning_light_ctl = 300, // cmd: r,g,b,warning
|
|
|
|
/***********************************************************************************************************************
|
|
* 压力传感器读取 *
|
|
***********************************************************************************************************************/
|
|
kreport_pressure_data = 400, // report:subid pressure(0.1pa)
|
|
|
|
} cmd_t;
|
|
|
|
#define HEART_OVERTIME_MS (10 * 1000)
|
|
|
|
#pragma pack(1)
|
|
typedef struct {
|
|
zcanbus_packet_t packet;
|
|
uint8_t boardType;
|
|
} heatpacket_report_t;
|
|
|
|
typedef struct {
|
|
zcanbus_packet_t packet;
|
|
uint8_t boardType;
|
|
uint8_t projectId;
|
|
uint16_t protcol_version;
|
|
uint16_t software_version;
|
|
uint16_t hardware_version;
|
|
} read_board_info_ack_t;
|
|
|
|
#pragma pack()
|
|
}
|