|
|
@ -357,9 +357,8 @@ void StepMotorCtrlModule::dump(TMC4361AMotorEventState_t val) { |
|
|
|
ZLOGI(TAG, "RST_EV : %d", val.RST_EV); |
|
|
|
} |
|
|
|
|
|
|
|
void StepMotorCtrlModule::setErrorFlag(int32_t ecode, uint32_t motorStatue) { |
|
|
|
void StepMotorCtrlModule::setErrorFlag(int32_t ecode) { |
|
|
|
creg.module_errorcode = ecode; |
|
|
|
// m_state.motorStatus = motorStatue;
|
|
|
|
} |
|
|
|
|
|
|
|
bool StepMotorCtrlModule::check_when_run() { |
|
|
@ -375,16 +374,16 @@ bool StepMotorCtrlModule::check_when_run() { |
|
|
|
auto devStatus = tmc5130->getDevStatus(); |
|
|
|
if (state.reset) { |
|
|
|
ZLOGE(TAG, "motor reset when run"); |
|
|
|
setErrorFlag(err::kstep_motor_subic_reset, (*(uint32_t*)&devStatus)); |
|
|
|
setErrorFlag(err::kstep_motor_subic_reset); |
|
|
|
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)); |
|
|
|
setErrorFlag(err::kstep_motor_uv_cp); |
|
|
|
return false; |
|
|
|
} else if (state.drv_err) { |
|
|
|
ZLOGE(TAG, "motor drv_err when run"); |
|
|
|
setErrorFlag(err::kstep_motor_drv_err, (*(uint32_t*)&devStatus)); |
|
|
|
setErrorFlag(err::kstep_motor_drv_err); |
|
|
|
dumpTMC5130Status(&devStatus); |
|
|
|
return false; |
|
|
|
} |
|
|
@ -428,7 +427,7 @@ bool StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t directio |
|
|
|
// 失败返回
|
|
|
|
if (!xreach_io) { |
|
|
|
ZLOGE(TAG, "x reach io failed"); |
|
|
|
setErrorFlag(err::kstep_motor_not_found_zero_point, 0); |
|
|
|
setErrorFlag(err::kstep_motor_not_found_zero_point); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -457,7 +456,7 @@ bool StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t directio |
|
|
|
|
|
|
|
if (!reach_edge) { |
|
|
|
ZLOGE(TAG, "leave away zero failed"); |
|
|
|
setErrorFlag(err::kstep_motor_not_found_point_edge, 0); |
|
|
|
setErrorFlag(err::kstep_motor_not_found_point_edge); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -486,7 +485,7 @@ bool StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t directio |
|
|
|
|
|
|
|
if (!reach_edge) { |
|
|
|
ZLOGE(TAG, " bak to gpio trigger edge fail"); |
|
|
|
setErrorFlag(err::kstep_motor_not_found_point_edge, 0); |
|
|
|
setErrorFlag(err::kstep_motor_not_found_point_edge); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|