diff --git a/a8000_protocol b/a8000_protocol index e4ccf30..86de5f6 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit e4ccf301ebe4edb258ec95a90c2389d8caa394c1 +Subproject commit 86de5f61c4bcbb488ba1f03b67e5a5b95bdc074f diff --git a/sdk/components/pipette_module/pipette_ctrl_module_v1.cpp b/sdk/components/pipette_module/pipette_ctrl_module_v1.cpp index 37f8bc5..167d8bf 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_v1.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_v1.cpp @@ -728,7 +728,7 @@ // creg.module_errorcode = 0; // m_state.dul = 0; // DO(module_active_cfg()); -// DO(m_smtp2.pump_get_motor_pos_ul(&m_state.pump_before_pos_ul)); +// DO(m_smtp2.pump_get_ul(&m_state.pump_before_pos_ul)); // return 0; // } @@ -748,7 +748,7 @@ // err = creg.module_errorcode; // if (err != 0) goto tag_err; -// err = m_smtp2.pump_get_motor_pos_ul(&m_state.pump_after_pos_ul); +// err = m_smtp2.pump_get_ul(&m_state.pump_after_pos_ul); // if (err != 0) goto tag_err; // m_state.dul = m_state.pump_after_pos_ul - m_state.pump_before_pos_ul; diff --git a/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp b/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp index c715acc..d721c29 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp @@ -33,10 +33,10 @@ #define THREAD_START_WORK(...) thread_start_work(__FUNCTION__, __VA_ARGS__) -#define PIPETTE_PREPARE_POS 250 +#define PIPETTE_PREPARE_POS 450 #define LLD_PREPARE_DISTRIBUT_POS 50 // #define LLF_DPOS 1000 -#define ASPIRATE_POS 150 +#define ASPIRATE_POS 200 using namespace iflytop; // using namespace pipette_module_v3; @@ -324,6 +324,7 @@ int32_t PipetteModuleV2::pipette_init_device() { int32_t PipetteModuleV2::pipette_put_tip() { THREAD_START_WORK([this]() { DO_IN_THREAD(m_smtp2.pump_put_tip()); + m_state.lld_prepared = 0; pump_waitfor_stop(); }); return 0; @@ -331,11 +332,6 @@ int32_t PipetteModuleV2::pipette_put_tip() { int32_t PipetteModuleV2::pipette_lld_prepare() { THREAD_START_WORK([this]() { - if (m_state.lld_prepared == 1) { - ZLOGI(TAG, "has already prepared"); - return; - } - ZLOGI(TAG, "zmotor move to zero"); zm_move_to(0, m_cfg.zm_default_velocity); zm_waitfor_stop(); @@ -347,6 +343,9 @@ int32_t PipetteModuleV2::pipette_lld_prepare() { DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_cfg.pump_vmax, 0)); // 移动到零点 pump_waitfor_stop(); } + ZLOGI(TAG, "pump move to 0"); + DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_cfg.pump_vmax, 0)); // 移动到中点 + pump_waitfor_stop(); ZLOGI(TAG, "pump move to lld_prepare_pos %d", m_cfg.lld_prepare_pos); DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_cfg.pump_vmax, m_cfg.lld_prepare_pos)); // 移动到中点 @@ -375,17 +374,22 @@ int32_t PipetteModuleV2::pipette_aspirate_prepare() { ZLOGI(TAG, "pipette_aspirate_prepare"); m_state.load_val_ul = 0; int32_t nowpos = zm_get_now_pos(); - int32_t bak = nowpos - 100; + int32_t bak = nowpos - 200; if (bak < 0) bak = 0; zm_move_to(bak, m_cfg.zm_default_velocity); zm_waitfor_stop(); - DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_cfg.pump_vmax, 0)); - pump_waitfor_stop(); + // DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_cfg.pump_vmax, 0)); + // pump_waitfor_stop(); - DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_cfg.pump_vmax, ASPIRATE_POS)); - pump_waitfor_stop(); + int32_t nowul; + DO_IN_THREAD(m_smtp2.pump_get_ul(&nowul)); + + if (nowul > ASPIRATE_POS) { + DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_cfg.pump_vmax, ASPIRATE_POS)); + pump_waitfor_stop(); + } zm_move_to(nowpos, m_cfg.zm_default_velocity); zm_waitfor_stop(); @@ -483,12 +487,12 @@ int32_t PipetteModuleV2::pipette_aspirate(int32_t ul) { pump_waitfor_stop(); // 全部排空时,多分配10ul去掉挂液 - if ((m_state.load_val_ul + dul) == 0) { - m_smtp2.pump_aspirate(m_cfg.aspirate_pump_vel, -50); - pump_waitfor_stop(); - // for (size_t i = 0; i < 3; i++) { - // } - } + // if ((m_state.load_val_ul + dul) == 0) { + // m_smtp2.pump_move_to_ul(m_cfg.aspirate_pump_vel, 0); + // pump_waitfor_stop(); + // // for (size_t i = 0; i < 3; i++) { + // // } + // } // stop m_zm->stop(); @@ -538,6 +542,31 @@ int32_t PipetteModuleV2::pipette_aspirate_and_verify(int32_t ul) { return 0; } +int32_t PipetteModuleV2::pipette_clear_hanging_liquid(int32_t repeat_times) { + // llf_startz + // llf_endz + THREAD_START_WORK([this, repeat_times]() { + // 全部排空时,多分配10ul去掉挂液 + m_smtp2.pump_move_to_ul(m_cfg.pump_vmax, 0); + pump_waitfor_stop(); + m_state.load_val_ul = 0; + + int32_t nowpos = zm_get_now_pos(); + int32_t pos1 = nowpos - 100; + int32_t pos2 = nowpos - 10; + if (pos1 < 0) pos1 = 0; + if (pos2 < 0) pos2 = 0; + + for (int i = 0; i < repeat_times; i++) { + zm_move_to(pos1, m_cfg.zm_default_velocity); + zm_waitfor_stop(); + zm_move_to(pos2, m_cfg.zm_default_velocity); + zm_waitfor_stop(); + } + }); + return 0; +} + int32_t PipetteModuleV2::pipette_shake_up(int32_t ul, int32_t times) { if (m_state.load_val_ul != 0) { ZLOGE(TAG, "pipette_shake_up fail, load_val_ul %d != 0", m_state.load_val_ul); @@ -1077,7 +1106,7 @@ void PipetteModuleV2::thread_start_work(const char *fnname, function fn) try { // before do int32_t startpos = zm_get_now_pos(); - // DO_IN_THREAD(m_smtp2.pump_get_motor_pos_ul(&pump_before_pos_ul)); + // DO_IN_THREAD(m_smtp2.pump_get_ul(&pump_before_pos_ul)); // do fn if (fn) fn(); @@ -1086,7 +1115,7 @@ void PipetteModuleV2::thread_start_work(const char *fnname, function fn) m_smtp2.pump_stop(); // after do - // DO_IN_THREAD(m_smtp2.pump_get_motor_pos_ul(&pump_after_pos_ul)); + // DO_IN_THREAD(m_smtp2.pump_get_ul(&pump_after_pos_ul)); int32_t endpos = zm_get_now_pos(); // m_state.dul = pump_after_pos_ul - pump_before_pos_ul; m_state.dpos = endpos - startpos; diff --git a/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp b/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp index dc6f67b..02d0070 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp @@ -202,6 +202,8 @@ class PipetteModuleV2 : public ZIModule { virtual int32_t pipette_aspirate_and_verify(int32_t ul); virtual int32_t pipette_shake_up(int32_t ul, int32_t times); + virtual int32_t pipette_clear_hanging_liquid(int32_t repeat_times); + virtual int32_t pipette_aspirate_infer_pressure(int32_t ul); virtual int32_t pipette_aspirate_infer_eigen_time(int32_t ul); virtual int32_t pipette_get_aspirate_infer_pressure_result(int32_t *result); diff --git a/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp b/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp index ea67c23..1d27bae 100644 --- a/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp +++ b/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp @@ -48,6 +48,10 @@ int32_t SMTP2V2::pump_get_state_as_int(int32_t state_index, int32_t* val) { return err::ksucc; } + + +// pump_get_state_as_int(kstate_pump_pos_nl, &nownl); + int32_t SMTP2V2::pump_get_capacitance(int32_t* capacitance) { return pump_get_state_as_int(kstate_capacitance, capacitance); } int32_t SMTP2V2::pump_get_pressure(int32_t* pressure) { // return pump_get_state_as_int(kstate_pressure_ad, pressure); @@ -55,7 +59,7 @@ int32_t SMTP2V2::pump_get_pressure(int32_t* pressure) { // int32_t SMTP2V2::pump_get_tip_state(int32_t* tipison) { return pump_get_state_as_int(kstate_tip_state, tipison); } -int32_t SMTP2V2::pump_get_motor_pos_ul(int32_t* ul) { +int32_t SMTP2V2::pump_get_ul(int32_t* ul) { int32_t nl = 0; int32_t ret = pump_get_state_as_int(kstate_pump_pos_nl, &nl); if (ret != 0) return ret; diff --git a/sdk/components/sensors/smtp2_v2/smtp2_v2.hpp b/sdk/components/sensors/smtp2_v2/smtp2_v2.hpp index 9455f57..a39d2b1 100644 --- a/sdk/components/sensors/smtp2_v2/smtp2_v2.hpp +++ b/sdk/components/sensors/smtp2_v2/smtp2_v2.hpp @@ -165,10 +165,12 @@ class SMTP2V2 { int32_t pump_get_capacitance(int32_t* capacitance); int32_t pump_get_pressure(int32_t* pressure); int32_t pump_get_tip_state(int32_t* tipison); - int32_t pump_get_motor_pos_ul(int32_t* ul); + int32_t pump_get_ul(int32_t* ul); int32_t pump_get_state_as_int(int32_t state_index, int32_t* val); + // pump_get_state_as_int(kstate_pump_pos_nl, &nownl); + /*********************************************************************************************************************** * CONFIG * ***********************************************************************************************************************/ diff --git a/sdk/components/zcancmder/basic.cpp b/sdk/components/zcancmder/basic.cpp index ac8ec59..c6a76d2 100644 --- a/sdk/components/zcancmder/basic.cpp +++ b/sdk/components/zcancmder/basic.cpp @@ -29,7 +29,7 @@ uint8_t *CanPacketRxBuffer::get_params() { uint16_t CanPacketRxBuffer::get_params_len() { return rxdataSize - sizeof(zcr_cmd_header_t); } void CanPacketRxBuffer::clear() { id = 0; - memset(&m_canPacket, 0, sizeof(m_canPacket) / sizeof(m_canPacket[0])); + memset(&m_canPacket, 0, sizeof(m_canPacket)); //fix m_canPacketNum = 0; m_npacket = 0; memset(rxdata, 0, sizeof(rxdata)); diff --git a/sdk/components/zcancmder/zcan_protocol_parser.cpp b/sdk/components/zcancmder/zcan_protocol_parser.cpp index 2cb5b93..1c89714 100644 --- a/sdk/components/zcancmder/zcan_protocol_parser.cpp +++ b/sdk/components/zcancmder/zcan_protocol_parser.cpp @@ -188,6 +188,7 @@ void ZCanProtocolParser::initialize(IZCanReceiver* cancmder) { REGFN(pipette_set_lld_p_threshold); REGFN(pipette_set_llf_startz); REGFN(pipette_set_llf_endz); + REGFN(pipette_clear_hanging_liquid); } void ZCanProtocolParser::_registerModule(uint16_t id, ZIModule* module) { m_modulers[id] = module; } void ZCanProtocolParser::registerModule(ZIModule* module) { @@ -1119,7 +1120,11 @@ int32_t ZCanProtocolParser::pipette_set_llf_endz(cmdcontxt_t* cxt) { CHECK_AND_GET_MODULE(1); return module->pipette_set_llf_endz(cxt->params[0]); } - +// pipette_clear_hanging_liquid +int32_t ZCanProtocolParser::pipette_clear_hanging_liquid(cmdcontxt_t* cxt) { + CHECK_AND_GET_MODULE(1); + return module->pipette_clear_hanging_liquid(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 c172f5b..e75c4ef 100644 --- a/sdk/components/zcancmder/zcan_protocol_parser.hpp +++ b/sdk/components/zcancmder/zcan_protocol_parser.hpp @@ -221,6 +221,7 @@ class ZCanProtocolParser : public IZCanReceiverListener { CMDFN(pipette_set_lld_p_threshold); CMDFN(pipette_set_llf_startz); CMDFN(pipette_set_llf_endz); + CMDFN(pipette_clear_hanging_liquid);