From 65d79a4600e582ae96a3335e628801c05d8596cd Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 8 Jul 2024 17:37:24 +0800 Subject: [PATCH] =?UTF-8?q?V506=20=E4=BF=AE=E5=A4=8D=E7=A7=BB=E6=B6=B2?= =?UTF-8?q?=E6=B3=B5=E5=90=B8=E5=8F=96=E5=92=8C=E5=88=86=E9=85=8DBUG?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=89=B9=E6=80=A7=EF=BC=8C=E5=88=86?= =?UTF-8?q?=E9=85=8D0ml=E6=89=A7=E8=A1=8C=E5=85=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=85=8D=E5=8A=A8=E4=BD=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/components/pipette_module/pipette_ctrl_module_v2.cpp | 8 +++++++- sdk/components/sensors/smtp2_v2/smtp2_v2.cpp | 5 +++-- usrc/project_configs.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) 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