diff --git a/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp b/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp index 52c822a..4152219 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp @@ -521,6 +521,7 @@ int32_t PipetteModule::do_pipette_aspirate(int32_t ul, int32_t zmotor_v) { after_run(); m_smtp2.pump_stop(); m_zmotor->getMotor()->stop(); + // ZLOGI(TAG, "do_pipette_aspirate finish, load_val_ul:%d,m_state.dul:%d before:%d after:%d", m_state.load_val_ul, m_state.dul, m_state.pump_before_pos_ul, m_state.pump_after_pos_ul); m_state.load_val_ul = m_state.load_val_ul + m_state.dul; if (m_state.load_val_ul < 0) { m_state.load_val_ul = 0; @@ -547,7 +548,10 @@ int32_t PipetteModule::do_pipette_distribut(int32_t ul, int32_t zmotor_v) { auto submotor = m_zmotor->getMotor(); pipette_enable_zmotor(1); DO_IN_THREAD(befor_run()); - DO_IN_THREAD(m_smtp2.pump_distribut(m_config.aspirate_distribut_pump_vel, ul)); + + int32_t distribut_ul = ul; + if (distribut_ul == 0) distribut_ul = m_state.load_val_ul; + DO_IN_THREAD(m_smtp2.pump_distribut(m_config.aspirate_distribut_pump_vel, distribut_ul)); if (zmotor_v != 0) { submotor->moveBy(-LLF_DPOS, zmotor_v); } @@ -718,8 +722,10 @@ int32_t PipetteModule::befor_run() { m_smtp2.pump_stop(); creg.module_status = 1; 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)); + return 0; } int32_t PipetteModule::after_run() { diff --git a/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp b/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp index 2654eda..e92dba4 100644 --- a/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp +++ b/sdk/components/sensors/smtp2_v2/smtp2_v2.cpp @@ -30,7 +30,7 @@ bool SMTP2V2::pump_ping() { } int32_t SMTP2V2::pump_get_state(int32_t* isbusy) { size_t rxlen = 0; - int ret = sendcmd(false /*dump*/, 3 /*retry_times*/, "/1QR\r"); + int ret = sendcmd(false /*dump*/, 5 /*retry_times*/, "/1QR\r"); if (ret != 0) return ret; uint8_t errorcode = (uint8_t)m_rxbuf[2]; @@ -63,7 +63,7 @@ int32_t SMTP2V2::pump_get_motor_pos_ul(int32_t* ul) { int32_t ret = pump_get_state_as_int(kstate_pump_pos_nl, &nl); if (ret != 0) return ret; - *ul = nl * 1000; + *ul = nl / 1000.0 + 0.5; return ret; } @@ -234,6 +234,7 @@ bool SMTP2V2::sendcmd_auto_retry(bool dump, int auto_retry_times, const char* cm if (_sendcmd(dump, cmd)) { break; } + osDelay(10); m_rxNum = 0; return false; } diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 45358da..714f791 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,5 +1,5 @@ #pragma once -#define PC_VERSION 505 +#define PC_VERSION 506 #define PC_MANUFACTURER "http://www.iflytop.com/" #define PC_PROJECT_NAME "a8000_subboard" #define PC_IFLYTOP_ENABLE_OS 1