Determining Optimal Crystallinity of Diketopyrrolopyrrole-Based Terpolymers for Highly Efficient Polymer Solar Cells and Transistors