From 4635b296aee37f5cc4783918209eeffc48c997c1 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 5 Oct 2023 17:56:15 +0800 Subject: [PATCH] update --- components/pipette_module/pipette_ctrl_module.cpp | 6 +- components/pipette_module/pipette_ctrl_module.hpp | 4 +- .../zcancmder_module/zcan_pipette_module.cpp | 128 ++++++--------------- components/zprotocols/zcancmder | 2 +- 4 files changed, 38 insertions(+), 102 deletions(-) diff --git a/components/pipette_module/pipette_ctrl_module.cpp b/components/pipette_module/pipette_ctrl_module.cpp index 992f886..7173380 100644 --- a/components/pipette_module/pipette_ctrl_module.cpp +++ b/components/pipette_module/pipette_ctrl_module.cpp @@ -202,7 +202,7 @@ int32_t PipetteModule::move_to_with_lld( // }); return 0; } -int32_t PipetteModule::shake_volume(s16 shake_times, s16 shake_volume, action_cb_status_t status_cb) { +int32_t PipetteModule::shake(s16 shake_times, s16 shake_volume, action_cb_status_t status_cb) { ZLOGI(TAG, "shake_volume %d %d", shake_times, shake_volume); m_thread.stop(); m_thread.start([this, shake_times, shake_volume, status_cb]() { @@ -216,8 +216,8 @@ int32_t PipetteModule::shake_volume(s16 shake_times, s16 shake_volume, action_cb }); return 0; } -int32_t PipetteModule::take_and_split_liquid(s16 take_volume_mm, action_cb_status_t status_cb) { - ZLOGI(TAG, "take_and_split_liquid %d", take_volume_mm); +int32_t PipetteModule::pipette_move_to_ul(s16 take_volume_mm, action_cb_status_t status_cb) { + ZLOGI(TAG, "pipette_move_to_ul %d", take_volume_mm); m_thread.stop(); m_thread.start([this, take_volume_mm, status_cb]() { DO("m_stepMotor->move_to_block(nowpos)", m_smtp2->move_to_ul(take_volume_mm)); diff --git a/components/pipette_module/pipette_ctrl_module.hpp b/components/pipette_module/pipette_ctrl_module.hpp index 34d5092..b800c7f 100644 --- a/components/pipette_module/pipette_ctrl_module.hpp +++ b/components/pipette_module/pipette_ctrl_module.hpp @@ -43,8 +43,8 @@ class PipetteModule : public I_PipetteModule { virtual int32_t move_to(s16 vel, s16 height_mm, action_cb_status_t status_cb) override; virtual int32_t move_to_with_lld(s16 vel, s16 lld_cap_thr, s16 lld_max_hight_mm, s16 lld_rela_hight_mm, action_cb_status_t status_cb) override; - virtual int32_t shake_volume(s16 shake_times, s16 shake_volume, action_cb_status_t status_cb) override; - virtual int32_t take_and_split_liquid(s16 take_volume_mm, action_cb_status_t status_cb) override; + virtual int32_t shake(s16 shake_times, s16 shake_volume, action_cb_status_t status_cb) override; + virtual int32_t pipette_move_to_ul(s16 take_volume_mm, action_cb_status_t status_cb) override; /******************************************************************************* * ReadStatus * diff --git a/components/zcancmder_module/zcan_pipette_module.cpp b/components/zcancmder_module/zcan_pipette_module.cpp index 73ce867..11e021e 100644 --- a/components/zcancmder_module/zcan_pipette_module.cpp +++ b/components/zcancmder_module/zcan_pipette_module.cpp @@ -10,131 +10,67 @@ void ZcanPipetteModule::initialize(ZCanCmder* cancmder, int id, I_PipetteModule* cancmder->registerListener(this); } void ZcanPipetteModule::onRceivePacket(CanPacketRxBuffer* rxcmd) { - // printf("ZcanPipetteModule::onRceivePacket %d %d\n", rxcmd->get_cmdheader()->cmdid, rxcmd->get_cmdheader()->subcmdid); - -#if 0 - kcmd_pipette_module_z_motor_enable = CMDID(1016, 0), // 使能 - kcmd_pipette_module_z_motor_move_to = CMDID(1016, 1), // 移动到 - kcmd_pipette_module_z_motor_move_to_zero = CMDID(1016, 2), // 归零 - kcmd_pipette_module_z_motor_move_to_zero_with_calibrate = CMDID(1016, 3), // 归零并校准 - kcmd_pipette_module_z_motor_stop = CMDID(1016, 4), // 停止 - - kcmd_pipette_module_take_liquid = CMDID(1016, 4), // 取液体 - kcmd_pipette_module_split_liquid = CMDID(1016, 5), // 吐液体 - kcmd_pipette_module_take_tip = CMDID(1016, 6), // 取tip - kcmd_pipette_module_remove_tip = CMDID(1016, 7), // 移除tip - - kcmd_pipette_module_read_version = CMDID(1016, 50), // 读取模块型号版本信息 - kcmd_pipette_module_read_status = CMDID(1016, 51), // 读取模块精简状态信息 - kcmd_pipette_module_read_detailed_status = CMDID(1016, 52), // 读取模块详细状态信息 - - kcmd_pipette_module_set_run_param = CMDID(1016, 100), // 设置运行参数 - kcmd_pipette_module_set_warning_limit_param = CMDID(1016, 101), // 设置限制参数 - kcmd_pipette_module_set_run_to_zero_param = CMDID(1016, 102), // 设置归零参数 -#endif - - - -#if 0 - PROCESS_PACKET(kcmd_step_motor_ctrl_enable, m_id) { errorcode = m_module->enable(cmd->enable); } + PROCESS_PACKET(kcmd_pipette_module_enable, m_id) { errorcode = m_module->enable(cmd->enable); } END_PP(); - - PROCESS_PACKET(kcmd_step_motor_ctrl_stop, m_id) { errorcode = m_module->stop(cmd->stop_type); } + PROCESS_PACKET(kcmd_pipette_module_stop, m_id) { errorcode = m_module->stop(cmd->stop_type); } END_PP(); - - PROCESS_PACKET(kcmd_step_motor_ctrl_move_to_zero, m_id) { - errorcode = m_module->move_to_zero([this, cmdheader](int32_t status) { - osDelay(5); // 用来保证回执消息在前面 - kcmd_step_motor_ctrl_move_to_zero_report_t report = {0}; - ZLOGI(TAG, "kcmd_step_motor_ctrl_move_to_zero exec_status:%d", status); - - report.id = m_id; - report.exec_status = status; - m_cancmder->sendExecStatusReport(cmdheader, (uint8_t*)&report, sizeof(report)); - }); + PROCESS_PACKET(kcmd_pipette_module_zero_pos_calibrate, m_id) { + errorcode = m_module->zero_pos_calibrate([this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_zero_pos_calibrate); }); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_move_to_zero_with_calibrate, m_id) { - errorcode = m_module->move_to_zero_with_calibrate(cmd->nowx, [this, cmdheader](int32_t status) { - osDelay(5); // 用来保证回执消息在前面 - kcmd_step_motor_ctrl_move_to_zero_with_calibrate_report_t report = {0}; - ZLOGI(TAG, "kcmd_step_motor_ctrl_move_to_zero_with_calibrate exec_status:%d", status); - - report.id = m_id; - report.exec_status = status; - m_cancmder->sendExecStatusReport(cmdheader, (uint8_t*)&report, sizeof(report)); - }); + PROCESS_PACKET(kcmd_pipeete_module_zmotor_reset, m_id) { + errorcode = m_module->zmotor_reset([this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipeete_module_zmotor_reset); }); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_move_to, m_id) { - errorcode = m_module->move_to(cmd->x, [this, cmdheader](int32_t status) { - osDelay(5); // 用来保证回执消息在前面 - kcmd_step_motor_ctrl_move_to_report_t report = {0}; - ZLOGI(TAG, "kcmd_step_motor_ctrl_move_to exec_status:%d ", status); - - report.id = m_id; - report.exec_status = status; - m_cancmder->sendExecStatusReport(cmdheader, (uint8_t*)&report, sizeof(report)); - }); + PROCESS_PACKET(kcmd_pipeete_module_pipette_reset, m_id) { + errorcode = m_module->pipette_reset([this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipeete_module_pipette_reset); }); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_move_by, m_id) { - errorcode = m_module->move_by(cmd->dx, [this, cmdheader](int32_t status) { - osDelay(5); // 用来保证回执消息在前面 - kcmd_step_motor_ctrl_move_by_report_t report = {0}; - // ZLOGI(TAG, "kcmd_step_motor_ctrl_move_by exec_status:%d %d", status.exec_status, status.dx); - ZLOGI(TAG, "kcmd_step_motor_ctrl_move_by exec_status:%d ", status); - - report.id = m_id; - report.exec_status = status; - m_cancmder->sendExecStatusReport(cmdheader, (uint8_t*)&report, sizeof(report)); - }); + PROCESS_PACKET(kcmd_pipette_module_take_tip, m_id) { + errorcode = m_module->take_tip(cmd->vel, cmd->height_mm, cmd->tip_hight_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_take_tip); }); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_force_change_current_pos, m_id) { errorcode = m_module->force_change_current_pos(cmd->x); } + PROCESS_PACKET(kcmd_pipette_module_remove_tip, m_id) { + errorcode = m_module->remove_tip(cmd->vel, cmd->height_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_remove_tip); }); + } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_rotate, m_id) { - errorcode = m_module->rotate(cmd->speed, cmd->run_time, [this, cmdheader](int32_t status) { - osDelay(5); // 用来保证回执消息在前面 - kcmd_step_motor_ctrl_rotate_report_t report = {0}; - // ZLOGI(TAG, "kcmd_step_motor_ctrl_rotate exec_status:%d %d", status.exec_status, status.lastforms); - ZLOGI(TAG, "kcmd_step_motor_ctrl_rotate exec_status:%d ", status); - - report.id = m_id; - report.exec_status = status; - m_cancmder->sendExecStatusReport(cmdheader, (uint8_t*)&report, sizeof(report)); - }); + PROCESS_PACKET(kcmd_pipette_module_move_to, m_id) { + errorcode = m_module->move_to(cmd->vel, cmd->height_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_move_to); }); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_read_version, m_id) { // - errorcode = m_module->read_version(ack->ack); + PROCESS_PACKET(kcmd_pipette_module_move_to_with_lld, m_id) { + errorcode = m_module->move_to_with_lld(cmd->vel, cmd->lld_cap_thr, cmd->lld_max_hight_mm, cmd->lld_rela_hight_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_move_to_with_lld); }); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_read_status, m_id) { // - errorcode = m_module->read_status(ack->ack); + PROCESS_PACKET(kcmd_pipette_module_shake, m_id) { + errorcode = m_module->shake(cmd->shake_times, cmd->shake_volume, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_shake); }); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_read_detailed_status, m_id) { // - errorcode = m_module->read_detailed_status(ack->ack); + PROCESS_PACKET(kcmd_pipette_module_pipette_move_to_ul, m_id) { + errorcode = m_module->pipette_move_to_ul(cmd->take_volume_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_pipette_move_to_ul); }); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_set_base_param, m_id) { // - errorcode = m_module->set_base_param(cmd->param); - } + PROCESS_PACKET(kcmd_pipette_module_get_status, m_id) { errorcode = m_module->get_status(ack->ack); } END_PP(); - PROCESS_PACKET(kcmd_step_motor_ctrl_get_base_param, m_id) { // - errorcode = m_module->get_base_param(ack->ack); - } + PROCESS_PACKET(kcmd_pipette_module_set_z_motor_para, m_id) { errorcode = m_module->set_z_motor_para(cmd->param); } + END_PP(); + + PROCESS_PACKET(kcmd_pipette_module_get_z_motor_para, m_id) { errorcode = m_module->get_z_motor_para(ack->ack); } + END_PP(); + + PROCESS_PACKET(kcmd_pipette_module_set_base_param, m_id) { errorcode = m_module->set_base_param(cmd->param); } + END_PP(); + + PROCESS_PACKET(kcmd_pipette_module_get_base_param, m_id) { errorcode = m_module->get_base_param(ack->ack); } END_PP(); -#endif } #endif \ No newline at end of file diff --git a/components/zprotocols/zcancmder b/components/zprotocols/zcancmder index eff35f5..7be6aaf 160000 --- a/components/zprotocols/zcancmder +++ b/components/zprotocols/zcancmder @@ -1 +1 @@ -Subproject commit eff35f5c915ddaa15cced3796ce2ba7c93ea5029 +Subproject commit 7be6aafbd44d3276331b77f49b1a04dcd65b2e12