Closed Candas1 closed 9 months ago
Thank you for reporting this! We’ll try to fix it for next release, since using pow() seems quite gratuitous for raising to powers of 2
Please let me know if a PR helps
I can add #define _powtwo(x) (1 << (x))
here, update magnetic sensors init, and update arduino-foc-drivers when the first PR is accepted
Very interesting!
I also checked, the svpwm without atan2 I mentioned in the community also reduces flash by 0.5%.
You guys seem very busy, please let me know how I can make your life easier with this.
Do you prefer an issue on github for any improvement to better track. I can even create a PR.
Thanks so much @Candas1 ! I'm sorry we're so busy, but don't think all your work has gone unnoticed! We're really very grateful for your support and careful testing.
I will work in the pow() changes right now.
For the SVPWM a PR would be greatly appreciated, and also it would credit you for the change on github, which seems more than fair!! Note that we take PRs against the dev branch only.
Don't get me wrong, it's not a complain.
For the SVPWM change I have some questions but we can discuss it separately.
pow stuff is part of PR #304
Thanks. It works, I see the flash reducing, and the motor control works as usual. I cannot test the magnetic encoder part.
Hi,
A user came across something weird when testing on a gd32 board. A change in one of my last commit is making the main loop much slower, impacting motor control.
It seems the reason for the performance drop is the usage of pow() in the init of the voltage sense, although it's not even running in the main loop.... I still need to figure out why this happens, the gd32 is using a 4 years old gcc.
On stm32, I haven't noticed the performance drop, but I see another impact, which is the flash usage. This is without the voltage sense:
This is with volage sense:
Now, as we are using the pow function only for powers of 2 and integers, I use this macro
#define pwrtwo(x) (1 << (x))
:So 1.5% less on a big chip (256Kb).
It seems pow() is used for the same purpose in MagneticSensorI2C and in MagneticSensorSPI