Hope I am not bothering you with this here.
I am struggling with getting this to work because the phase current is noisy, I need to think about it, maybe I can do a reverse clark and park of the already filtered d and q currents.
I wanted to show you how it looks like when it works but I cheated by using the duty cycles instead of the phase current, which should not be a problem without load.
I just added this:
center = driver->voltage_limit/2;
Ua += (Ua > center ? 1:-1) * dtcomp;
Ub += (Ub > center ? 1:-1) * dtcomp;
Uc += (Uc > center ? 1:-1) * dtcomp;
The compensation has to be surprisingly high for me (0.7v), but the phase current waveform becomes sinusoidal.
I recorded the waveform and the motor.