Text this: Adaptive encoder alignment for maximizing torque and speed in synchronous motors