mirror of https://github.com/rusefi/bldc.git
Merge pull request #635 from TechAUmNu/Calibrate-offsets-before-detection
Perform FOC offsets calibration when running FOC detection
This commit is contained in:
commit
40e6f0b6e2
|
@ -1656,6 +1656,12 @@ int conf_general_detect_apply_all_foc(float max_power_loss,
|
|||
int faultM1 = FAULT_CODE_NONE;
|
||||
int faultM2 = FAULT_CODE_NONE;
|
||||
|
||||
// Measure DC offsets
|
||||
// Needs to be done before getting the motor configuration
|
||||
if(mcpwm_foc_dc_cal(false) == -1) {
|
||||
return mc_interface_get_fault() - 100; // Offset fault by -100
|
||||
}
|
||||
|
||||
int motor_last = mc_interface_get_motor_thread();
|
||||
mc_interface_select_motor_thread(1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue