diff --git a/.vscode/settings.json b/.vscode/settings.json index d1222ff..2ccc2ed 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -55,5 +55,5 @@ }, "files.autoGuessEncoding": false, "files.encoding": "utf8", - "autoGitCopilot.enabled": true + "autoGitCopilot.enabled": false } \ No newline at end of file diff --git a/sdk/components/pipette_module/pipette_ctrl_module.cpp b/sdk/components/pipette_module/pipette_ctrl_module.cpp index bec8d9f..f86cc75 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module.cpp @@ -778,7 +778,7 @@ int32_t PipetteModule::pipette_pump_distribu_all() { * EXT_API_UTILS * ***********************************************************************************************************************/ int32_t PipetteModule::pipette_zmotor_read_zero_point_state(int32_t *state) { - *state = zm0p_is_trigger(); + *state = m_zm0p->getState(); return 0; } int32_t PipetteModule::pipette_zmotor_read_dev_status_cache(int32_t *devStatus) { // diff --git a/sdk/components/pipette_module/pipette_ctrl_module.hpp b/sdk/components/pipette_module/pipette_ctrl_module.hpp index e9ac5f7..e317963 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module.hpp +++ b/sdk/components/pipette_module/pipette_ctrl_module.hpp @@ -204,6 +204,7 @@ class PipetteModule : public ZIModule { int32_t zm_get_now_pos(); void zm_set_now_pos(int32_t x); bool zm0p_is_trigger(); + bool zm0p_is_release(); void zm_apply_vcfg(int32_t vbasecfgindex, int32_t vel); void zm_sync_base_cfg(); 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 0dc2d54..96eac6a 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_zm_ctrl.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_zm_ctrl.cpp @@ -56,12 +56,9 @@ void PipetteModule::zm_move_to_lld_end_pos_block(int32_t container_pos, containe zm_move_to_block(container_pos + containInfo->container_depth - containInfo->lld_end_pos_margin, vbcpyid, vel); } - - - void PipetteModule::do_zm_move_0p() { bool is_trigger = false; - if (!zm0p_is_trigger()) { + if (zm0p_is_release()) { ZLOGI(TAG, "move to zero"); zm_move_to_end(-1, kzm_v_move_to_zero); zm_waitfor_zm0p_trigger_and_stop_motor(&is_trigger); @@ -76,7 +73,7 @@ void PipetteModule::do_zm_move_0p() { if (!is_trigger) throw zapp_exception(err::kstep_motor_not_found_point_edge); } - if (!zm0p_is_trigger()) { + if (zm0p_is_release()) { ZLOGI(TAG, "move to zero edge again"); zm_move_by(-100 /*10mm */, kzm_v_look_zero_edge, 0); zm_waitfor_zm0p_trigger_and_stop_motor(&is_trigger); @@ -99,7 +96,7 @@ void PipetteModule::zm_move_to_zero_quick_block() { // 期望偏差 int32_t expectation_dpos = -zmbcfg.io_trigger_append_distance + 0 + zmbcfg.dzero - zm_get_now_pos(); int32_t startpos = zm_get_now_pos(); - if (!zm0p_is_trigger()) { + if (zm0p_is_release()) { // 快速移动到零点 // moveTo(0 + zmbcfg.dzero, zmbcfg.default_velocity); zm_move_to(0 + zmbcfg.dzero, kzm_v_default, 0); @@ -165,7 +162,23 @@ void PipetteModule::zm_update_dzero(int32_t dzero) { zmbcfg.dzero = dzero; zm_set_now_pos(nowabs + zmbcfg.dzero); } -bool PipetteModule::zm0p_is_trigger() { return m_zm0p->getState(); } +bool PipetteModule::zm0p_is_trigger() { + for (size_t i = 0; i < 10; i++) { + if (!m_zm0p->getState()) return false; + zos_early_delayus(100); + } + + return true; +} + +bool PipetteModule::zm0p_is_release() { + for (size_t i = 0; i < 10; i++) { + if (m_zm0p->getState()) return false; + zos_early_delayus(100); + } + + return true; +} void PipetteModule::zm_apply_vcfg(int32_t vbasecfgindex, int32_t vel) { ZLOGI(TAG, "zm_apply_vcfg %s", get_zm_vcpyid_name((zm_vcpyid_t)vbasecfgindex)); @@ -211,7 +224,7 @@ void PipetteModule::zm_sync_base_cfg() { void PipetteModule::zm_waitfor_zm0p_trigger_and_stop_motor(bool *triggerEdge) { if (triggerEdge) *triggerEdge = true; - while (!zm0p_is_trigger()) { + while (zm0p_is_release()) { if (m_zm->isStoped()) { ZLOGI(TAG, "motor stop first....."); if (triggerEdge) *triggerEdge = false; diff --git a/usrc/version.h b/usrc/version.h index d6d51dc..2187730 100644 --- a/usrc/version.h +++ b/usrc/version.h @@ -1,2 +1,2 @@ #pragma once -#define APP_VERSION 1213 +#define APP_VERSION 1214