|
|
@ -139,6 +139,7 @@ void A8000ScriptProcesser::step_motor_move_by(shared_ptr<ScriptProcesser::Contex |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void A8000ScriptProcesser::step_motor_move_to_zero(shared_ptr<ScriptProcesser::Context> context, int32_t targetStepMotorId) { |
|
|
|
A8000ScriptProcesser::CtrlPointConfig cpcfg = getStepMotorConfig(targetStepMotorId, SAMC_REG_ACT_RUN_TO_HOME); |
|
|
|
writeReg(cpcfg.m_deviceId, cpcfg.m_ctrlPointId, 0, context); |
|
|
@ -164,6 +165,7 @@ void A8000ScriptProcesser::step_motor_wait_for_idle(shared_ptr<ScriptProcesser:: |
|
|
|
while (state != 0) { |
|
|
|
thisThread.sleepForMs(300); |
|
|
|
step_motor_is_idle(context, targetStepMotorId, state); |
|
|
|
logger->info("step_motor({}) wait_for_idle:{}", targetStepMotorId, state); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -205,7 +207,7 @@ void A8000ScriptProcesser::tube_rotate_zero(shared_ptr<ScriptProcesser::Context> |
|
|
|
|
|
|
|
#define CHECK_CMD_PARAMETER(expectParaNum) \
|
|
|
|
if (cmdandvar.size() - 1 != expectParaNum) { \ |
|
|
|
context->printfInfo = fmt::format("error:do {} error,parameter num error", cmd, cmdandvar.size()); \ |
|
|
|
context->printfInfo = fmt::format("error:do {} error,parameter num error,{}", cmd, cmdandvar.size()); \ |
|
|
|
logger->error("{}", context->printfInfo); \ |
|
|
|
return; \ |
|
|
|
} |
|
|
@ -236,38 +238,33 @@ void A8000ScriptProcesser::docmd(shared_ptr<ScriptProcesser::Context> context) { |
|
|
|
int32_t direction = atoi(context->cmd_and_var[2].c_str()); |
|
|
|
step_motor_rotate(context, motorId, direction); |
|
|
|
} else if (cmd == "step_motor_move_to") { |
|
|
|
// stepMotorRotate motorId direction
|
|
|
|
CHECK_CMD_PARAMETER(2); |
|
|
|
step_motor_move_to(context, context->getvarInt(1), context->getvarInt(2)); |
|
|
|
} else if (cmd == "step_motor_move_by") { |
|
|
|
// stepMotorRotate motorId direction
|
|
|
|
CHECK_CMD_PARAMETER(2); |
|
|
|
step_motor_move_by(context, context->getvarInt(1), context->getvarInt(2)); |
|
|
|
} else if (cmd == "step_motor_move_to_zero") { |
|
|
|
// stepMotorRotate motorId direction
|
|
|
|
CHECK_CMD_PARAMETER(1); |
|
|
|
step_motor_move_to_zero(context, context->getvarInt(1)); |
|
|
|
} else if (cmd == "step_motor_read_pos") { |
|
|
|
// stepMotorRotate motorId direction
|
|
|
|
CHECK_CMD_PARAMETER(2); |
|
|
|
CHECK_CMD_PARAMETER(1); |
|
|
|
int32_t retval = 0; |
|
|
|
step_motor_read_pos(context, context->getvarInt(1), retval); |
|
|
|
} else if (cmd == "step_motor_read_state") { |
|
|
|
// stepMotorRotate motorId direction
|
|
|
|
CHECK_CMD_PARAMETER(2); |
|
|
|
CHECK_CMD_PARAMETER(1); |
|
|
|
int32_t retval = 0; |
|
|
|
step_motor_read_state(context, context->getvarInt(1), retval); |
|
|
|
} else if (cmd == "step_motor_is_idle") { |
|
|
|
// stepMotorRotate motorId direction
|
|
|
|
CHECK_CMD_PARAMETER(2); |
|
|
|
CHECK_CMD_PARAMETER(1); |
|
|
|
int32_t retval = 0; |
|
|
|
step_motor_is_idle(context, context->getvarInt(1), retval); |
|
|
|
} else if (cmd == "step_motor_stop") { |
|
|
|
// stepMotorRotate motorId direction
|
|
|
|
CHECK_CMD_PARAMETER(2); |
|
|
|
CHECK_CMD_PARAMETER(1); |
|
|
|
step_motor_stop(context, context->getvarInt(1)); |
|
|
|
} else if (cmd == "step_motor_wait_for_idle") { |
|
|
|
CHECK_CMD_PARAMETER(1); |
|
|
|
step_motor_wait_for_idle(context, context->getvarInt(1)); |
|
|
|
} |
|
|
|
|
|
|
|
else if (cmd == "duoji_move_to") { |
|
|
|
CHECK_CMD_PARAMETER(2); |
|
|
|
duoji_move_to(context, context->getvarInt(1), context->getvarInt(2)); |
|
|
@ -275,7 +272,7 @@ void A8000ScriptProcesser::docmd(shared_ptr<ScriptProcesser::Context> context) { |
|
|
|
CHECK_CMD_PARAMETER(1); |
|
|
|
duoji_stop(context, context->getvarInt(1)); |
|
|
|
} else if (cmd == "duoji_is_idle") { |
|
|
|
CHECK_CMD_PARAMETER(2); |
|
|
|
CHECK_CMD_PARAMETER(1); |
|
|
|
int32_t retval = 0; |
|
|
|
duoji_is_idle(context, context->getvarInt(1), retval); |
|
|
|
} else if (cmd == "tube_rotate") { |
|
|
|