Step lost fix
The segment buffer can be emptied completely during a motion causing the transition to the IDLE state although there are segments pending and ready to be queued up. This solution ensures all generated segments are processed preventing so any step lost.