mirror of https://github.com/rusefi/bldc.git
Take both current override limits into account in the relative current mode
This commit is contained in:
parent
c5d89c4b74
commit
004af85dc1
|
@ -734,7 +734,13 @@ void mc_interface_set_current_rel(float val) {
|
|||
}
|
||||
|
||||
volatile mc_configuration *cfg = &motor_now()->m_conf;
|
||||
mc_interface_set_current(val * cfg->lo_current_max);
|
||||
float duty = mc_interface_get_duty_cycle_now();
|
||||
|
||||
if (fabsf(duty) < 0.02 || SIGN(val) == SIGN(duty)) {
|
||||
mc_interface_set_current(val * cfg->lo_current_max);
|
||||
} else {
|
||||
mc_interface_set_current(val * fabsf(cfg->lo_current_min));
|
||||
}
|
||||
|
||||
if (fabsf(val * cfg->l_abs_current_max) > cfg->cc_min_current) {
|
||||
mc_interface_set_current_off_delay(0.1);
|
||||
|
|
Loading…
Reference in New Issue