Closed
Description
I wrote this code some time ago but I haven't published it because I wasn't sure it was useful enough. I am posting it here to get your opinion, specially you @dekutree64 as you did a lot of work on this sensor.
What it does is:
- if no interrupts are enabled for hall sensors, it will just check the hall states directly when sensor is updated.
- some small code optimizations
The user can choose if he wants to run it with or without interrupts.
Benefits:
- if user forgets to enable interrupts, the motor will still run (we could issue a warning in debug mode)
- if there are not enough interrupts available (arduino?), the motor can still run
- With interrupts, the faster the motor spins the more interrupts are triggered, slowing down the loop duration/frequency. Without interrupts, the code runs at constant duration/frequency
- PIDs/filters might not be impacted by hall interrupts running in the middle
- less problems when there are noise issues ? (to be checked)
Downside:
- the slower the MCU is and the faster the motor spins, the less accurate the position will be