5 changed files with 0 additions and 668 deletions
-
49api/i_motor_laser_code_scanner.hpp
-
64api/i_pipette_module.hpp
-
114api/i_step_motor_ctrl_module.hpp
-
357zcancmder_protocol.hpp
-
84zcancmder_protocol_basic.hpp
@ -1,49 +0,0 @@ |
|||
#pragma once
|
|||
#include "basic_type.hpp"
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
|
|||
class I_MotorLaserCodeScanner { |
|||
public: |
|||
#pragma pack(push, 1)
|
|||
typedef struct { |
|||
int32_t each_scan_result_len; |
|||
int32_t scan_reult_nums; |
|||
uint8_t scan_result[]; |
|||
} scan_result_t; |
|||
#pragma pack(pop)
|
|||
|
|||
public: |
|||
/**
|
|||
* @brief 启动扫码 |
|||
* |
|||
* @param moveby_distance 移动距离 |
|||
* @param scan_interval_distance 每次扫描间隔距离 |
|||
* @param each_sample_times 每次采样次数 |
|||
* @param transmitting_tube_amplification 发光管放大倍数 |
|||
* @param receiving_tube_amplification 接收管放大倍数 |
|||
*/ |
|||
virtual int32_t start_scan(s32 moveby_distance, //
|
|||
s32 scan_interval_distance, //
|
|||
s32 each_sample_times, //
|
|||
s32 transmitting_tube_amplification, //
|
|||
s32 receiving_tube_amplification, //
|
|||
action_cb_status_t cb) = 0; |
|||
/**
|
|||
* @brief 停止扫码 |
|||
* |
|||
* @return int32_t |
|||
*/ |
|||
virtual int32_t stop_scan() = 0; |
|||
/**
|
|||
* @brief 获取扫码结果 |
|||
* |
|||
* @param result |
|||
* @return int32_t |
|||
*/ |
|||
virtual int32_t get_scan_result(u16 sector_index, u16 sector_size, zcancmder_read_ram_ack_t& ack) = 0; |
|||
|
|||
virtual ~I_MotorLaserCodeScanner() {} |
|||
}; |
|||
|
|||
} // namespace iflytop
|
@ -1,64 +0,0 @@ |
|||
|
|||
#pragma once
|
|||
#include <stdint.h>
|
|||
|
|||
#include <functional>
|
|||
|
|||
#include "basic_type.hpp"
|
|||
#include "i_step_motor_ctrl_module.hpp"
|
|||
//
|
|||
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
class I_PipetteModule { |
|||
public: |
|||
#pragma pack(1)
|
|||
|
|||
ZSTRUCT(base_param_t, s16 pad;); |
|||
|
|||
typedef struct { |
|||
u8 status; // 模块状态
|
|||
u8 pipette_gun_status; // 移液枪状态
|
|||
u8 io_state; // IO0:z_zero_io
|
|||
u8 has_tip; // 是否有tip
|
|||
s16 zpos_mm; // z轴位置,如果有tip,则自动加上tip高度
|
|||
s16 pipette_ul; // 移液枪液量
|
|||
} status_t; |
|||
|
|||
#pragma pack()
|
|||
|
|||
// ZSTRUCT(action_cb_status_t, u8 exec_status;);
|
|||
|
|||
virtual int32_t enable(u8 enable) = 0; |
|||
virtual int32_t stop(u8 stop_type) = 0; |
|||
|
|||
virtual int32_t zero_pos_calibrate(action_cb_status_t status_cb) = 0; |
|||
// virtual int32_t reset_device(action_cb_status_t status_cb) = 0;
|
|||
|
|||
virtual int32_t zmotor_reset(action_cb_status_t status_cb) = 0; |
|||
virtual int32_t pipette_reset(action_cb_status_t status_cb) = 0; |
|||
|
|||
virtual int32_t take_tip(s16 vel, s16 height_mm, s16 tip_hight_mm, action_cb_status_t status_cb) = 0; |
|||
virtual int32_t remove_tip(s16 vel, s16 height_mm, action_cb_status_t status_cb) = 0; |
|||
|
|||
virtual int32_t move_to(s16 vel, s16 height_mm, action_cb_status_t status_cb) = 0; |
|||
virtual int32_t move_to_with_lld(s16 vel, s16 lld_cap_thr, s16 lld_max_hight_mm, s16 lld_rela_hight_mm, action_cb_status_t status_cb) = 0; |
|||
virtual int32_t shake(s16 shake_times, s16 shake_volume, action_cb_status_t status_cb) = 0; |
|||
virtual int32_t pipette_move_to_ul(s16 take_volume_mm, action_cb_status_t status_cb) = 0; |
|||
|
|||
/*******************************************************************************
|
|||
* ReadStatus * |
|||
*******************************************************************************/ |
|||
virtual int32_t get_status(status_t &status) = 0; |
|||
|
|||
/*******************************************************************************
|
|||
* SETTING * |
|||
*******************************************************************************/ |
|||
virtual int32_t set_z_motor_para(const I_StepMotorCtrlModule::base_param_t &z_motor_param) = 0; |
|||
virtual int32_t get_z_motor_para(I_StepMotorCtrlModule::base_param_t &z_motor_param) = 0; |
|||
virtual int32_t set_base_param(const base_param_t &base_param) = 0; |
|||
virtual int32_t get_base_param(base_param_t &base_param) = 0; |
|||
|
|||
virtual ~I_PipetteModule() {} |
|||
}; |
|||
} // namespace iflytop
|
@ -1,357 +0,0 @@ |
|||
#pragma once
|
|||
#include <stdint.h>
|
|||
#if 0
|
|||
|
|||
#include "api/basic_type.hpp"
|
|||
#include "api/i_eeprom.hpp"
|
|||
#include "api/i_mini_servo_module.hpp"
|
|||
#include "api/i_pipette_module.hpp"
|
|||
#include "api/i_step_motor_ctrl_module.hpp"
|
|||
#include "api/i_xyrobot_ctrl_module.hpp"
|
|||
#include "zcancmder_protocol_basic.hpp"
|
|||
namespace iflytop { |
|||
namespace zcr { |
|||
|
|||
typedef enum { |
|||
kcmd_ping = CMDID(0, 0), |
|||
kcmd_read_io = CMDID(1, 0), |
|||
kcmd_set_io = CMDID(2, 0), |
|||
kcmd_readadc_raw = CMDID(3, 0), |
|||
|
|||
kcmd_m211887_operation = CMDID(1000, 0), // 维萨拉臭氧传感器
|
|||
kcmd_read_presure_sensor = CMDID(1001, 0), // 压力传感器
|
|||
kcmd_triple_warning_light_ctl = CMDID(1002, 0), // 三色警示灯控制
|
|||
kcmd_high_power_electrical_ctl = CMDID(1003, 0), // 大功率电源控制
|
|||
kcmd_peristaltic_pump_ctl = CMDID(1004, 0), // 液泵控制
|
|||
kcmd_read_huacheng_pressure_sensor = CMDID(1005, 0), // 华诚压力传感器
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1006:XYRobot机器人控制模组 * |
|||
*******************************************************************************/ |
|||
kcmd_xy_robot_ctrl_enable = CMDID(1006, 0), // 机器人使能
|
|||
kcmd_xy_robot_ctrl_stop = CMDID(1006, 1), // 机器人停止
|
|||
kcmd_xy_robot_ctrl_move_to_zero = CMDID(1006, 2), // 机器人回零
|
|||
kcmd_xy_robot_ctrl_move_to_zero_with_calibrate = CMDID(1006, 3), // 机器人回零并标定
|
|||
kcmd_xy_robot_ctrl_move_to = CMDID(1006, 4), // 机器人移动到指定位置
|
|||
kcmd_xy_robot_ctrl_move_by = CMDID(1006, 5), // 机器人移动指定距离
|
|||
kcmd_xy_robot_ctrl_force_change_current_pos = CMDID(1006, 6), // 强制修改当前位置
|
|||
kcmd_xy_robot_ctrl_move_by_no_limit = CMDID(1006, 7), // 机器人相对移动,没有限制
|
|||
// kcmd_xy_robot_ctrl_read_pos_by_move2zero = CMDID(1006, 8), // 机器人先执行归零动作,然后读取位置偏差,计算出来时候的坐标,然后再移动回一开始的位置。
|
|||
|
|||
kcmd_xy_robot_ctrl_read_version = CMDID(1006, 50), // 读取模块型号版本信息
|
|||
kcmd_xy_robot_ctrl_read_status = CMDID(1006, 51), // 读取模块精简状态信息
|
|||
kcmd_xy_robot_ctrl_read_detailed_status = CMDID(1006, 52), // 读取模块详细状态信息
|
|||
// kcmd_xy_robot_ctrl_read_read_pos_by_move2zero_exec_state = CMDID(1006, 53), // 机器人先执行归零动作,然后读取位置偏差,计算出来时候的坐标,然后再移动回一开始的位置。
|
|||
|
|||
kcmd_xy_robot_ctrl_set_base_param = CMDID(1006, 100), // 设置运行参数
|
|||
kcmd_xy_robot_ctrl_get_base_param = CMDID(1006, 101), // 设置运行参数
|
|||
kcmd_xy_robot_ctrl_flush = CMDID(1006, 110), // 存储参数到flash中
|
|||
kcmd_xy_robot_ctrl_factory_reset = CMDID(1006, 111), // 恢复出厂设置
|
|||
// kcmd_xy_robot_ctrl_set_warning_limit_param = CMDID(1006, 101), // 设置控制限制参数
|
|||
// kcmd_xy_robot_ctrl_set_run_to_zero_param = CMDID(1006, 102), // 设置归零参数
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1007:步进电机控制模组 * |
|||
*******************************************************************************/ |
|||
kcmd_step_motor_ctrl_enable = CMDID(1007, 0), // 使能
|
|||
kcmd_step_motor_ctrl_stop = CMDID(1007, 1), // 停止
|
|||
kcmd_step_motor_ctrl_move_to_zero = CMDID(1007, 2), // 回零
|
|||
kcmd_step_motor_ctrl_move_to_zero_with_calibrate = CMDID(1007, 3), // 回零并校准
|
|||
kcmd_step_motor_ctrl_move_to = CMDID(1007, 4), // 移动到
|
|||
kcmd_step_motor_ctrl_move_by = CMDID(1007, 5), // 相对移动
|
|||
kcmd_step_motor_ctrl_force_change_current_pos = CMDID(1007, 6), // 相对移动
|
|||
kcmd_step_motor_ctrl_rotate = CMDID(1007, 7), // 相对移动
|
|||
kcmd_step_motor_ctrl_move_to_logic_point = CMDID(1007, 8), // 移动到逻辑点
|
|||
|
|||
kcmd_step_motor_ctrl_read_version = CMDID(1007, 50), // 读取模块型号版本信息
|
|||
kcmd_step_motor_ctrl_read_status = CMDID(1007, 51), // 读取模块精简状态信息
|
|||
kcmd_step_motor_ctrl_read_detailed_status = CMDID(1007, 52), // 读取模块详细状态信息
|
|||
|
|||
kcmd_step_motor_ctrl_set_base_param = CMDID(1007, 100), // 设置运行参数
|
|||
kcmd_step_motor_ctrl_get_base_param = CMDID(1007, 101), // 设置运行参数
|
|||
kcmd_step_motor_ctrl_set_logic_point = CMDID(1007, 102), // 设置逻辑点
|
|||
kcmd_step_motor_ctrl_get_logic_point = CMDID(1007, 103), // 读取逻辑点
|
|||
kcmd_step_motor_ctrl_flush = CMDID(1007, 110), // 存储参数到flash中
|
|||
kcmd_step_motor_ctrl_factory_reset = CMDID(1007, 111), // 恢复出厂设置
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1008:舵机 * |
|||
*******************************************************************************/ |
|||
kcmd_mini_servo_ctrl_enable = CMDID(1008, 0), // 使能
|
|||
kcmd_mini_servo_ctrl_stop = CMDID(1008, 1), // 停止
|
|||
kcmd_mini_servo_ctrl_position_calibrate = CMDID(1008, 2), // 校准
|
|||
kcmd_mini_servo_ctrl_rotate = CMDID(1008, 3), // 速度模式
|
|||
kcmd_mini_servo_ctrl_move_to = CMDID(1008, 4), // 位置模式舵机
|
|||
kcmd_mini_servo_ctrl_move_by = CMDID(1008, 5), // 位置模式舵机
|
|||
kcmd_mini_servo_ctrl_run_with_torque = CMDID(1008, 6), // 开环扭矩模式
|
|||
kcmd_mini_servo_ctrl_move_by_nolimit = CMDID(1008, 7), // 相对移动,位置模式无限制,移动不受最大位置和最小位置限制,但无法读取到当前位置
|
|||
|
|||
kcmd_mini_servo_ctrl_read_version = CMDID(1008, 50), // 读取模块型号版本信息
|
|||
kcmd_mini_servo_ctrl_read_status = CMDID(1008, 51), // 读取模块精简状态信息
|
|||
kcmd_mini_servo_ctrl_read_detailed_status = CMDID(1008, 52), // 读取模块详细状态信息
|
|||
|
|||
kcmd_mini_servo_ctrl_set_run_param = CMDID(1008, 100), |
|||
kcmd_mini_servo_ctrl_get_run_param = CMDID(1008, 101), |
|||
kcmd_mini_servo_ctrl_set_warning_limit_param = CMDID(1008, 102), |
|||
kcmd_mini_servo_ctrl_get_warning_limit_param = CMDID(1008, 103), |
|||
kcmd_mini_servo_ctrl_set_basic_param = CMDID(1008, 104), |
|||
kcmd_mini_servo_ctrl_get_basic_param = CMDID(1008, 105), |
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1009:EEPROM * |
|||
*******************************************************************************/ |
|||
kcmd_eeprom_start_monitor_status = CMDID(1009, 0), // 监控EEPROM状态
|
|||
kcmd_eeprom_stop_monitor_status = CMDID(1009, 1), // 停止监控EEPROM状态
|
|||
kcmd_eeprom_read_block = CMDID(1009, 2), // 读取EEPROM
|
|||
kcmd_eeprom_write_block = CMDID(1009, 3), // 写入EEPROM
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1010:扫码器 * |
|||
*******************************************************************************/ |
|||
kcmd_barcode_reader_start_scan = CMDID(1010, 0), // 读取扫码器
|
|||
kcmd_barcode_reader_stop_scan = CMDID(1010, 1), // 停止读取扫码器
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1011:帕尔贴-水泵-风扇控温系统 * |
|||
*******************************************************************************/ |
|||
// 设置目标温度
|
|||
kcmd_heater_ctrl_module_start_ctrl_temperature = CMDID(1011, 0), // 设置目标温度
|
|||
kcmd_heater_ctrl_module_stop_temperature = CMDID(1011, 1), // 读取停止温度
|
|||
|
|||
kcmd_heater_ctrl_module_read_status = CMDID(1011, 50), // 读取模块精简状态信息
|
|||
kcmd_heater_ctrl_module_read_detail_status = CMDID(1011, 50), // 读取模块精简状态信息
|
|||
|
|||
kcmd_heater_ctrl_module_set_base_param = CMDID(1011, 100), // 设置运行参数
|
|||
kcmd_heater_ctrl_module_get_base_param = CMDID(1011, 101), // 设置限制参数
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1012:电机激光扫码器 * |
|||
*******************************************************************************/ |
|||
kcmd_motor_laser_code_scanner_scan = CMDID(1012, 1), // 开始扫码
|
|||
kcmd_motor_laser_code_scanner_stop_scan = CMDID(1012, 2), // 停止扫码
|
|||
kcmd_motor_laser_code_scanner_get_scan_result = CMDID(1012, 3), // 获取扫码结果
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1013:板夹仓 * |
|||
*******************************************************************************/ |
|||
|
|||
// 风扇
|
|||
/*******************************************************************************
|
|||
* |Module_1014:风扇 * |
|||
*******************************************************************************/ |
|||
kcmd_fan_module_fan_ctrl = CMDID(1014, 0), // 风扇控制
|
|||
kcmd_fan_module_fan_read_status = CMDID(1014, 50), // 读取模块精简状态信息
|
|||
#if 0
|
|||
// 串口透传
|
|||
/*******************************************************************************
|
|||
* |Module_1015:串口透传 * |
|||
*******************************************************************************/ |
|||
kcmd_serial_module_send_data = CMDID(1015, 0), // 串口透传发送数据
|
|||
kcmd_serial_module_start_read_data = CMDID(1015, 1), // 串口透传读取数据
|
|||
kcmd_serial_module_start_stop_data = CMDID(1015, 2), // 串口透传停止读取数据
|
|||
kcmd_serial_module_read_status = CMDID(1015, 50), // 读取模块状态信息
|
|||
kcmd_serial_module_set_cfg = CMDID(1015, 100), // 串口透传设置配置
|
|||
#endif
|
|||
|
|||
// 移液枪控制
|
|||
/*******************************************************************************
|
|||
* |Module_1016:移液枪控制 * |
|||
*******************************************************************************/ |
|||
kcmd_pipette_module_enable = CMDID(1016, 0), // 使能
|
|||
kcmd_pipette_module_stop = CMDID(1016, 1), // 停止
|
|||
|
|||
kcmd_pipette_module_zero_pos_calibrate = CMDID(1016, 2), // 回零并校准
|
|||
|
|||
kcmd_pipeete_module_zmotor_reset = CMDID(1016, 3), // Z轴复位
|
|||
kcmd_pipeete_module_pipette_reset = CMDID(1016, 4), // 移液枪复位
|
|||
|
|||
kcmd_pipette_module_take_tip = CMDID(1016, 5), // 取tip
|
|||
kcmd_pipette_module_remove_tip = CMDID(1016, 6), // 移除tip
|
|||
|
|||
kcmd_pipette_module_move_to = CMDID(1016, 7), // 移动到
|
|||
kcmd_pipette_module_move_to_with_lld = CMDID(1016, 8), // 移动到
|
|||
kcmd_pipette_module_shake = CMDID(1016, 9), // 吸吐摇匀
|
|||
kcmd_pipette_module_pipette_move_to_ul = CMDID(1016, 10), // 取液
|
|||
|
|||
kcmd_pipette_module_get_status = CMDID(1016, 50), // 读取模块精简状态信息
|
|||
|
|||
kcmd_pipette_module_set_z_motor_para = CMDID(1016, 100), // 设置Z轴电机参数
|
|||
kcmd_pipette_module_get_z_motor_para = CMDID(1016, 101), // 读取Z轴电机参数
|
|||
kcmd_pipette_module_set_base_param = CMDID(1016, 102), // 设置运行参数
|
|||
kcmd_pipette_module_get_base_param = CMDID(1016, 103), // 读取运行参数
|
|||
|
|||
} CmdID_t; |
|||
|
|||
#pragma pack(push, 1)
|
|||
|
|||
ZPACKET_CMD_ACK(kcmd_ping, //
|
|||
CMD(u8 boardid;), //
|
|||
ACK(u8 boardid;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_read_io, //
|
|||
CMD(u8 ioid;), //
|
|||
ACK(u8 ioid; u8 val;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_set_io, //
|
|||
CMD(u8 ioid; u8 val;), //
|
|||
ACK(u8 ioid; u8 val;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_readadc_raw, //
|
|||
CMD(u8 sensorid;), //
|
|||
ACK(u8 sensorid; s32 val;)); |
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1006:XYRobot机器人控制模组 * |
|||
*******************************************************************************/ |
|||
// ACTION
|
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_enable, CMD(u16 id; u8 enable;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_stop, CMD(u16 id; u8 stop_type;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_xy_robot_ctrl_move_to_zero, CMD(u16 id;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_xy_robot_ctrl_move_to_zero_with_calibrate, CMD(u16 id; s32 nowx; s32 nowy;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_xy_robot_ctrl_move_to, CMD(u16 id; s32 x; s32 y; s32 speed;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_xy_robot_ctrl_move_by, CMD(u16 id; s32 dx; s32 dy; s32 speed;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_xy_robot_ctrl_move_by_no_limit, CMD(u16 id; s32 dx; s32 dy; s32 speed;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_force_change_current_pos, CMD(u16 id; s32 x; s32 y;), ACK(u8 pad;)); |
|||
// READ
|
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_read_version, CMD(u16 id;), ACK(I_XYRobotCtrlModule::version_t ack;)); |
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_read_status, CMD(u16 id;), ACK(I_XYRobotCtrlModule::status_t ack;)); |
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_read_detailed_status, CMD(u16 id;), ACK(I_XYRobotCtrlModule::detailed_status_t ack;)); |
|||
// SET
|
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_set_base_param, CMD(u16 id; I_XYRobotCtrlModule::base_param_t param;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_get_base_param, CMD(u16 id;), ACK(I_XYRobotCtrlModule::base_param_t ack;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_flush, CMD(u16 id;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_factory_reset, CMD(u16 id;), ACK(u8 pad;)); |
|||
|
|||
// ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_set_warning_limit_param, CMD(u16 id; u8 opt_type; I_XYRobotCtrlModule::warning_limit_param_t param;), ACK( I_XYRobotCtrlModule::warning_limit_param_t ack;));
|
|||
// ZPACKET_CMD_ACK(kcmd_xy_robot_ctrl_set_run_to_zero_param, CMD(u16 id; u8 opt_type; I_XYRobotCtrlModule::run_to_zero_param_t param;), ACK( I_XYRobotCtrlModule::run_to_zero_param_t ack;));
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1007:步进电机控制模组 * |
|||
*******************************************************************************/ |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_enable, CMD(u16 id; u8 enable;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_stop, CMD(u16 id; u8 stop_type;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_step_motor_ctrl_move_to_zero, CMD(u16 id;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_step_motor_ctrl_move_to_zero_with_calibrate, CMD(u16 id; s32 x;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_step_motor_ctrl_move_to, CMD(u16 id; s32 x; s32 speed;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_step_motor_ctrl_move_by, CMD(u16 id; s32 dx; s32 speed;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_force_change_current_pos, CMD(u16 id; s32 x;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_step_motor_ctrl_rotate, CMD(u16 id; s32 speed; s32 run_time;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_step_motor_ctrl_move_to_logic_point, CMD(u16 id; u8 logic_point_num;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
// READ
|
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_read_version, CMD(u16 id;), ACK(I_StepMotorCtrlModule::version_t ack;)); |
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_read_status, CMD(u16 id;), ACK(I_StepMotorCtrlModule::status_t ack;)); |
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_read_detailed_status, CMD(u16 id;), ACK(I_StepMotorCtrlModule::detailed_status_t ack;)); |
|||
// SET
|
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_set_base_param, CMD(u16 id; I_StepMotorCtrlModule::base_param_t param;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_get_base_param, CMD(u16 id;), ACK(I_StepMotorCtrlModule::base_param_t ack;)); |
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_set_logic_point, CMD(u16 id; u8 index; s32 acc; s32 dec; s32 velocity; s32 x;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_get_logic_point, CMD(u16 id; u8 logic_point_num;), ACK(I_StepMotorCtrlModule::logic_point_t ack;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_flush, CMD(u16 id;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_step_motor_ctrl_factory_reset, CMD(u16 id;), ACK(u8 pad;)); |
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1008:舵机 * |
|||
*******************************************************************************/ |
|||
ZPACKET_CMD_ACK(kcmd_mini_servo_ctrl_enable, CMD(u16 id; u8 enable;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_mini_servo_ctrl_stop, CMD(u16 id; u8 stop_type;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_mini_servo_ctrl_position_calibrate, CMD(u16 id; s32 calibrate_pos;), ACK(u8 pad;)); |
|||
|
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_mini_servo_ctrl_rotate, CMD(u16 id; s32 speed; s32 torque; s32 run_time;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_mini_servo_ctrl_move_to, CMD(u16 id; s32 pos; s32 speed; s32 torque;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_mini_servo_ctrl_move_by, CMD(u16 id; s32 pos; s32 speed; s32 torque;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_mini_servo_ctrl_run_with_torque, CMD(u16 id; s32 torque; s32 run_time;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_mini_servo_ctrl_move_by_nolimit, CMD(u16 id; s32 pos; s32 speed; s32 torque;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_mini_servo_ctrl_read_version, CMD(u16 id;), ACK(I_MiniServoModule::version_t ack;)); |
|||
ZPACKET_CMD_ACK(kcmd_mini_servo_ctrl_read_status, CMD(u16 id;), ACK(I_MiniServoModule::status_t ack;)); |
|||
ZPACKET_CMD_ACK(kcmd_mini_servo_ctrl_read_detailed_status, CMD(u16 id;), ACK(I_MiniServoModule::detailed_status_t ack;)); |
|||
|
|||
|
|||
ZPACKET_CMD_ACK(kcmd_mini_servo_ctrl_set_basic_param, CMD(u16 id; u8 opt_type; I_MiniServoModule::basic_param_t param;), ACK(I_MiniServoModule::basic_param_t ack;)); |
|||
|
|||
|
|||
|
|||
ZPACKET_CMD_ACK(kcmd_mini_servo_ctrl_get_basic_param, CMD(u16 id; u8 opt_type;), ACK(I_MiniServoModule::basic_param_t ack;)); |
|||
|
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1009:EEPROM * |
|||
*******************************************************************************/ |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_eeprom_start_monitor_status, CMD(u16 id;), ACK(u8 pad;), REPORT(I_EEPROMModule::eeprom_status_t status;)); |
|||
ZPACKET_CMD_ACK(kcmd_eeprom_stop_monitor_status, CMD(u16 id;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_eeprom_read_block, |
|||
CMD(u16 id; u16 sector_index; u16 sector_size;), //
|
|||
ACK(zcancmder_read_ram_ack_t ack;)); |
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1010:扫码器 * |
|||
*******************************************************************************/ |
|||
|
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_barcode_reader_start_scan, |
|||
CMD(u16 id;), //
|
|||
ACK(u8 pad;), //
|
|||
REPORT(u8 status; u16 barcodelen; u8 barcode[0];)); |
|||
ZPACKET_CMD_ACK(kcmd_barcode_reader_stop_scan, |
|||
CMD(u16 id;), //
|
|||
ACK(u8 pad;)); |
|||
/*******************************************************************************
|
|||
* |Module_1011:帕尔贴-水泵-风扇控温系统 * |
|||
*******************************************************************************/ |
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1012:电机激光扫码器 * |
|||
*******************************************************************************/ |
|||
|
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_motor_laser_code_scanner_scan, |
|||
CMD(u8 id; //
|
|||
s32 moveby_distance; //
|
|||
s32 scan_interval_distance; //
|
|||
s32 each_sample_times; //
|
|||
s32 transmitting_tube_amplification; // 0.001
|
|||
s32 receiving_tube_amplification; // 0.001
|
|||
), |
|||
ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK(kcmd_motor_laser_code_scanner_stop_scan, CMD(u16 id;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_motor_laser_code_scanner_get_scan_result, CMD(u16 id; u16 sector_index; u16 sector_size;), ACK(zcancmder_read_ram_ack_t ack;)); |
|||
|
|||
/*******************************************************************************
|
|||
* Module_1013:板夹仓 * |
|||
*******************************************************************************/ |
|||
|
|||
/*******************************************************************************
|
|||
* |Module_1014:风扇 * |
|||
*******************************************************************************/ |
|||
/*******************************************************************************
|
|||
* |Module_1016:移液枪控制 * |
|||
*******************************************************************************/ |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_pipette_module_enable, CMD(u16 id; u8 enable;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_pipette_module_stop, CMD(u16 id; u8 stop_type;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipette_module_zero_pos_calibrate, CMD(u16 id;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipeete_module_zmotor_reset, CMD(u16 id;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipeete_module_pipette_reset, CMD(u16 id;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
|
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipette_module_take_tip, CMD(u16 id; s16 vel; s16 height_mm; s16 tip_hight_mm;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipette_module_remove_tip, CMD(u16 id; s16 vel; s16 height_mm;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
|
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipette_module_move_to, CMD(u16 id; s16 vel; s16 height_mm;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipette_module_move_to_with_lld, CMD(u16 id; s16 vel; s16 lld_cap_thr; s16 lld_max_hight_mm; s16 lld_rela_hight_mm;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipette_module_shake, CMD(u16 id; s16 shake_times; s16 shake_volume;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
ZPACKET_CMD_ACK_AND_REPORT(kcmd_pipette_module_pipette_move_to_ul, CMD(u16 id; s16 take_volume_mm;), ACK(u8 pad;), REPORT(int32_t exec_status;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_pipette_module_get_status, CMD(u16 id;), ACK(I_PipetteModule::status_t ack;)); |
|||
|
|||
ZPACKET_CMD_ACK(kcmd_pipette_module_set_z_motor_para, CMD(u16 id; I_StepMotorCtrlModule::base_param_t param;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_pipette_module_get_z_motor_para, CMD(u16 id;), ACK(I_StepMotorCtrlModule::base_param_t ack;)); |
|||
ZPACKET_CMD_ACK(kcmd_pipette_module_set_base_param, CMD(u16 id; I_PipetteModule::base_param_t param;), ACK(u8 pad;)); |
|||
ZPACKET_CMD_ACK(kcmd_pipette_module_get_base_param, CMD(u16 id;), ACK(I_PipetteModule::base_param_t ack;)); |
|||
|
|||
#pragma pack(pop)
|
|||
|
|||
} // namespace zcr
|
|||
} // namespace iflytop
|
|||
#endif
|
@ -1,84 +0,0 @@ |
|||
#pragma once
|
|||
#include <stdint.h>
|
|||
#if 0
|
|||
#define ZPACKET_STRUCT(ordername, type, ...) \
|
|||
typedef struct { \ |
|||
__VA_ARGS__ \ |
|||
} ordername##_##type##_t |
|||
|
|||
#define ZPACKET_CMD_ACK(ordername, cmdpara, ackpara) \
|
|||
typedef struct { \ |
|||
cmdpara \ |
|||
} ordername##_##cmd##_t; \ |
|||
typedef struct { \ |
|||
ackpara \ |
|||
} ordername##_##ack##_t |
|||
|
|||
#define ZPACKET_CMD_ACK_AND_REPORT(ordername, cmdpara, ackpara, reportpara) \
|
|||
typedef struct { \ |
|||
cmdpara \ |
|||
} ordername##_##cmd##_t; \ |
|||
typedef struct { \ |
|||
ackpara \ |
|||
} ordername##_##ack##_t; \ |
|||
typedef struct { \ |
|||
reportpara \ |
|||
} ordername##_##report##_t |
|||
|
|||
#define PROCESS_PACKET(ordername, varid) \
|
|||
if (rxcmd->iscmd(ordername)) { \ |
|||
auto* cmd = rxcmd->get_data_as<ordername##_##cmd##_t>(); \ |
|||
auto* ack = (ordername##_##ack##_t*)m_txbuf; \ |
|||
static_assert(sizeof(*ack) < sizeof(m_txbuf), "ack size too large"); \ |
|||
auto __attribute__((unused)) cmdheader = rxcmd->get_cmdheader(); \ |
|||
uint32_t errorcode = 0; \ |
|||
if (cmd->id == varid) { |
|||
#define PROCESS_REPORT(type) \
|
|||
auto* report = (type##_report_t*)m_txbuf; \ |
|||
static_assert(sizeof(*report) < sizeof(m_txbuf), "report size too large"); \ |
|||
ZLOGI(TAG, #type " exec_status:%d", status); \ |
|||
report->exec_status = status; \ |
|||
m_cancmder->sendExecStatusReport(cmdheader, (uint8_t*)report, sizeof(*report)); |
|||
|
|||
#define END_PROCESS_PACKET() \
|
|||
if (errorcode == 0) { \ |
|||
m_cancmder->sendAck(rxcmd->get_cmdheader(), m_txbuf, sizeof(*ack)); \ |
|||
} else { \ |
|||
m_cancmder->sendErrorAck(rxcmd->get_cmdheader(), m_id, errorcode); \ |
|||
} \ |
|||
} \ |
|||
return; \ |
|||
} |
|||
|
|||
#define END_PP END_PROCESS_PACKET
|
|||
#define CMD(x) x
|
|||
#define ACK(x) x
|
|||
#define REPORT(x) x
|
|||
namespace iflytop { |
|||
namespace zcr { |
|||
|
|||
#pragma pack(push, 1)
|
|||
typedef struct { |
|||
uint16_t packetindex; |
|||
uint16_t cmdid; |
|||
uint8_t cmdSubId; |
|||
uint8_t packetType; |
|||
uint8_t data[]; |
|||
} Cmdheader_t; |
|||
#pragma pack(pop)
|
|||
|
|||
typedef enum { |
|||
kpt_cmd = 0, |
|||
kpt_ack = 1, |
|||
kpt_error_ack = 2, |
|||
kpt_cmd_exec_status_report = 3, |
|||
kpt_report = 4, |
|||
} PacketType_t; |
|||
|
|||
|
|||
} // namespace zcr
|
|||
} // namespace iflytop
|
|||
#endif
|
|||
|
|||
|
|||
#include "sdk\components\zprotocols\zcancmder_v2\api\packet_interface.hpp"
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue