From bdb799fd159d1b1901d2da22cbc35f4172ea77ac Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 26 Oct 2024 21:56:52 +0800 Subject: [PATCH] update --- a8000_protocol | 2 +- .../pipette_module/pipette_ctrl_module_v2.cpp | 56 ++++++++++++++++------ .../pipette_module/pipette_ctrl_module_v2.hpp | 29 ++++++----- sdk/components/zcancmder/zcan_protocol_parser.cpp | 26 +++++++--- sdk/components/zcancmder/zcan_protocol_parser.hpp | 10 +++- 5 files changed, 87 insertions(+), 36 deletions(-) diff --git a/a8000_protocol b/a8000_protocol index 51da893..e4ccf30 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit 51da893d74468dd8ae898e97936a2357a6120eb0 +Subproject commit e4ccf301ebe4edb258ec95a90c2389d8caa394c1 diff --git a/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp b/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp index 63a0220..cb7b67d 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp @@ -76,8 +76,7 @@ void PipetteModuleV2::create_default_cfg(config_t *defaultcfg) { defaultcfg->pump_vstop = 900; defaultcfg->aspirate_pump_vel = 500; // defaultcfg->pump_vmax = 1000; - defaultcfg->aspirate_zmotor_max_move_by = 400; // 50mm,tip头的长度 - defaultcfg->lld_pump_vel = 80; // lld推荐使用速度为50->200,这里 + defaultcfg->lld_pump_vel = 80; // lld推荐使用速度为50->200,这里 defaultcfg->lld_motor_vel_rpm = 80; defaultcfg->lld_detect_period_ms = 1; // 100ms defaultcfg->lld_prepare_pos = PIPETTE_PREPARE_POS; @@ -349,11 +348,11 @@ int32_t PipetteModuleV2::pipette_lld_prepare() { } int32_t PipetteModuleV2::pipette_lld_test() { // - return do_pipette_lld(true, kplld, m_state.pipette_startz, m_state.pipette_endz, 100, 1000); + return do_pipette_lld(true, kplld, m_state.lld_startz, m_state.lld_endz - m_state.lld_startz, 100, 1000); } int32_t PipetteModuleV2::pipette_lld() { // - return do_pipette_lld(false, m_state.lld_type, m_state.pipette_startz, m_state.pipette_endz - m_state.pipette_startz, m_state.lld_c_threshold, m_state.lld_p_threshold); + return do_pipette_lld(false, m_state.lld_type, m_state.lld_startz, m_state.lld_endz - m_state.lld_startz, m_state.lld_c_threshold, m_state.lld_p_threshold); } int32_t PipetteModuleV2::pipette_lld_is_detect_liquid(int32_t *detect) { @@ -385,14 +384,14 @@ int32_t PipetteModuleV2::pipette_aspirate_prepare() { return 0; } -int32_t PipetteModuleV2::pipette_set_startz(int32_t startz) { - ZLOGI(TAG, "pipette_set_startz %d", startz); - m_state.pipette_startz = startz; +int32_t PipetteModuleV2::pipette_set_lld_startz(int32_t startz) { + ZLOGI(TAG, "pipette_set_lld_startz %d", startz); + m_state.lld_startz = startz; return 0; } -int32_t PipetteModuleV2::pipette_set_endz(int32_t endz) { - ZLOGI(TAG, "pipette_set_endz %d", endz); - m_state.pipette_endz = endz; +int32_t PipetteModuleV2::pipette_set_lld_endz(int32_t endz) { + ZLOGI(TAG, "pipette_set_lld_endz %d", endz); + m_state.lld_endz = endz; return 0; } @@ -417,6 +416,17 @@ int32_t PipetteModuleV2::pipette_set_llf_velocity(int32_t llf_zm_rpm) { ZLOGI(TAG, "pipette_set_llf_velocity %d", llf_zm_rpm); return 0; } + +int32_t PipetteModuleV2::pipette_set_llf_startz(int32_t startz) { + m_state.llf_startz = startz; + ZLOGI(TAG, "pipette_set_llf_startz %d", startz); + return 0; +} +int32_t PipetteModuleV2::pipette_set_llf_endz(int32_t endz) { + m_state.llf_endz = endz; + ZLOGI(TAG, "pipette_set_llf_end %d", endz); + return 0; +} int32_t PipetteModuleV2::pipette_set_aspirate_operation_verifi_p_thre(int32_t p_thre) { m_state.aspirate_cfg_p_thre = p_thre; ZLOGI(TAG, "pipette_set_aspirate_operation_verifi_p_thre %d", p_thre); @@ -441,14 +451,24 @@ int32_t PipetteModuleV2::pipette_aspirate(int32_t ul) { return err::kparam_out_of_range; } + // llf_startz + // llf_endz + THREAD_START_WORK([this, ul]() { m_state.lld_prepared = 0; int dul = m_state.load_val_ul + ul <= 0 ? -m_state.load_val_ul : ul; DO_IN_THREAD(m_smtp2.pump_aspirate(m_cfg.aspirate_pump_vel, dul)); - int32_t dpos = ul > 0 ? m_cfg.aspirate_zmotor_max_move_by : -m_cfg.aspirate_zmotor_max_move_by; - if (m_state.aspirate_cfg_llf_zm_rpm != 0) zm_move_by(dpos, m_state.aspirate_cfg_llf_zm_rpm); + // int32_t dpos = ul > 0 ? m_cfg.aspirate_zmotor_max_move_by : -m_cfg.aspirate_zmotor_max_move_by; + + if (m_state.aspirate_cfg_llf_zm_rpm != 0) { + if (ul >= 0) { + zm_move_to(m_state.llf_startz, m_state.aspirate_cfg_llf_zm_rpm); + } else { + zm_move_to(m_state.llf_endz, m_state.aspirate_cfg_llf_zm_rpm); + } + } pump_waitfor_stop(); @@ -486,8 +506,16 @@ int32_t PipetteModuleV2::pipette_aspirate_and_verify(int32_t ul) { m_state.aspirate_cfg_eigen_time, // m_state.aspirate_cfg_tolerance)); - int32_t dpos = ul > 0 ? m_cfg.aspirate_zmotor_max_move_by : -m_cfg.aspirate_zmotor_max_move_by; - if (m_state.aspirate_cfg_llf_zm_rpm != 0) zm_move_by(dpos, m_state.aspirate_cfg_llf_zm_rpm); + // int32_t dpos = ul > 0 ? m_cfg.aspirate_zmotor_max_move_by : -m_cfg.aspirate_zmotor_max_move_by; + // if (m_state.aspirate_cfg_llf_zm_rpm != 0) zm_move_by(dpos, m_state.aspirate_cfg_llf_zm_rpm); + if (m_state.aspirate_cfg_llf_zm_rpm != 0) { + if (ul >= 0) { + zm_move_to(m_state.llf_startz, m_state.aspirate_cfg_llf_zm_rpm); + } else { + zm_move_to(m_state.llf_endz, m_state.aspirate_cfg_llf_zm_rpm); + } + } + // wait... pump_waitfor_stop(); // stop diff --git a/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp b/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp index fa8bb4b..dc6f67b 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp @@ -52,14 +52,14 @@ class PipetteModuleV2 : public ZIModule { } snesor_sample_data_t; typedef struct { - int32_t limit_ul; // 泵机限制 - int32_t pump_acc; // 泵机速度参数 - int32_t pump_dec; // 泵机速度参数 - int32_t pump_vstart; // 泵机速度参数 - int32_t pump_vstop; // 泵机速度参数 - int32_t pump_vmax; // 泵机速度参数 - int32_t aspirate_pump_vel; // 吸吐泵机速度 - int32_t aspirate_zmotor_max_move_by; // 吸液Z轴最大移动距离 //TODO add config index to set it + int32_t limit_ul; // 泵机限制 + int32_t pump_acc; // 泵机速度参数 + int32_t pump_dec; // 泵机速度参数 + int32_t pump_vstart; // 泵机速度参数 + int32_t pump_vstop; // 泵机速度参数 + int32_t pump_vmax; // 泵机速度参数 + int32_t aspirate_pump_vel; // 吸吐泵机速度 + // int32_t aspirate_zmotor_max_move_by; // 吸液Z轴最大移动距离 //TODO add config index to set it int32_t lld_pump_vel; // lld,泵机吸吐速度 int32_t lld_motor_vel_rpm; // lld,z轴电机移动速度 int32_t lld_detect_period_ms; // lld,探测周期 @@ -104,13 +104,15 @@ class PipetteModuleV2 : public ZIModule { int32_t dpos; // setting - int32_t pipette_startz; // lld探测起始位 - int32_t pipette_endz; // lld探测结束位置, llf液面跟随限制位 + int32_t lld_startz; // lld探测起始位 + int32_t lld_endz; // lld探测结束位置, llf液面跟随限制位 int32_t lld_type; // lld类型 int32_t lld_c_threshold; // lld c_threshold int32_t lld_p_threshold; // lld p_threshold int32_t aspirate_cfg_llf_zm_rpm; // 液面跟随速度 + int32_t llf_startz; // 液面跟随,z轴移动的最大开始位置 + int32_t llf_endz; // 液面跟随,z轴移动的最大结束位置 int32_t aspirate_cfg_p_thre; // 吸液操作验证,压力阈值,用来检测tip阻塞问题 int32_t aspirate_cfg_eigen_time; // 吸液操作验证,特征时间,用来检测气泡,吸空检测 int32_t aspirate_cfg_tolerance; // 容差 @@ -177,13 +179,14 @@ class PipetteModuleV2 : public ZIModule { virtual int32_t pipette_init_device(); virtual int32_t pipette_put_tip(); - virtual int32_t pipette_set_startz(int32_t startz); - virtual int32_t pipette_set_endz(int32_t maxz); - + virtual int32_t pipette_set_lld_startz(int32_t startz); + virtual int32_t pipette_set_lld_endz(int32_t maxz); virtual int32_t pipette_set_lld_type(int32_t lld_type); virtual int32_t pipette_set_lld_c_threshold(int32_t c_threshold); virtual int32_t pipette_set_lld_p_threshold(int32_t p_threshold); + virtual int32_t pipette_set_llf_startz(int32_t startz); + virtual int32_t pipette_set_llf_endz(int32_t endz); virtual int32_t pipette_set_llf_velocity(int32_t llf_zm_rpm); virtual int32_t pipette_set_aspirate_operation_verifi_p_thre(int32_t p_thre); virtual int32_t pipette_set_aspirate_operation_verifi_eigen_time(int32_t eigen_time); diff --git a/sdk/components/zcancmder/zcan_protocol_parser.cpp b/sdk/components/zcancmder/zcan_protocol_parser.cpp index 11a128f..2cb5b93 100644 --- a/sdk/components/zcancmder/zcan_protocol_parser.cpp +++ b/sdk/components/zcancmder/zcan_protocol_parser.cpp @@ -181,11 +181,13 @@ void ZCanProtocolParser::initialize(IZCanReceiver* cancmder) { REGFN(pipette_lld_is_detect_liquid); REGFN(pipette_lld_test); - REGFN(pipette_set_startz); - REGFN(pipette_set_endz); + REGFN(pipette_set_lld_startz); + REGFN(pipette_set_lld_endz); REGFN(pipette_set_lld_type); REGFN(pipette_set_lld_c_threshold); REGFN(pipette_set_lld_p_threshold); + REGFN(pipette_set_llf_startz); + REGFN(pipette_set_llf_endz); } void ZCanProtocolParser::_registerModule(uint16_t id, ZIModule* module) { m_modulers[id] = module; } void ZCanProtocolParser::registerModule(ZIModule* module) { @@ -1083,14 +1085,14 @@ int32_t ZCanProtocolParser::pipette_lld_test(cmdcontxt_t* cxt) { return module->pipette_lld_test(); } -int32_t ZCanProtocolParser::pipette_set_startz(cmdcontxt_t* cxt) { +int32_t ZCanProtocolParser::pipette_set_lld_startz(cmdcontxt_t* cxt) { CHECK_AND_GET_MODULE(1); - return module->pipette_set_startz(cxt->params[0]); + return module->pipette_set_lld_startz(cxt->params[0]); } -int32_t ZCanProtocolParser::pipette_set_endz(cmdcontxt_t* cxt) { +int32_t ZCanProtocolParser::pipette_set_lld_endz(cmdcontxt_t* cxt) { CHECK_AND_GET_MODULE(1); - return module->pipette_set_endz(cxt->params[0]); + return module->pipette_set_lld_endz(cxt->params[0]); } int32_t ZCanProtocolParser::pipette_set_lld_type(cmdcontxt_t* cxt) { @@ -1108,4 +1110,16 @@ int32_t ZCanProtocolParser::pipette_set_lld_p_threshold(cmdcontxt_t* cxt) { return module->pipette_set_lld_p_threshold(cxt->params[0]); } +int32_t ZCanProtocolParser::pipette_set_llf_startz(cmdcontxt_t* cxt) { + CHECK_AND_GET_MODULE(1); + return module->pipette_set_llf_startz(cxt->params[0]); +} + +int32_t ZCanProtocolParser::pipette_set_llf_endz(cmdcontxt_t* cxt) { + CHECK_AND_GET_MODULE(1); + return module->pipette_set_llf_endz(cxt->params[0]); +} + + + #undef MODULE_CLASS \ No newline at end of file diff --git a/sdk/components/zcancmder/zcan_protocol_parser.hpp b/sdk/components/zcancmder/zcan_protocol_parser.hpp index 79b7e06..c172f5b 100644 --- a/sdk/components/zcancmder/zcan_protocol_parser.hpp +++ b/sdk/components/zcancmder/zcan_protocol_parser.hpp @@ -214,11 +214,17 @@ class ZCanProtocolParser : public IZCanReceiverListener { CMDFN(pipette_zmotor_read_dev_status_cache); CMDFN(pipette_lld_is_detect_liquid); CMDFN(pipette_lld_test); - CMDFN(pipette_set_startz); - CMDFN(pipette_set_endz); + CMDFN(pipette_set_lld_startz); + CMDFN(pipette_set_lld_endz); CMDFN(pipette_set_lld_type); CMDFN(pipette_set_lld_c_threshold); CMDFN(pipette_set_lld_p_threshold); + CMDFN(pipette_set_llf_startz); + CMDFN(pipette_set_llf_endz); + + + + }; } // namespace iflytop \ No newline at end of file