|
@ -213,7 +213,7 @@ void TMC51X0::stop() { |
|
|
} else { |
|
|
} else { |
|
|
rotate(0); |
|
|
rotate(0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_isMoveToEnd = false; |
|
|
// rotate(0);
|
|
|
// rotate(0);
|
|
|
} |
|
|
} |
|
|
void TMC51X0::rotate(int32_t velocity) { |
|
|
void TMC51X0::rotate(int32_t velocity) { |
|
@ -222,6 +222,7 @@ void TMC51X0::rotate(int32_t velocity) { |
|
|
velocity = to_motor_vel(velocity); |
|
|
velocity = to_motor_vel(velocity); |
|
|
writeInt(TMC5130_VMAX, abs(velocity)); |
|
|
writeInt(TMC5130_VMAX, abs(velocity)); |
|
|
writeInt(TMC5130_RAMPMODE, (velocity >= 0) ? TMC5130_MODE_VELPOS : TMC5130_MODE_VELNEG); |
|
|
writeInt(TMC5130_RAMPMODE, (velocity >= 0) ? TMC5130_MODE_VELPOS : TMC5130_MODE_VELNEG); |
|
|
|
|
|
m_isMoveToEnd = false; |
|
|
} |
|
|
} |
|
|
void TMC51X0::moveTo(int32_t position, uint32_t velocityMax) { |
|
|
void TMC51X0::moveTo(int32_t position, uint32_t velocityMax) { |
|
|
zlock_guard lkg(m_mutex); |
|
|
zlock_guard lkg(m_mutex); |
|
@ -231,6 +232,7 @@ void TMC51X0::moveTo(int32_t position, uint32_t velocityMax) { |
|
|
writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION); |
|
|
writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION); |
|
|
writeInt(TMC5130_VMAX, velocityMax); |
|
|
writeInt(TMC5130_VMAX, velocityMax); |
|
|
writeInt(TMC5130_XTARGET, position); |
|
|
writeInt(TMC5130_XTARGET, position); |
|
|
|
|
|
m_isMoveToEnd = false; |
|
|
} |
|
|
} |
|
|
void TMC51X0::moveToEnd(int32_t direction, uint32_t velocityMax) { |
|
|
void TMC51X0::moveToEnd(int32_t direction, uint32_t velocityMax) { |
|
|
zlock_guard lkg(m_mutex); |
|
|
zlock_guard lkg(m_mutex); |
|
@ -248,8 +250,12 @@ void TMC51X0::moveToEnd(int32_t direction, uint32_t velocityMax) { |
|
|
writeInt(TMC5130_VMAX, to_motor_vel(velocityMax)); |
|
|
writeInt(TMC5130_VMAX, to_motor_vel(velocityMax)); |
|
|
writeInt(TMC5130_XTARGET, INT32_MIN / 1.5 + 1000); |
|
|
writeInt(TMC5130_XTARGET, INT32_MIN / 1.5 + 1000); |
|
|
} |
|
|
} |
|
|
|
|
|
m_isMoveToEnd = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TMC51X0::refreshMoveToEnd() { setXACTUAL(0); } |
|
|
|
|
|
bool TMC51X0::isMoveToEnd() { return m_isMoveToEnd; } |
|
|
|
|
|
|
|
|
void TMC51X0::moveBy(int32_t relativePosition, uint32_t velocityMax) { // determine actual position and add numbers of ticks to move
|
|
|
void TMC51X0::moveBy(int32_t relativePosition, uint32_t velocityMax) { // determine actual position and add numbers of ticks to move
|
|
|
zlock_guard lkg(m_mutex); |
|
|
zlock_guard lkg(m_mutex); |
|
|
|
|
|
|
|
|