|
|
@ -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
|