Hello, I'm Salah Soliman.
I'm a Mechatronics engineer, I have just checked the github link you attached, and I believe you are using STM32 microcontroller to control your brushless dc motor.
I have great experience in Motor control, embedded systems, and control system design.
I'll first get some data reading from your motor, so that I can use the MATLAB system identification toolbox to get the system response and design the control system upon that, I'll use the parameters from MATLAB to create a PID control over position, maybe more advanced control like CTC if you have a current sensor, all that using STM32 microcontroller.
Regarding the sequence of the algorithm, we can create any algorithm or sequence you need, no problem with that.
I look forward to working with you.
Salah Soliman