Look at machine kit, they are controlling 3D printers. The extrusion velocity must depend on axis velocity, as otherwise you do have more material at all directions changing, due to acceleration issues.
May be the code from machine kit solve your issue.
Norbert