Read a potentiometer continuously? on STM32 and analogRead()

Hey,

if you call motor.disable() (ME0) then the current sense will not update unless you have modified the code to update them. This means your plot might be showing stale values while the motor is disabled.

Also the PID does not update while the motor is disabled, so when you re-enable it, it resumes from where it left off, but will find a very large delta-T.

when you call motor.enable(), with the target already set, then the behaviour may also depend on which is called first - loopFOC() or move() - if loopFOC() is called first, it will operate with whatever current target was set at the time motor.disable() was called. So you might want to adjust the target current in some way before enabling.
If move() is called first, it will calculate a new target voltage/current set-point for loopFOC, so perhaps it will help to make sure move is called before loopFOC(), despite the current value of motion_downsample