mirror of https://github.com/rusefi/bldc.git
Correct location of current limit truncate for openloop. Previously limit was not respected.
This commit is contained in:
parent
2620eed66c
commit
1af841f75c
|
@ -2882,13 +2882,14 @@ void mcpwm_foc_adc_int_handler(void *p, uint32_t flags) {
|
|||
motor_now->m_observer_state.x1 = motor_now->m_observer_x1_override;
|
||||
motor_now->m_observer_state.x2 = motor_now->m_observer_x2_override;
|
||||
iq_set_tmp += conf_now->foc_sl_openloop_boost_q * SIGN(iq_set_tmp);
|
||||
if (conf_now->foc_sl_openloop_max_q > conf_now->cc_min_current) {
|
||||
utils_truncate_number_abs(&iq_set_tmp, conf_now->foc_sl_openloop_max_q);
|
||||
}
|
||||
} else {
|
||||
motor_now->m_motor_state.phase = motor_now->m_phase_now_observer;
|
||||
}
|
||||
|
||||
if (conf_now->foc_sl_openloop_max_q > conf_now->cc_min_current) {
|
||||
utils_truncate_number_abs(&iq_set_tmp, conf_now->foc_sl_openloop_max_q);
|
||||
}
|
||||
|
||||
if (!motor_now->m_phase_override && motor_now->m_control_mode != CONTROL_MODE_OPENLOOP_PHASE) {
|
||||
id_set_tmp = 0.0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue