|
@ -40,7 +40,7 @@ void PipetteModule::initialize(int32_t id, config_t *config, StepMotorCtrlModule |
|
|
m_config.pump_vstart = 0; |
|
|
m_config.pump_vstart = 0; |
|
|
m_config.pump_vstop = 900; |
|
|
m_config.pump_vstop = 900; |
|
|
m_config.aspirate_distribut_pump_vel = 100; //
|
|
|
m_config.aspirate_distribut_pump_vel = 100; //
|
|
|
m_config.pump_vmax = 1400; |
|
|
|
|
|
|
|
|
m_config.pump_vmax = 1000; |
|
|
m_config.lld_pump_vel = 100; // lld推荐使用速度为50->200,这里
|
|
|
m_config.lld_pump_vel = 100; // lld推荐使用速度为50->200,这里
|
|
|
m_config.lld_motor_vel_rpm = 50; |
|
|
m_config.lld_motor_vel_rpm = 50; |
|
|
m_config.lld_detect_period_ms = 100; // 100ms
|
|
|
m_config.lld_detect_period_ms = 100; // 100ms
|
|
@ -168,15 +168,8 @@ int32_t PipetteModule::pipette_lld_is_detect_liquid(int32_t *detect_liquid) { / |
|
|
* ACTION * |
|
|
* ACTION * |
|
|
***********************************************************************************************************************/ |
|
|
***********************************************************************************************************************/ |
|
|
int32_t PipetteModule::do_pipette_ctrl_init_device() { |
|
|
int32_t PipetteModule::do_pipette_ctrl_init_device() { |
|
|
creg.module_status = 1; |
|
|
|
|
|
|
|
|
|
|
|
// 检查tip头状态
|
|
|
|
|
|
int32_t tipstate = 0; |
|
|
|
|
|
int32_t ret = m_smtp2.pump_get_tip_state(&tipstate); |
|
|
|
|
|
if (ret != 0) return ret; |
|
|
|
|
|
if (tipstate != 0) return err::kpipette_error_tipisload_when_lld_prepare; |
|
|
|
|
|
|
|
|
|
|
|
m_thread.stop(); |
|
|
m_thread.stop(); |
|
|
|
|
|
creg.module_status = 1; |
|
|
m_thread.start( |
|
|
m_thread.start( |
|
|
[this]() { //
|
|
|
[this]() { //
|
|
|
DO_IN_THREAD(befor_run()); |
|
|
DO_IN_THREAD(befor_run()); |
|
@ -194,7 +187,7 @@ int32_t PipetteModule::do_pipette_ctrl_init_device() { |
|
|
}, |
|
|
}, |
|
|
[this]() { // exit fn
|
|
|
[this]() { // exit fn
|
|
|
after_run(); |
|
|
after_run(); |
|
|
|
|
|
|
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
if (creg.module_errorcode == 0) { |
|
|
if (creg.module_errorcode == 0) { |
|
|
m_state.load_val_ul = 0; |
|
|
m_state.load_val_ul = 0; |
|
|
m_state.aspirated = 0; |
|
|
m_state.aspirated = 0; |
|
@ -239,6 +232,8 @@ int32_t PipetteModule::do_pipette_ctrl_put_tip() { |
|
|
}, |
|
|
}, |
|
|
[this]() { // exit fn
|
|
|
[this]() { // exit fn
|
|
|
after_run(); |
|
|
after_run(); |
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
|
|
|
|
|
|
if (creg.module_errorcode == 0) { |
|
|
if (creg.module_errorcode == 0) { |
|
|
m_state.load_val_ul = 0; |
|
|
m_state.load_val_ul = 0; |
|
|
m_state.aspirated = 0; |
|
|
m_state.aspirated = 0; |
|
@ -269,6 +264,8 @@ int32_t PipetteModule::do_pipette_ctrl_move_to_ul(int32_t ul) { |
|
|
}, |
|
|
}, |
|
|
[this]() { // exit fn
|
|
|
[this]() { // exit fn
|
|
|
after_run(); |
|
|
after_run(); |
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
|
|
|
|
|
|
ZLOGI(TAG, "do_pipette_ctrl_move_to_ul finish,ecode:%d", creg.module_errorcode); |
|
|
ZLOGI(TAG, "do_pipette_ctrl_move_to_ul finish,ecode:%d", creg.module_errorcode); |
|
|
} //
|
|
|
} //
|
|
|
); |
|
|
); |
|
@ -302,10 +299,11 @@ int32_t PipetteModule::do_pipette_lld_prepare() { |
|
|
if (tipstate != 0) return err::kpipette_error_tipisload_when_lld_prepare; |
|
|
if (tipstate != 0) return err::kpipette_error_tipisload_when_lld_prepare; |
|
|
|
|
|
|
|
|
m_thread.stop(); |
|
|
m_thread.stop(); |
|
|
|
|
|
creg.module_status = 1; |
|
|
m_thread.start( |
|
|
m_thread.start( |
|
|
[this]() { //
|
|
|
[this]() { //
|
|
|
DO_IN_THREAD(befor_run()); |
|
|
DO_IN_THREAD(befor_run()); |
|
|
DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_config.pump_vmax, PIPETTE_PREPARE_POS)); // 移动到中点
|
|
|
|
|
|
|
|
|
DO_IN_THREAD(m_smtp2.pump_move_to_ul(m_config.pump_vmax, m_config.lld_prepare_pos)); // 移动到中点
|
|
|
|
|
|
|
|
|
while (true) { |
|
|
while (true) { |
|
|
if (!check_when_run()) break; |
|
|
if (!check_when_run()) break; |
|
@ -320,6 +318,8 @@ int32_t PipetteModule::do_pipette_lld_prepare() { |
|
|
}, |
|
|
}, |
|
|
[this]() { // exit fn
|
|
|
[this]() { // exit fn
|
|
|
after_run(); |
|
|
after_run(); |
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
|
|
|
|
|
|
if (creg.module_errorcode == 0) { |
|
|
if (creg.module_errorcode == 0) { |
|
|
m_state.lld_prepared = 1; |
|
|
m_state.lld_prepared = 1; |
|
|
} |
|
|
} |
|
@ -377,18 +377,21 @@ int32_t PipetteModule::do_pipette_lld(lld_mode_t mode, int32_t zdpos, int32_t c_ |
|
|
ZLOGI(TAG, "start lld before distribut"); |
|
|
ZLOGI(TAG, "start lld before distribut"); |
|
|
DO_IN_THREAD(m_smtp2.pump_distribut(m_config.pump_vmax, m_config.lld_prepare_distribut_pos)); |
|
|
DO_IN_THREAD(m_smtp2.pump_distribut(m_config.pump_vmax, m_config.lld_prepare_distribut_pos)); |
|
|
while (true) { |
|
|
while (true) { |
|
|
if (!check_when_run()) break; |
|
|
|
|
|
if (m_thread.getExitFlag()) break; |
|
|
|
|
|
|
|
|
if (!check_when_run()) return; |
|
|
|
|
|
if (m_thread.getExitFlag()) return; |
|
|
|
|
|
|
|
|
int32_t isbusy = 0; |
|
|
int32_t isbusy = 0; |
|
|
DO_IN_THREAD(m_smtp2.pump_get_state(&isbusy)); |
|
|
DO_IN_THREAD(m_smtp2.pump_get_state(&isbusy)); |
|
|
if (isbusy == 0) break; |
|
|
if (isbusy == 0) break; |
|
|
|
|
|
|
|
|
|
|
|
m_thread.sleep(10); |
|
|
} |
|
|
} |
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
ZLOGI(TAG, "lld before distribut ok"); |
|
|
ZLOGI(TAG, "lld before distribut ok"); |
|
|
|
|
|
|
|
|
ZLOGI(TAG, "start lld"); |
|
|
ZLOGI(TAG, "start lld"); |
|
|
submotor->moveBy(zdpos, m_config.lld_motor_vel_rpm); |
|
|
submotor->moveBy(zdpos, m_config.lld_motor_vel_rpm); |
|
|
osDelay(50); |
|
|
|
|
|
|
|
|
osDelay(10); |
|
|
if (mode == kclld) { |
|
|
if (mode == kclld) { |
|
|
DO_IN_THREAD(m_smtp2.pump_clld(c_threshold)); |
|
|
DO_IN_THREAD(m_smtp2.pump_clld(c_threshold)); |
|
|
} else if (mode == kplld) { |
|
|
} else if (mode == kplld) { |
|
@ -453,8 +456,6 @@ int32_t PipetteModule::do_pipette_lld(lld_mode_t mode, int32_t zdpos, int32_t c_ |
|
|
m_thread.sleep(m_config.lld_detect_period_ms); |
|
|
m_thread.sleep(m_config.lld_detect_period_ms); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
[this]() { // exit fn
|
|
|
[this]() { // exit fn
|
|
|
auto submotor = m_zmotor->getMotor(); |
|
|
auto submotor = m_zmotor->getMotor(); |
|
@ -496,6 +497,7 @@ int32_t PipetteModule::do_pipette_aspirate(int32_t ul) { |
|
|
}, |
|
|
}, |
|
|
[this]() { // exit fn
|
|
|
[this]() { // exit fn
|
|
|
after_run(); |
|
|
after_run(); |
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
m_state.load_val_ul = m_state.load_val_ul + m_state.dul; |
|
|
m_state.load_val_ul = m_state.load_val_ul + m_state.dul; |
|
|
if (m_state.load_val_ul < 0) { |
|
|
if (m_state.load_val_ul < 0) { |
|
|
m_state.load_val_ul = 0; |
|
|
m_state.load_val_ul = 0; |
|
@ -533,6 +535,8 @@ int32_t PipetteModule::do_pipette_distribut(int32_t ul) { |
|
|
}, |
|
|
}, |
|
|
[this]() { // exit fn
|
|
|
[this]() { // exit fn
|
|
|
after_run(); |
|
|
after_run(); |
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
|
|
|
|
|
|
m_state.load_val_ul = m_state.load_val_ul + m_state.dul; |
|
|
m_state.load_val_ul = m_state.load_val_ul + m_state.dul; |
|
|
if (m_state.load_val_ul < 0) { |
|
|
if (m_state.load_val_ul < 0) { |
|
|
m_state.load_val_ul = 0; |
|
|
m_state.load_val_ul = 0; |
|
@ -573,6 +577,9 @@ int32_t PipetteModule::pipette_write_cmd_direct(uint8_t *tx, int32_t len, uint8_ |
|
|
|
|
|
|
|
|
int32_t PipetteModule::befor_run() { |
|
|
int32_t PipetteModule::befor_run() { |
|
|
//
|
|
|
//
|
|
|
|
|
|
ZLOGI(TAG, "befor_run"); |
|
|
|
|
|
|
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
creg.module_status = 1; |
|
|
creg.module_status = 1; |
|
|
creg.module_errorcode = 0; |
|
|
creg.module_errorcode = 0; |
|
|
DO(module_active_cfg()); |
|
|
DO(module_active_cfg()); |
|
@ -580,6 +587,9 @@ int32_t PipetteModule::befor_run() { |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
int32_t PipetteModule::after_run() { |
|
|
int32_t PipetteModule::after_run() { |
|
|
|
|
|
ZLOGI(TAG, "after_run"); |
|
|
|
|
|
m_smtp2.pump_stop(); |
|
|
|
|
|
|
|
|
int32_t err = 0; |
|
|
int32_t err = 0; |
|
|
err = creg.module_errorcode; |
|
|
err = creg.module_errorcode; |
|
|
if (err != 0) goto tag_err; |
|
|
if (err != 0) goto tag_err; |
|
|