From 35996593f2c7d9f585f6098acd33e485c5a85d4f Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 28 May 2025 09:38:08 +0800 Subject: [PATCH] update --- sdk/components/pipette_module/README.md | 5 ++ .../pipette_module/base/pipette_action_param.hpp | 9 ++- sdk/components/pipette_module/base/pipette_cfg.hpp | 30 +++++++- .../pipette_module/pipette_ctrl_module.cpp | 79 ++++++++++++++++++---- .../pipette_module/pipette_ctrl_module.hpp | 11 ++- .../pipette_ctrl_module_config_function_impl.cpp | 53 +++++++++++---- .../pipette_module/pipette_ctrl_module_pm_ctrl.cpp | 18 +++-- .../pipette_module/pipette_ctrl_module_zm_ctrl.cpp | 15 ++-- sdk/components/sensors/smtp2_v2/smtp2_v2.cpp | 12 ++-- .../zcan_protocol_parser/zcan_protocol_parser.cpp | 15 ++++ .../zcan_protocol_parser/zcan_protocol_parser.hpp | 2 + usrc/a8000_protocol/protocol/cmdid.cpp | 3 + usrc/a8000_protocol/protocol/cmdid.hpp | 2 + .../subboard80_cliptip/subboard80_cliptip.cpp | 2 + 14 files changed, 210 insertions(+), 46 deletions(-) create mode 100644 sdk/components/pipette_module/README.md diff --git a/sdk/components/pipette_module/README.md b/sdk/components/pipette_module/README.md new file mode 100644 index 0000000..02e7795 --- /dev/null +++ b/sdk/components/pipette_module/README.md @@ -0,0 +1,5 @@ +TODO: +``` +1. 支持压力流采集 +2. 支持气泡,吸空,检测 +``` \ No newline at end of file diff --git a/sdk/components/pipette_module/base/pipette_action_param.hpp b/sdk/components/pipette_module/base/pipette_action_param.hpp index 219a9d9..afe60ae 100644 --- a/sdk/components/pipette_module/base/pipette_action_param.hpp +++ b/sdk/components/pipette_module/base/pipette_action_param.hpp @@ -41,7 +41,10 @@ typedef struct { // int32_t mix_volume; // 吸取前混匀体积 int32_t mix_times; // 吸取前混匀次数 - int32_t max; // 占位 + // + // 其他 + // + int32_t max; // 占位 } aspiration_param_t; typedef enum { @@ -78,6 +81,9 @@ typedef enum { // kaspiration_paramid_mix_volume, kaspiration_paramid_mix_times, + // + // 其他 + // kaspiration_paramid_max, } aspiration_paramid_t; @@ -127,6 +133,7 @@ typedef struct { // 其他配置 // int32_t zm_auto_move_to_zero; // zm自动归零 + int32_t enable_pressure_record; int32_t max; } distribu_all_param_t; diff --git a/sdk/components/pipette_module/base/pipette_cfg.hpp b/sdk/components/pipette_module/base/pipette_cfg.hpp index 7e9b5f7..2309078 100644 --- a/sdk/components/pipette_module/base/pipette_cfg.hpp +++ b/sdk/components/pipette_module/base/pipette_cfg.hpp @@ -11,6 +11,28 @@ return #enum_name; /*********************************************************************************************************************** + * 通用配置 * + ***********************************************************************************************************************/ + +typedef struct { + int32_t pressure_record_enable; + int32_t max; +} common_cfg_t; + +typedef enum { + kpipette_common_cfg_pressure_record_enable, + kpipette_common_cfg_max, +} pipette_common_cfg_index_t; + +static inline const char *common_cfg_index_to_string(pipette_common_cfg_index_t index) { + switch (index) { + CASE_ENUM_TO_STRING(kpipette_common_cfg_pressure_record_enable) + CASE_ENUM_TO_STRING(kpipette_common_cfg_max) + } + return "unknown"; +} // pipette_common_cfg_index_to_string + +/*********************************************************************************************************************** * 平台参数 * ***********************************************************************************************************************/ typedef struct { @@ -305,9 +327,10 @@ typedef struct { // // lld // - int32_t plld_pm_vcpyid; // 液面探测时泵机速率 - int32_t plld_threshold; // 液面探测阈值 - int32_t plld_zm_vel; // 液面探测时泵机速率 + int32_t plld_pm_vcpyid; // 液面探测时泵机速率 + int32_t plld_threshold; // 液面探测阈值 + int32_t plld_zm_vel; // + int32_t plld_invasion_depth; // 液面探测时,会多侵入液面一定深度,这个深度和plld阈值和zm_vel速度有关 (0.1mm) // // 清空tip配置 @@ -384,6 +407,7 @@ typedef enum { kliquid_info_plld_pm_vcpyid, kliquid_info_plld_threshold, kliquid_info_plld_zm_vel, + kliquid_info_plld_invasion_depth, kliquid_info_empty_tip_pm_vcpyid, kliquid_info_blowout_air_volume, kliquid_info_blowout_air_pm_vcpyid, diff --git a/sdk/components/pipette_module/pipette_ctrl_module.cpp b/sdk/components/pipette_module/pipette_ctrl_module.cpp index aed2e74..11c930d 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module.cpp @@ -389,6 +389,7 @@ int32_t PipetteModule::pipette_pump_aspirate() { dump("liquid_info", liquidinfo); clearPipetteGunState(); + zm_move_to_zero_quick_block(); if (acfg->lld_enable) { _do_lld(acfg->container_pos, platform_info, container_cfg, liquidinfo); // 液面探测 @@ -416,15 +417,16 @@ int32_t PipetteModule::pipette_pump_aspirate() { } void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, container_info_t *container_cfg, liquid_info_t *liquidinfo) { - int32_t ecode = 0; + int32_t ecode = 0; + int32_t start_pressure = 0; // 移动到转移位置 ZLOGI(TAG, "-->zm move to transform pos"); - zm_move_to_block(0, kzm_v_default, 0); + zm_move_to_block(0, kpm_v_max, 0); // 清空tip ZLOGI(TAG, "-->empty tip before lld"); pump_move_to_x100nl_block(0, liquidinfo->empty_tip_pm_vcpyid); - pump_move_to_x100nl_block(10, kpm_v_default); // 回转一下,消除齿轮间隙 + pump_move_to_x100nl_block(300 /*30ul*/, kpm_v_max); // 为lld清空tip,提供一定空气柱 // 移动到瓶口 ZLOGI(TAG, "-->zm move to container neck pos"); @@ -434,15 +436,24 @@ void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, co ZLOGI(TAG, "-->start lld, lld_pm_vindex %d plld_threshold %d", liquidinfo->plld_pm_vcpyid, liquidinfo->plld_threshold); DO_IN_THREAD(m_smtp2.pump_set_io1_mode(1)); // lld输入高 //! WARNING: 这里强制设置tip类型为200ul - DO_IN_THREAD(m_smtp2.pump_set_tip_type(smtp2::TS200UL)); // 设置tip大小 + DO_IN_THREAD(m_smtp2.pump_set_tip_type(smtp2::TS200UL)); // 设置tip大小 + DO_IN_THREAD(m_smtp2.pump_set_plld_start_delay(100)); + m_smtp2.pump_get_pressure(&start_pressure); + ZLOGI(TAG, "-->start lld , start_pressure is %d", start_pressure); + +#if 1 pump_do_lld(liquidinfo->plld_threshold, 200, liquidinfo->plld_pm_vcpyid); // lld延时200ms,速度为plld_zm_vel + osDelay(110); // 等待lld启动 +#else + pump_start_lld(2400, liquidinfo->plld_pm_vcpyid); +#endif // 快速移动到瓶口 ZLOGI(TAG, "-->zm move quick to lld search start pos"); zm_move_to_lld_start_search_pos_block(container_pos, container_cfg, kzm_v_default, 0); // lld,zm移动到瓶底 ZLOGI(TAG, "-->zm move slow to container bottom pos"); - zm_move_to(container_pos + container_cfg->container_depth, kzm_v_lld, liquidinfo->plld_zm_vel); + zm_move_to(container_pos + container_cfg->container_depth - 50, kzm_v_lld, liquidinfo->plld_zm_vel); /** * @brief 等待压力大于阈值 @@ -450,6 +461,7 @@ void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, co int32_t water_level = 0; bool detect_liquid = false; while (true) { +#if 1 if (m_zm->isStoped()) { detect_liquid = false; ZLOGI(TAG, "-->zm is stoped"); @@ -458,13 +470,52 @@ void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, co // lld触发 if (m_piette_gun_io1.getState()) { - int32_t water_level = zm_get_now_pos(); - detect_liquid = true; + water_level = zm_get_now_pos() - liquidinfo->plld_invasion_depth; + detect_liquid = true; m_zm->stop(); ZLOGI(TAG, "-->detect liquid, water_level %d", water_level); break; } - ZLOGI(TAG, "...wait for lld trigger, now zm pos %d", zm_get_now_pos()); + if (!m_common_cfg.pressure_record_enable) { + ZLOGI(TAG, "...wait for lld trigger, now zm pos %d", zm_get_now_pos()); + } else { + int32_t pressure = 0; + m_smtp2.pump_get_pressure(&pressure); + ZLOGI(TAG, "...wait for lld trigger, now zm pos %d, pressure %d dpressure %d", zm_get_now_pos(), pressure, pressure - start_pressure); + } +#else + if (m_zm->isStoped()) { + detect_liquid = false; + ZLOGI(TAG, "-->zm is stoped"); + break; + } + + int32_t pressure = 0; + int32_t dpressure0, dpressure1 = 0; + + m_smtp2.pump_get_pressure(&pressure); + dpressure0 = pressure - start_pressure; + + // lld触发 + if (abs(dpressure0) > liquidinfo->plld_threshold) { + water_level = zm_get_now_pos() - liquidinfo->plld_invasion_depth; + detect_liquid = true; + + m_smtp2.pump_get_pressure(&pressure); + dpressure1 = pressure - start_pressure; + if (abs(dpressure1) < abs(dpressure0) + 5) { + detect_liquid = false; + ZLOGW(TAG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!! %d", dpressure1); + continue; + } + + m_zm->stop(); + ZLOGI(TAG, "-->detect liquid, water_level %d,dpressure0 %d,dpressure1 %d", water_level, dpressure0, dpressure1); + break; + } + + ZLOGI(TAG, "...wait for lld trigger, now zm pos %d, pressure %d dpressure %d", zm_get_now_pos(), pressure, dpressure0); +#endif thread_delay(1); } ecode = m_smtp2.pump_get_state(nullptr); // 获取泵状态,在此之前不能执行任何泵机指令,否则会丢失错误状态 @@ -489,8 +540,11 @@ void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, co DO_IN_THREAD(m_smtp2.pump_stop()); m_zm->stop(); + zm_move_to_block(water_level, kzm_v_swap_out, 0); // 回到默认位置 + if (!detect_liquid) { ZLOGE(TAG, "detect liquid fail"); + zm_move_to_block(0, kzm_v_default, 0); throw zapp_exception(err::kpipette_lld_error_no_liquid_detected); } m_state.detected_liquid = 1; @@ -533,7 +587,7 @@ void PipetteModule::_do_sapirate(platinfo_t *platform_info, container_info_t *co // Z轴移动到液面之下 ZLOGI(TAG, "--> move below the liquid surface"); - zm_move_to_immersion_pos_block(-1, m_state.water_level, container_cfg, kzm_v_swap_in, 0); // 移动到液面下 + zm_move_to_immersion_pos_block(acfg->container_pos, m_state.water_level, container_cfg, kzm_v_swap_in, 0); // 移动到液面下 // 吸入润湿TIP的溶液 if (liquidinfo->over_aspirated_volume > 0) { @@ -549,7 +603,7 @@ void PipetteModule::_do_sapirate(platinfo_t *platform_info, container_info_t *co for (size_t i = 0; i < acfg->mix_times; i++) { // 移动到瓶底 if (acfg->mix_llf_enable > 0) { - zm_move_to(acfg->container_pos + container_cfg->container_depth, kzm_v_llf, compute_zm_llf_vel(liquidinfo->mix_pm_vcpyid, container_cfg)); + zm_move_to(acfg->container_pos + container_cfg->container_depth - 15, kzm_v_llf, compute_zm_llf_vel(liquidinfo->mix_pm_vcpyid, container_cfg)); } pump_move_by_x100nl_block(acfg->mix_volume, liquidinfo->mix_pm_vcpyid); if (acfg->mix_llf_enable > 0) zm_stop(); @@ -669,10 +723,11 @@ int32_t PipetteModule::pipette_pump_distribu_all() { // 移动到swap位置 ZLOGI(TAG, "-->move to swap position"); zm_move_to_leaving_height_pos_block(container_pos, -1, container_cfg, kzm_v_default, 0); // 移动到swap位置 + // 清空transport volume if (liquidInGun_info->transport_volume != 0) { ZLOGI(TAG, "-->clean transport volume"); - pump_move_to_x100nl_block(liquidInGun_info->transport_volume, liquidInGun_info->transport_volume_pm_vcpyid); // 清空transport volume + pump_move_by_x100nl_block(-liquidInGun_info->transport_volume, liquidInGun_info->transport_volume_pm_vcpyid); // 清空transport volume } else { ZLOGI(TAG, "-->clean transport volume,skip"); } @@ -684,7 +739,7 @@ int32_t PipetteModule::pipette_pump_distribu_all() { // 分液 ZLOGI(TAG, "-->distribu liquid"); int32_t distribu_volume = calibrate_liquid_volume(liquidInGun_info, m_pump_gun_state.liquid_volume); - pump_move_by_x100nl_block(distribu_volume, liquidInGun_info->distribu_pm_vpyid); // 分液 + pump_move_by_x100nl_block(-distribu_volume, liquidInGun_info->distribu_pm_vpyid); // 分液 // 移动到swap位置,快速清空tip,使用(emptyTip速度) ZLOGI(TAG, "-->move to swap position and clean tip"); diff --git a/sdk/components/pipette_module/pipette_ctrl_module.hpp b/sdk/components/pipette_module/pipette_ctrl_module.hpp index 03950c5..243563d 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module.hpp +++ b/sdk/components/pipette_module/pipette_ctrl_module.hpp @@ -87,8 +87,9 @@ class PipetteModule : public ZIModule { * Config * ***********************************************************************************************************************/ - zm_bcfg_t zmbcfg; - pump_bcfg_t pm_base_cfg; + zm_bcfg_t zmbcfg; + pump_bcfg_t pm_base_cfg; + common_cfg_t m_common_cfg; platinfo_t m_platinfo[PLATINFO_CPY_NUM]; @@ -126,6 +127,9 @@ class PipetteModule : public ZIModule { * Config * ***********************************************************************************************************************/ + virtual int32_t pipette_set_common_cfg(pipette_common_cfg_index_t index, int32_t val); + virtual int32_t pipette_get_common_cfg(pipette_common_cfg_index_t index, int32_t *val); + virtual int32_t pipette_set_zmbcfg(zm_bcfg_index_t index, int32_t val); virtual int32_t pipette_get_zmbcfg(zm_bcfg_index_t index, int32_t *val); @@ -216,10 +220,11 @@ class PipetteModule : public ZIModule { int32_t pump_read_tip_state(); void pump_waitfor_stop(); void pump_waitfor_lld_is_ready(int32_t *zpos); - void _pump_move_to_x100nl(int32_t x100nl, int32_t vcfgindex); + void _pump_move_to_x100nl(double x100nl, int32_t vcfgcpyid); void pump_do_lld(int32_t pressure_threshold, int32_t ___, int32_t vcfgidx); void pump_move_to_x100nl_block(double x100nl, int32_t vcfgindex, int32_t *diff = nullptr); void pump_move_by_x100nl_block(double x100nl, int32_t vcfgindex); + void pump_start_lld(double target_x100nl, int32_t vcfgindex); /*********************************************************************************************************************** * UTILS * diff --git a/sdk/components/pipette_module/pipette_ctrl_module_config_function_impl.cpp b/sdk/components/pipette_module/pipette_ctrl_module_config_function_impl.cpp index 116624a..8a20f0b 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_config_function_impl.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_config_function_impl.cpp @@ -70,6 +70,28 @@ int32_t PipetteModule::pipette_get_liquid_info(int32_t cpyid, liquid_info_index_ return 0; } +int32_t PipetteModule::pipette_set_common_cfg(pipette_common_cfg_index_t index, int32_t val) { + if (index < 0 || index > kpipette_common_cfg_max) { + ZLOGE(TAG, "pipette_set_common_cfg index %d out of range", index); + return err::kparam_out_of_range; + } + + int32_t *settadd = ((int32_t *)&m_common_cfg) + index; + *settadd = val; // 直接设置值 + ZLOGI(TAG, "pipette_set_common_cfg index %s val %d", common_cfg_index_to_string(index), val); + return 0; +} +int32_t PipetteModule::pipette_get_common_cfg(pipette_common_cfg_index_t index, int32_t *val) { + if (index < 0 || index > kpipette_common_cfg_max) { + ZLOGE(TAG, "pipette_get_common_cfg index %d out of range", index); + return err::kparam_out_of_range; + } + int32_t *settadd = ((int32_t *)&m_common_cfg) + index; + *val = *settadd; // 直接获取值 + ZLOGI(TAG, "pipette_get_common_cfg index %s val %d", common_cfg_index_to_string(index), *val); + return 0; +} + int32_t PipetteModule::pipette_set_zmbcfg(zm_bcfg_index_t index, int32_t val) { if (index < 0 || index > kzm_bcfg_max) { ZLOGE(TAG, "pipette_set_zmbcfg index %d out of range", index); @@ -409,15 +431,15 @@ void PipetteModule::parameter_init() { m_zm_vcfg[kzm_v_default].dmax = 100; m_zm_vcfg[kzm_v_default].d1 = 200; m_zm_vcfg[kzm_v_default].vstop = 400; - m_zm_vcfg[kzm_v_default].vmax = 1200; + m_zm_vcfg[kzm_v_default].vmax = 1300; m_zm_vcfg[kzm_v_default].mark = 9973; m_zm_vcfg[kzm_v_move_to_zero].vmax = 600; m_zm_vcfg[kzm_v_look_zero_edge].vmax = 100; - m_zm_vcfg[kzm_v_lld].vmax = 100; - m_zm_vcfg[kzm_v_swap_in].vmax = 300; - m_zm_vcfg[kzm_v_swap_out].vmax = 300; - m_zm_vcfg[kzm_v_llf].vmax = 500; + m_zm_vcfg[kzm_v_lld].vmax = 150; + m_zm_vcfg[kzm_v_swap_in].vmax = 150; + m_zm_vcfg[kzm_v_swap_out].vmax = 150; + m_zm_vcfg[kzm_v_llf].vmax = 50; /*********************************************************************************************************************** * m_pm_vcfg * @@ -425,21 +447,26 @@ void PipetteModule::parameter_init() { memset_int32_t((int32_t *)&m_pm_vcfg[0], -1, sizeof(m_pm_vcfg) / 4); memset_int32_t((int32_t *)&m_pm_vcfg[0], 0, sizeof(m_pm_vcfg[0]) / 4); - m_pm_vcfg[kpm_v_default].acc = 1; - m_pm_vcfg[kpm_v_default].dec = 1; - m_pm_vcfg[kpm_v_default].vstart = 100; + m_pm_vcfg[kpm_v_default].acc = 14; + m_pm_vcfg[kpm_v_default].dec = 14; + m_pm_vcfg[kpm_v_default].vstart = 10; m_pm_vcfg[kpm_v_default].vstop = 50; m_pm_vcfg[kpm_v_default].mark = 9973; // m_pm_vcfg[kpm_v_default].vmax = 2500; - m_pm_vcfg[kpm_v_slow_lv1].vmax = 5; - m_pm_vcfg[kpm_v_slow_lv2].vmax = 10; - m_pm_vcfg[kpm_v_slow_lv3].vmax = 50; + m_pm_vcfg[kpm_v_slow_lv1].vmax = 10; + m_pm_vcfg[kpm_v_slow_lv2].vmax = 30; + m_pm_vcfg[kpm_v_slow_lv3].vmax = 100; m_pm_vcfg[kpm_v_mid].vmax = 1000; m_pm_vcfg[kpm_v_quick].vmax = 2000; - m_pm_vcfg[kpm_v_max].vmax = 2500; - m_pm_vcfg[kpm_v_lld].vmax = 100; + m_pm_vcfg[kpm_v_max].vmax = 2550; + + m_pm_vcfg[kpm_v_lld].acc = 1; + m_pm_vcfg[kpm_v_lld].dec = 1; + m_pm_vcfg[kpm_v_lld].vstart = 0; + m_pm_vcfg[kpm_v_lld].vstop = 10; + m_pm_vcfg[kpm_v_lld].vmax = 10; /*********************************************************************************************************************** * m_container_info * diff --git a/sdk/components/pipette_module/pipette_ctrl_module_pm_ctrl.cpp b/sdk/components/pipette_module/pipette_ctrl_module_pm_ctrl.cpp index 33fd804..7dfa8cf 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_pm_ctrl.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_pm_ctrl.cpp @@ -29,8 +29,8 @@ void PipetteModule::pump_apply_vcfg(int32_t vcfgcpyid, bool force) { DO_IN_THREAD(m_smtp2.pump_set_vcfg(&vcfg)); } -void PipetteModule::_pump_move_to_x100nl(int32_t x100nl, int32_t vcfgcpyid) { - ZLOGI(TAG, "pump_move_to_x100nl %d, in %s", x100nl, get_pm_vcpyid_name((pm_vcpyid_t)vcfgcpyid)); +void PipetteModule::_pump_move_to_x100nl(double x100nl, int32_t vcfgcpyid) { + ZLOGI(TAG, "pump_move_to_x100nl %f, in %s", x100nl, get_pm_vcpyid_name((pm_vcpyid_t)vcfgcpyid)); smtp2::VelCfg vcfg; pump_get_vcfg(vcfgcpyid, &vcfg); DO_IN_THREAD(m_smtp2.pump_move_to_nl(&vcfg, x100nl * 100)); @@ -46,7 +46,7 @@ void PipetteModule::pump_move_to_x100nl_block(double x100nl, int32_t vcfgcpyid, ZLOGI(TAG, "pump_move_to_x100nl_block %f nl, in %s", x100nl, get_pm_vcpyid_name((pm_vcpyid_t)vcfgcpyid)); int32_t diff_pos = 0; - for (size_t i = 0; i < 3; i++) { + for (size_t i = 0; i < 4; i++) { int32_t vcpyid = vcfgcpyid; if (i != 0) { vcpyid = kpm_v_slow_lv1; @@ -59,13 +59,13 @@ void PipetteModule::pump_move_to_x100nl_block(double x100nl, int32_t vcfgcpyid, diff_pos = targetpos - after_pos; if (diff) *diff = diff_pos; ZLOGI(TAG, "pump target %d nl, now pos %d nl diff %d", targetpos, after_pos, diff_pos); - if (abs(diff_pos) > 20) { + if (abs(diff_pos) > 80) { ZLOGW(TAG, "pump move to x100nl %d failed, diff is too large retrying...", x100nl); continue; } break; } - if (abs(diff_pos) > 30) { + if (abs(diff_pos) > 300) { module_detail_errorcode = diff_pos; throw zapp_exception(err::kpipette_pm_positioning_abnormality); } @@ -78,9 +78,16 @@ void PipetteModule::pump_move_by_x100nl_block(double x100nl, int32_t vcfgcpyid) startpos = 0; } double targetpos = startpos + x100nl * 100; + if (targetpos < 0) { + targetpos = 0; + } pump_move_to_x100nl_block(targetpos / 100, vcfgcpyid); } +void PipetteModule::pump_start_lld(double target_x100nl, int32_t vcfgindex) { // + _pump_move_to_x100nl(target_x100nl, vcfgindex); +} + void PipetteModule::pump_read_pos_nl(int32_t *val) { // // *val = m_state.load_val_ul; @@ -104,7 +111,6 @@ int32_t PipetteModule::pump_read_tip_state() { return val; } - void PipetteModule::pump_waitfor_stop() { while (true) { int32_t isbusy = 0; diff --git a/sdk/components/pipette_module/pipette_ctrl_module_zm_ctrl.cpp b/sdk/components/pipette_module/pipette_ctrl_module_zm_ctrl.cpp index 9aade2c..192a613 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_zm_ctrl.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_zm_ctrl.cpp @@ -18,10 +18,17 @@ void PipetteModule::zm_move_to_container_bottom_section_begin_block(int32_t cont zm_move_to_block(container_pos + containInfo->container_depth - containInfo->container_bottom_section_height, vbcpyid, vel); } void PipetteModule::zm_move_to_immersion_pos_block(int32_t container_pos, int32_t waterlevel, container_info_t *containInfo, int32_t vbcpyid, int32_t vel) { // - if (waterlevel == -1) - zm_move_to_block(container_pos + containInfo->fix_water_level_depth + containInfo->immersion_depth, vbcpyid, vel); - else - zm_move_to_block(waterlevel + containInfo->immersion_depth, vbcpyid, vel); + + int32_t targetPos = 0; + if (waterlevel == -1) { + targetPos = container_pos + containInfo->fix_water_level_depth + containInfo->immersion_depth; + } else { + targetPos = waterlevel + containInfo->immersion_depth; + } + if (targetPos > container_pos + containInfo->container_depth) { + targetPos = container_pos + containInfo->container_depth; + } + zm_move_to_block(targetPos, vbcpyid, vel); } void PipetteModule::zm_move_to_leaving_height_pos_block(int32_t container_pos, int32_t waterlevel, container_info_t *containInfo, int32_t vbcpyid, int32_t vel) { // if (waterlevel == -1) diff --git a/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp b/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp index ca75db5..ba2f882 100644 --- a/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp +++ b/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp @@ -11,7 +11,7 @@ using namespace smtp2; #define TAG "SMTP2" #define OVERTIME 100 -#define DUMP_HEX 1 +#define DUMP_HEX 0 #define RE_SEND_TIMES 5 #define RE_SEND_DELAY 400 @@ -98,7 +98,7 @@ int32_t SMTP2V2::pump_stop() { } int32_t SMTP2V2::pump_set_plld_start_delay(int32_t delay_ms) { ZLOGI(TAG, "pump_set_plld_start_delay %d", delay_ms); - return setstate(true, "/1T%dR\r", delay_ms); + return setstate(true, "/1u%d,%dR\r", kcfg_pLLD_start_delay, delay_ms); } int32_t SMTP2V2::pump_set_vcfg(VelCfg* vcfg) { ZLOGI(TAG, "pump_set_vcfg %d,%d,%d,%d,%d", vcfg->acc, vcfg->dec, vcfg->vstart, vcfg->vstop, vcfg->vmax); @@ -132,7 +132,7 @@ int32_t SMTP2V2::_pump_move_to_nl(VelCfg* vcfg, int32_t nl) { ZLOGI(TAG, " _pump_move_to_nl %d", nl); ZLOGI(TAG, " vcfg acc %d dec %d vstart %d vstop %d vmax %d", vcfg->acc, vcfg->dec, vcfg->vstart, vcfg->vstop, vcfg->vmax); fix_vcfg(vcfg); - + if (nl < 0) nl = 0; return runaction(true, "/1N2L%d,%dv%dc%dV%dA%dR\r", // vcfg->acc, vcfg->dec, vcfg->vstart * 1000, vcfg->vstop * 1000, vcfg->vmax * 1000, nl); } @@ -247,7 +247,11 @@ int32_t SMTP2V2::pump_get_infer_eigen_time(int32_t* eigen_time) { return pump_ge int32_t SMTP2V2::pump_aspirate_plld(int32_t pressure_threshold, VelCfg* vcfg) { ZLOGI(TAG, "pump_aspirate_plld %d", pressure_threshold); fix_vcfg(vcfg); - + int32_t ret = 0; + ret = setstate(true, "/1rR\r"); // r复位LLD输出 + if (ret != 0) { + return ret; + } return runaction(true, "/1N2L%d,%dv%dc%dV%dt%d,1R\r", // vcfg->acc, vcfg->dec, vcfg->vstart * 1000, vcfg->vstop * 1000, vcfg->vmax * 1000, // pressure_threshold); diff --git a/sdk/components/zcan_protocol_parser/zcan_protocol_parser.cpp b/sdk/components/zcan_protocol_parser/zcan_protocol_parser.cpp index ba7c860..a3503ce 100644 --- a/sdk/components/zcan_protocol_parser/zcan_protocol_parser.cpp +++ b/sdk/components/zcan_protocol_parser/zcan_protocol_parser.cpp @@ -168,6 +168,8 @@ void ZCanProtocolParser::initialize(ZCanReceiver* cancmder) { REGFN(pipette_get_pmvcfg_max_cpyid); REGFN(pipette_get_container_info_max_cpyid); REGFN(pipette_get_liquid_info_max_cpyid); + REGFN(pipette_set_common_cfg); + REGFN(pipette_get_common_cfg); REGFN(pipette_zmotor_enable); REGFN(pipette_zmotor_move_zero); @@ -1239,4 +1241,17 @@ int32_t ZCanProtocolParser::pipette_test_move_to_pierce_pos(cmdcontxt_t* cxt) { return module->pipette_test_move_to_pierce_pos(cxt->params[0], cxt->params[1]); } + +int32_t ZCanProtocolParser::pipette_set_common_cfg(cmdcontxt_t* cxt) { + CHECK_AND_GET_MODULE(2); + return module->pipette_set_common_cfg((pipette_common_cfg_index_t)cxt->params[0], cxt->params[1]); +} + +int32_t ZCanProtocolParser::pipette_get_common_cfg(cmdcontxt_t* cxt) { + CHECK_AND_GET_MODULE(1); + int32_t* ack = (int32_t*)cxt->ackbuf; + cxt->acklen = 4; + return module->pipette_get_common_cfg((pipette_common_cfg_index_t)cxt->params[0], &ack[0]); +} + #undef MODULE_CLASS \ No newline at end of file diff --git a/sdk/components/zcan_protocol_parser/zcan_protocol_parser.hpp b/sdk/components/zcan_protocol_parser/zcan_protocol_parser.hpp index 587557c..32223c9 100644 --- a/sdk/components/zcan_protocol_parser/zcan_protocol_parser.hpp +++ b/sdk/components/zcan_protocol_parser/zcan_protocol_parser.hpp @@ -189,6 +189,8 @@ class ZCanProtocolParser : public IZCanRxProcesser { CMDFN(pipette_get_pmvcfg_max_cpyid); CMDFN(pipette_get_container_info_max_cpyid); CMDFN(pipette_get_liquid_info_max_cpyid); + CMDFN(pipette_set_common_cfg); + CMDFN(pipette_get_common_cfg); CMDFN(pipette_zmotor_enable); CMDFN(pipette_zmotor_move_zero); diff --git a/usrc/a8000_protocol/protocol/cmdid.cpp b/usrc/a8000_protocol/protocol/cmdid.cpp index ed9c573..f3ef4e0 100644 --- a/usrc/a8000_protocol/protocol/cmdid.cpp +++ b/usrc/a8000_protocol/protocol/cmdid.cpp @@ -138,6 +138,9 @@ static cmdinfo_t table[] = { CMD_ITERM(kpipette_get_pmvcfg_max_cpyid), CMD_ITERM(kpipette_get_container_info_max_cpyid), CMD_ITERM(kpipette_get_liquid_info_max_cpyid), + CMD_ITERM(kpipette_set_common_cfg), + CMD_ITERM(kpipette_get_common_cfg), + CMD_ITERM(kpipette_zmotor_enable), CMD_ITERM(kpipette_zmotor_move_zero), CMD_ITERM(kpipette_zmotor_move_to_zero_point_quick), diff --git a/usrc/a8000_protocol/protocol/cmdid.hpp b/usrc/a8000_protocol/protocol/cmdid.hpp index 3136bf2..019c693 100644 --- a/usrc/a8000_protocol/protocol/cmdid.hpp +++ b/usrc/a8000_protocol/protocol/cmdid.hpp @@ -148,6 +148,8 @@ typedef enum { kpipette_get_pmvcfg_max_cpyid = 0x7412, kpipette_get_container_info_max_cpyid = 0x7413, kpipette_get_liquid_info_max_cpyid = 0x7414, + kpipette_set_common_cfg = 0x7415, // {index,val}, ack:{} + kpipette_get_common_cfg = 0x7416, // {index}, ack:{val} kpipette_zmotor_enable = 0x7500, kpipette_zmotor_move_zero = 0x7501, diff --git a/usrc/subboards/subboard80_cliptip/subboard80_cliptip.cpp b/usrc/subboards/subboard80_cliptip/subboard80_cliptip.cpp index 483824b..dcb015f 100644 --- a/usrc/subboards/subboard80_cliptip/subboard80_cliptip.cpp +++ b/usrc/subboards/subboard80_cliptip/subboard80_cliptip.cpp @@ -64,6 +64,8 @@ void Subboard80Cliptip::initialize() { static ZGPIO input[2]; input[0].initAsInput(MOTOR1_REFL, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFL_MIRROR); input[1].initAsInput(MOTOR1_REFR, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFR_MIRROR); + + ZLOGI(TAG, "IO0:%d IO1:%d", input[0].getState(), input[1].getState()); // PipetteModule::hardward_config_t hardwarecfg = {