Only change direction if the motor is stopped