diff --git a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp b/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp index 22a512f..24d4620 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp +++ b/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp @@ -20,6 +20,13 @@ int32_t StepMotorCtrlModule::move_to(int32_t tox, function m_cfg_max_x) { + tox = m_cfg_max_x; + } + updateStatus(1); m_thread.start([this, tox, status_cb]() { _motor_move_to(tox, m_cfg_velocity, m_cfg_acc, m_cfg_dec); @@ -48,14 +55,12 @@ int32_t StepMotorCtrlModule::move_by(int32_t dx, function status_cb) { zlock_guard lock(m_lock); @@ -349,7 +354,7 @@ void StepMotorCtrlModule::_motor_move_by(int32_t dpos, int32_t maxv, int32_t acc getnowpos(nowpos); int32_t topos = nowpos + dpos; - int motorpos = 0; + int32_t motorpos = 0; forward_kinematics(topos, motorpos); m_stepM1->moveTo(motorpos, maxv); }