simplefoc / Arduino-FOC

Arduino FOC for BLDC and Stepper motors - Arduino Based Field Oriented Control Algorithm Library
https://docs.simplefoc.com
MIT License
1.95k stars 511 forks source link

Add currentsense.enable/disable #365

Closed runger1101001 closed 5 months ago

runger1101001 commented 5 months ago

Add a enable() and disable() function to currentsense, and reset the PIDs on a motor.enable().

See discussion here: https://community.simplefoc.com/t/read-a-potentiometer-continuously-on-stm32-and-analogread/4214/90

runger1101001 commented 5 months ago

I think this can be merged, to allow us to fix the "current kick" after enable on STM32...

Candas1 commented 5 months ago

Hi Richard,

I wanted to start implementing current sense enable/disable on STM32, but after I created a branch on my fork based on the project's dev, I end up with a arduino-FOC and a Simple FOC folder in the dependencies: image

It looks like:

Do you have the same issue ? I updated platformio just before that, so it could be a bug there.

runger1101001 commented 5 months ago

Is maybe one of them the original project dependency?

SimpleFOC is the project and library name, but Arduino-FOC is the actual folder/repository name. At a guess I'd say one of them comes from a git pull, and the other via library dependency or symlink?

I can't say I have the same issue, and when I check the dev branch online I can't see any trace of SimpleFOC within the drivers?

Candas1 commented 5 months ago

ok I won't waste too much time for now. the arduino-foc folder has your last changes and points to my fork, so it should be good enough.

So just to understand, how should I declare the enable and disable function ? Should I override it in lowsidecurrentsense class, and call new _enable() and _disable() functions in the current sense driver ?