Great project that you are working on. I moved your topic to the right forum. Anyway to answer your questions
Sometimes the engine does not even the first 90°, it stops at 89° but the program waits for the 90°.
Your program does not use the waithandle that is returned from the speedprofile function. The execution continues but you wait 1000 ms. Please have a look at the motor example found here