|
@ -193,6 +193,8 @@ int32_t XYRobotCtrlModule::__module_xxx_reg(int32_t param_id, bool read, int32_t |
|
|
UPDATE_CFG(max_y); |
|
|
UPDATE_CFG(max_y); |
|
|
UPDATE_CFG(run_to_zero_speed); |
|
|
UPDATE_CFG(run_to_zero_speed); |
|
|
UPDATE_CFG(look_zero_edge_speed); |
|
|
UPDATE_CFG(look_zero_edge_speed); |
|
|
|
|
|
UPDATE_CFG(pos_devi_tolerance); |
|
|
|
|
|
UPDATE_CFG(io_trigger_append_distance); |
|
|
|
|
|
|
|
|
default: |
|
|
default: |
|
|
return err::kmodule_not_find_reg; |
|
|
return err::kmodule_not_find_reg; |
|
@ -449,35 +451,32 @@ void XYRobotCtrlModule::after_motor_move() { |
|
|
|
|
|
|
|
|
if (creg.module_errorcode != 0) { |
|
|
if (creg.module_errorcode != 0) { |
|
|
creg.module_status = 2; |
|
|
creg.module_status = 2; |
|
|
|
|
|
} else { |
|
|
|
|
|
creg.module_status = 0; |
|
|
} |
|
|
} |
|
|
creg.module_status = 0; |
|
|
|
|
|
} |
|
|
} |
|
|
bool XYRobotCtrlModule::check_when_run() { |
|
|
bool XYRobotCtrlModule::check_when_run() { |
|
|
// if (m_state.debugmode) {
|
|
|
|
|
|
// return true;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// TMC51X0* tmc5130 = dynamic_cast<TMC51X0*>(m_stepM1);
|
|
|
|
|
|
// if (tmc5130 && tmc5130->isTMC5130()) {
|
|
|
|
|
|
// auto state = tmc5130->getGState();
|
|
|
|
|
|
// auto devStatus = tmc5130->getDevStatus();
|
|
|
|
|
|
// if (state.reset) {
|
|
|
|
|
|
// ZLOGE(TAG, "motor reset when run");
|
|
|
|
|
|
// setErrorFlag(err::kstep_motor_subic_reset, (*(uint32_t*)&devStatus));
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// } else if (state.uv_cp) {
|
|
|
|
|
|
// ZLOGE(TAG, "motor uv_cp when run");
|
|
|
|
|
|
// dumpTMC5130Status(&devStatus);
|
|
|
|
|
|
// setErrorFlag(err::kstep_motor_uv_cp, (*(uint32_t*)&devStatus));
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// } else if (state.drv_err) {
|
|
|
|
|
|
// ZLOGE(TAG, "motor drv_err when run");
|
|
|
|
|
|
// setErrorFlag(err::kstep_motor_drv_err, (*(uint32_t*)&devStatus));
|
|
|
|
|
|
// dumpTMC5130Status(&devStatus);
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
if (m_cfg.enable_enc != 0) { |
|
|
|
|
|
vPortEnterCritical(); |
|
|
|
|
|
|
|
|
|
|
|
int32_t m1enc = m_stepM1->read_enc_val(); |
|
|
|
|
|
int32_t m2enc = m_stepM2->read_enc_val(); |
|
|
|
|
|
int32_t m1pos = m_stepM1->getXACTUAL(); |
|
|
|
|
|
int32_t m2pos = m_stepM2->getXACTUAL(); |
|
|
|
|
|
|
|
|
|
|
|
vPortExitCritical(); |
|
|
|
|
|
|
|
|
|
|
|
int32_t dm1 = abs(m1enc - m1pos); |
|
|
|
|
|
int32_t dm2 = abs(m2enc - m2pos); |
|
|
|
|
|
|
|
|
|
|
|
if (m_cfg.pos_devi_tolerance != 0) { |
|
|
|
|
|
if (dm1 > m_cfg.pos_devi_tolerance || dm2 > m_cfg.pos_devi_tolerance) { |
|
|
|
|
|
ZLOGE(TAG, "pos_devi_tolerance fail m1enc:%d m1pos:%d d1:%d m2enc:%d m2pos:%d d2:%d", m1enc, m1pos, m1enc - m1pos, m2enc, m2pos, m2enc - m2pos); |
|
|
|
|
|
creg.module_errorcode = err::kstep_motor_lost_step; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|