Browse Source

update

master
zhaohe 1 year ago
parent
commit
05b93b8bb6
  1. 2
      components/step_motor_ctrl_module/step_motor_ctrl_module.cpp
  2. 7
      components/tmc/ic/ztmc5130.cpp

2
components/step_motor_ctrl_module/step_motor_ctrl_module.cpp

@ -497,7 +497,9 @@ bool StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t directio
void StepMotorCtrlModule::_rotate(int32_t velocity, int32_t acc) {
if (velocity > 0) {
m_stepM1->moveToEnd(1, abs(velocity));
// m_stepM1->rotate(velocity);
} else {
// m_stepM1->rotate(velocity);
m_stepM1->moveToEnd(-1, abs(velocity));
}
}

7
components/tmc/ic/ztmc5130.cpp

@ -199,14 +199,15 @@ void TMC51X0::moveTo(int32_t position, uint32_t velocityMax) {
writeInt(TMC5130_XTARGET, position);
}
void TMC51X0::moveToEnd(int32_t direction, uint32_t velocityMax) {
if (direction > 0) {
ZLOGI("TMC5130", "moveToEnd %d %d", direction, velocityMax);
if (direction >= 0) {
writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION);
writeInt(TMC5130_VMAX, to_motor_vel(velocityMax));
writeInt(TMC5130_XTARGET, INT32_MAX);
writeInt(TMC5130_XTARGET, INT32_MAX / 2 - 1000);
} else {
writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION);
writeInt(TMC5130_VMAX, to_motor_vel(velocityMax));
writeInt(TMC5130_XTARGET, INT32_MIN);
writeInt(TMC5130_XTARGET, INT32_MIN / 2 + 1000);
}
}

Loading…
Cancel
Save