|
|
@ -42,35 +42,85 @@ void PipetteModule::pump_do_lld(int32_t pressure_threshold, int32_t ___, int32_t |
|
|
|
DO_IN_THREAD(m_smtp2.pump_aspirate_plld(pressure_threshold, &vcfg)); |
|
|
|
} |
|
|
|
|
|
|
|
void PipetteModule::pump_move_to_x100nl_block(double x100nl, int32_t vcfgcpyid, int32_t *diff) { |
|
|
|
void PipetteModule::_pump_move_to_x100nl_block(bool accurate, double x100nl, int32_t vcfgcpyid) { |
|
|
|
ZLOGI(TAG, "pump_move_to_x100nl_block %f nl, in %s", x100nl, get_pm_vcpyid_name((pm_vcpyid_t)vcfgcpyid)); |
|
|
|
|
|
|
|
int32_t diff_pos = 0; |
|
|
|
int32_t refTryDiff = 0; |
|
|
|
int32_t maxDiff = 0; |
|
|
|
|
|
|
|
if (accurate) { |
|
|
|
refTryDiff = 100; // 精确模式,允许误差100nl
|
|
|
|
maxDiff = 200; // 精确模式,最大误差200nl
|
|
|
|
clear_aspiration_pressure_sample_data(); // 清除吸取压力采样数据
|
|
|
|
} else { |
|
|
|
refTryDiff = 300; // 非精确模式,允许误差300nl
|
|
|
|
maxDiff = 500; // 非精确模式,最大误差500nl
|
|
|
|
} |
|
|
|
|
|
|
|
int32_t diff_pos = 0; |
|
|
|
int32_t first_pressrure = 0; |
|
|
|
smtpPressureStreamProcesser.clearPressure(); |
|
|
|
m_smtp2.set_aspirate_pressure_report_extend_time(m_common_cfg.aspirate_pressure_report_extend_time); |
|
|
|
|
|
|
|
for (size_t i = 0; i < 4; i++) { |
|
|
|
int32_t vcpyid = vcfgcpyid; |
|
|
|
// if (i != 0) {
|
|
|
|
// vcpyid = kpm_v_slow_lv1;
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (accurate && i == 0) { |
|
|
|
DO_IN_THREAD(m_smtp2.pump_get_pressure(&first_pressrure)); |
|
|
|
push_aspiration_pressure_sample_data(first_pressrure); |
|
|
|
} |
|
|
|
|
|
|
|
_pump_move_to_x100nl(x100nl, vcpyid); |
|
|
|
pump_waitfor_stop(); |
|
|
|
int32_t targetpos = x100nl * 100; |
|
|
|
int32_t after_pos = pump_read_pos_nl(); |
|
|
|
diff_pos = targetpos - after_pos; |
|
|
|
if (diff) *diff = diff_pos; |
|
|
|
int32_t pressure = 0; |
|
|
|
int32_t pressure_uuid = 0; |
|
|
|
int32_t pressure_uuid_is_change = 0; |
|
|
|
int32_t pressure_uuid_is_change_cnt = 0; |
|
|
|
int32_t isbusy; |
|
|
|
while (true) { |
|
|
|
if (!smtpPressureStreamProcesser.isReady()) { |
|
|
|
thread_delay(3); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
smtpPressureStreamProcesser.getPressure(&pressure, &pressure_uuid, &pressure_uuid_is_change); |
|
|
|
if (pressure_uuid_is_change) { |
|
|
|
pressure_uuid_is_change_cnt = 0; |
|
|
|
ZLOGI(TAG, "pressure:%d (%d)", pressure, pressure_uuid); |
|
|
|
if (accurate && i == 0) { |
|
|
|
push_aspiration_pressure_sample_data(pressure); |
|
|
|
} |
|
|
|
} else { |
|
|
|
pressure_uuid_is_change_cnt++; |
|
|
|
if (pressure_uuid_is_change_cnt >= 3) { |
|
|
|
DO_IN_THREAD(m_smtp2.pump_get_state(&isbusy)); |
|
|
|
if (isbusy == 0) { |
|
|
|
break; // 停止了
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
m_thread.sleep(5); |
|
|
|
if (m_thread.getExitFlag()) throw zapp_thread_stoped_exception(); |
|
|
|
} |
|
|
|
push_aspiration_pressure_sample_data(-1); // 结束标志
|
|
|
|
|
|
|
|
int32_t targetpos = x100nl * 100; |
|
|
|
int32_t after_pos = pump_read_pos_nl(); |
|
|
|
diff_pos = targetpos - after_pos; |
|
|
|
m_last_pump_operation_diff_val = diff_pos; |
|
|
|
ZLOGI(TAG, "pump target %d nl, now pos %d nl diff %d", targetpos, after_pos, diff_pos); |
|
|
|
if (abs(diff_pos) > 100) { |
|
|
|
if (abs(diff_pos) > refTryDiff) { |
|
|
|
ZLOGW(TAG, "pump move to x100nl %d failed, diff is too large retrying...", x100nl); |
|
|
|
continue; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
if (abs(diff_pos) > 300) { |
|
|
|
if (abs(diff_pos) > maxDiff) { |
|
|
|
module_detail_errorcode = diff_pos; |
|
|
|
throw zapp_exception(err::kpipette_pm_positioning_abnormality); |
|
|
|
} |
|
|
|
} |
|
|
|
void PipetteModule::pump_move_by_x100nl_block(double x100nl, int32_t vcfgcpyid) { |
|
|
|
void PipetteModule::_pump_move_by_x100nl_block(bool accurate, double x100nl, int32_t vcfgcpyid) { |
|
|
|
int32_t startpos = pump_read_pos_nl(); |
|
|
|
if (startpos > 1500000) { |
|
|
|
// 参考 https://iflytop1.feishu.cn/wiki/IWn1waKCXiUvzfkOru5c0F3HnJf
|
|
|
@ -81,9 +131,15 @@ void PipetteModule::pump_move_by_x100nl_block(double x100nl, int32_t vcfgcpyid) |
|
|
|
if (targetpos < 0) { |
|
|
|
targetpos = 0; |
|
|
|
} |
|
|
|
pump_move_to_x100nl_block(targetpos / 100, vcfgcpyid); |
|
|
|
_pump_move_to_x100nl_block(accurate, targetpos / 100, vcfgcpyid); |
|
|
|
} |
|
|
|
|
|
|
|
void PipetteModule::pump_move_to_x100nl_block(double x100nl, int32_t vcfgcpyid) { _pump_move_to_x100nl_block(false, x100nl, vcfgcpyid); } |
|
|
|
void PipetteModule::pump_move_by_x100nl_block(double x100nl, int32_t vcfgcpyid) { _pump_move_by_x100nl_block(false, x100nl, vcfgcpyid); } |
|
|
|
|
|
|
|
void PipetteModule::pump_move_to_x100nl_accurate_block(double x100nl, int32_t vcfgcpyid) { _pump_move_to_x100nl_block(true, x100nl, vcfgcpyid); } |
|
|
|
void PipetteModule::pump_move_by_x100nl_accurate_block(double x100nl, int32_t vcfgcpyid) { _pump_move_by_x100nl_block(true, x100nl, vcfgcpyid); } |
|
|
|
|
|
|
|
void PipetteModule::pump_start_lld(double target_x100nl, int32_t vcfgindex) { //
|
|
|
|
_pump_move_to_x100nl(target_x100nl, vcfgindex); |
|
|
|
} |
|
|
|