simplefoc / Arduino-FOC

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

Feature: FIX 2 phase measurements resulting in bad DQ currents #339

Closed pglr closed 10 months ago

pglr commented 10 months ago

inside the common/base_classes/CurrentSense.cpp there was an error with the if-else statement for both getCurrent methods. This leads to a very noisy DQ current if only two phase currents are measured. Either a&b or c&b lead to this issue:

image

after the FIX OR using a&c:

image

runger1101001 commented 10 months ago

I think you and Candas have found an important bug. Thanks very much for this!

Candas1 commented 10 months ago

For your information this also saves me 10us loopfoc duration on STM32F1 😍​