|
|
@@ -39,15 +39,15 @@ bool mot_contrl_enable(mot_contrl_t *ctrl, bool start) {
|
|
|
return true;
|
|
|
}
|
|
|
if (start) {
|
|
|
- line_ramp_init(&ctrl->torque_lim, CONFIG_LIMIT_RAMP_TIME);
|
|
|
- line_ramp_init(&ctrl->dc_curr_lim, CONFIG_LIMIT_RAMP_TIME);
|
|
|
- line_ramp_init(&ctrl->vel_lim, CONFIG_LIMIT_RAMP_TIME);
|
|
|
- line_ramp_init(&ctrl->cruise_vel, CONFIG_CRUISE_RAMP_TIME);
|
|
|
- line_ramp_init(&ctrl->target_vd, CONFIG_FOC_VDQ_RAMP_FINAL_TIME);
|
|
|
- line_ramp_init(&ctrl->target_vq, CONFIG_FOC_VDQ_RAMP_FINAL_TIME);
|
|
|
- line_ramp_init(&ctrl->target_vel, CONFIG_CRUISE_RAMP_TIME);
|
|
|
- line_ramp_init(&ctrl->target_current, CONFIG_CURRENT_RAMP_TIME);
|
|
|
- line_ramp_init(&ctrl->input_torque, CONFIG_DEFAULT_TORQUE_RAMP_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_torque_lim, CONFIG_LIMIT_RAMP_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_dc_curr_lim, CONFIG_LIMIT_RAMP_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_vel_lim, CONFIG_LIMIT_RAMP_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_cruise_vel, CONFIG_CRUISE_RAMP_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_target_vd, CONFIG_FOC_VDQ_RAMP_FINAL_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_target_vq, CONFIG_FOC_VDQ_RAMP_FINAL_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_target_vel, CONFIG_CRUISE_RAMP_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_target_current, CONFIG_CURRENT_RAMP_TIME);
|
|
|
+ line_ramp_init(&ctrl->ramp_input_torque, CONFIG_DEFAULT_TORQUE_RAMP_TIME);
|
|
|
line_ramp_init(&ctrl->ramp_adv_angle, CONFIG_CURRENT_RAMP_TIME);
|
|
|
mot_contrl_pid(ctrl);
|
|
|
mot_contrl_ulimit(ctrl);
|
|
|
@@ -113,29 +113,29 @@ u8 mot_contrl_mode(mot_contrl_t *ctrl) {
|
|
|
}
|
|
|
if (preMode != ctrl->mode_running) {
|
|
|
if ((preMode != ctrl->mode_running) && (ctrl->mode_running == CTRL_MODE_TRQ)) {
|
|
|
- line_ramp_set_acctime(&ctrl->input_torque, ctrl->torque_acc_time);
|
|
|
- line_ramp_set_dectime(&ctrl->input_torque, ctrl->torque_dec_time);
|
|
|
- line_ramp_update(&ctrl->input_torque);
|
|
|
+ line_ramp_set_acctime(&ctrl->ramp_input_torque, ctrl->torque_acc_time);
|
|
|
+ line_ramp_set_dectime(&ctrl->ramp_input_torque, ctrl->torque_dec_time);
|
|
|
+ line_ramp_update(&ctrl->ramp_input_torque);
|
|
|
if (preMode == CTRL_MODE_SPD) {
|
|
|
ctrl->target_torque_raw = ctrl->target_torque;
|
|
|
PI_Controller_Reset(&ctrl->pi_vel_lim, ctrl->target_torque_raw);
|
|
|
}else if (preMode == CTRL_MODE_CURRENT) {
|
|
|
- ctrl->target_torque_raw = line_ramp_get_interp(&ctrl->target_current);
|
|
|
+ ctrl->target_torque_raw = line_ramp_get_interp(&ctrl->ramp_target_current);
|
|
|
PI_Controller_Reset(&ctrl->pi_vel_lim, ctrl->target_torque_raw);
|
|
|
}
|
|
|
}else if ((preMode == CTRL_MODE_TRQ) && (ctrl->mode_running == CTRL_MODE_SPD)) {
|
|
|
PI_Controller_Reset(&ctrl->pi_vel, ctrl->target_torque);
|
|
|
}else if ((preMode != ctrl->mode_running) && (ctrl->mode_running == CTRL_MODE_EBRAKE)) {
|
|
|
- line_ramp_reset(&ctrl->input_torque, ctrl->target_torque);
|
|
|
- line_ramp_set_time(&ctrl->input_torque, ctrl->ebrk_ramp_time);
|
|
|
- line_ramp_set_target(&ctrl->input_torque, motor_get_ebreak_toruqe(ctrl->foc.in.mot_velocity));
|
|
|
+ line_ramp_reset(&ctrl->ramp_input_torque, ctrl->target_torque);
|
|
|
+ line_ramp_set_time(&ctrl->ramp_input_torque, ctrl->ebrk_ramp_time);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_input_torque, motor_get_ebreak_toruqe(ctrl->foc.in.mot_velocity));
|
|
|
}else if ((preMode == CTRL_MODE_EBRAKE) && (ctrl->mode_running == CTRL_MODE_SPD)) {
|
|
|
PI_Controller_Reset(&ctrl->pi_vel, F_get_air());
|
|
|
}
|
|
|
}
|
|
|
if (ctrl->mode_running == CTRL_MODE_OPEN) {
|
|
|
- line_ramp_step(&ctrl->target_vd);
|
|
|
- line_ramp_step(&ctrl->target_vq);
|
|
|
+ line_ramp_step(&ctrl->ramp_target_vd);
|
|
|
+ line_ramp_step(&ctrl->ramp_target_vq);
|
|
|
}
|
|
|
return ctrl->mode_running;
|
|
|
}
|
|
|
@@ -244,8 +244,8 @@ bool mot_contrl_update(mot_contrl_t *ctrl) {
|
|
|
foc->in.b_openloop = ctrl->mode_running == CTRL_MODE_OPEN;
|
|
|
phase_curr_unbal_check(ctrl);
|
|
|
if (foc->in.b_openloop) {
|
|
|
- foc->in.target_vol_dq.d = line_ramp_get_interp(&ctrl->target_vd);
|
|
|
- foc->in.target_vol_dq.q = line_ramp_get_interp(&ctrl->target_vq);
|
|
|
+ foc->in.target_vol_dq.d = line_ramp_get_interp(&ctrl->ramp_target_vd);
|
|
|
+ foc->in.target_vol_dq.q = line_ramp_get_interp(&ctrl->ramp_target_vq);
|
|
|
}
|
|
|
|
|
|
foc_update(foc);
|
|
|
@@ -259,7 +259,7 @@ bool mot_contrl_update(mot_contrl_t *ctrl) {
|
|
|
|
|
|
static __INLINE float mot_contrl_dc_curr_limiter(mot_contrl_t *ctrl, float maxTrq) {
|
|
|
ctrl->pi_power.max = maxTrq;
|
|
|
- float errRef = line_ramp_get_interp(&ctrl->dc_curr_lim) - ctrl->dc_curr_filted;
|
|
|
+ float errRef = line_ramp_get_interp(&ctrl->ramp_dc_curr_lim) - ctrl->dc_curr_filted;
|
|
|
return PI_Controller_Run(&ctrl->pi_power, errRef);
|
|
|
}
|
|
|
|
|
|
@@ -267,14 +267,14 @@ static __INLINE float mot_contrl_vel_limiter(mot_contrl_t *ctrl, float maxTrq) {
|
|
|
ctrl->pi_vel_lim.max = maxTrq;
|
|
|
ctrl->pi_vel_lim.min = 0;
|
|
|
|
|
|
- float err = line_ramp_get_interp(&ctrl->vel_lim) - ctrl->foc.in.mot_velocity;
|
|
|
+ float err = line_ramp_get_interp(&ctrl->ramp_vel_lim) - ctrl->foc.in.mot_velocity;
|
|
|
return PI_Controller_RunVel(&ctrl->pi_vel_lim, err);
|
|
|
}
|
|
|
|
|
|
/* current vector or torque to dq axis current */
|
|
|
static void mot_contrl_dq_assign(mot_contrl_t *ctrl) {
|
|
|
if (ctrl->mode_running == CTRL_MODE_CURRENT) {
|
|
|
- float target_current = line_ramp_get_interp(&ctrl->target_current);
|
|
|
+ float target_current = line_ramp_get_interp(&ctrl->ramp_target_current);
|
|
|
if (ctrl->b_mtpa_calibrate && (ctrl->adv_angle != INVALID_ANGLE)) {
|
|
|
float s, c;
|
|
|
float angle_step = line_ramp_step(&ctrl->ramp_adv_angle);
|
|
|
@@ -357,16 +357,16 @@ void mot_contrl_dq_calc(mot_contrl_t *ctrl) {
|
|
|
return;
|
|
|
}
|
|
|
if (ctrl->mode_running == CTRL_MODE_CURRENT) {
|
|
|
- line_ramp_step(&ctrl->target_current);
|
|
|
+ line_ramp_step(&ctrl->ramp_target_current);
|
|
|
}else if (ctrl->mode_running == CTRL_MODE_EBRAKE) {
|
|
|
- float maxTrq = line_ramp_step(&ctrl->input_torque);
|
|
|
- if (line_ramp_get_target(&ctrl->input_torque) < 0.0001f && foc->in.mot_velocity < CONFIG_MIN_RPM_EXIT_EBRAKE) {
|
|
|
+ float maxTrq = line_ramp_step(&ctrl->ramp_input_torque);
|
|
|
+ if (line_ramp_get_target(&ctrl->ramp_input_torque) < 0.0001f && foc->in.mot_velocity < CONFIG_MIN_RPM_EXIT_EBRAKE) {
|
|
|
maxTrq = 0;
|
|
|
}
|
|
|
crosszero_step_towards(&ctrl->target_torque, maxTrq);
|
|
|
}else if (ctrl->mode_running == CTRL_MODE_TRQ) {
|
|
|
- float refTorque = line_ramp_step(&ctrl->input_torque);
|
|
|
- refTorque = min(refTorque, line_ramp_get_interp(&ctrl->torque_lim)) * etcs_out;
|
|
|
+ float refTorque = line_ramp_step(&ctrl->ramp_input_torque);
|
|
|
+ refTorque = min(refTorque, line_ramp_get_interp(&ctrl->ramp_torque_lim)) * etcs_out;
|
|
|
float maxTrq = mot_contrl_vel_limiter(ctrl, refTorque);
|
|
|
ctrl->target_torque_raw = mot_contrl_dc_curr_limiter(ctrl, maxTrq);
|
|
|
crosszero_step_towards(&ctrl->target_torque, ctrl->target_torque_raw);
|
|
|
@@ -374,13 +374,13 @@ void mot_contrl_dq_calc(mot_contrl_t *ctrl) {
|
|
|
float refSpeed;
|
|
|
float maxSpeed;
|
|
|
if (ctrl->b_cruiseEna) {
|
|
|
- refSpeed = line_ramp_step(&ctrl->cruise_vel);
|
|
|
- maxSpeed = line_ramp_get_target(&ctrl->cruise_vel);
|
|
|
+ refSpeed = line_ramp_step(&ctrl->ramp_cruise_vel);
|
|
|
+ maxSpeed = line_ramp_get_target(&ctrl->ramp_cruise_vel);
|
|
|
}else {
|
|
|
- refSpeed = line_ramp_step(&ctrl->target_vel);
|
|
|
- maxSpeed = line_ramp_get_target(&ctrl->target_vel);
|
|
|
+ refSpeed = line_ramp_step(&ctrl->ramp_target_vel);
|
|
|
+ maxSpeed = line_ramp_get_target(&ctrl->ramp_target_vel);
|
|
|
}
|
|
|
- float max_input = line_ramp_get_interp(&ctrl->torque_lim) * etcs_out;
|
|
|
+ float max_input = line_ramp_get_interp(&ctrl->ramp_torque_lim) * etcs_out;
|
|
|
if (maxSpeed >= 0) {
|
|
|
ctrl->pi_vel.max = max_input;
|
|
|
#ifdef CONFIG_SERVO_MOTOR
|
|
|
@@ -449,15 +449,15 @@ static void mot_contrl_ulimit(mot_contrl_t *ctrl) {
|
|
|
}
|
|
|
|
|
|
static void mot_contrl_rtlimit(mot_contrl_t *ctrl) {
|
|
|
- line_ramp_reset(&ctrl->torque_lim, ctrl->userlim.torque);
|
|
|
- line_ramp_reset(&ctrl->dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
- line_ramp_reset(&ctrl->vel_lim, ctrl->userlim.mot_vel);
|
|
|
+ line_ramp_reset(&ctrl->ramp_torque_lim, ctrl->userlim.torque);
|
|
|
+ line_ramp_reset(&ctrl->ramp_dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
+ line_ramp_reset(&ctrl->ramp_vel_lim, ctrl->userlim.mot_vel);
|
|
|
}
|
|
|
|
|
|
void mot_contrl_slow_task(mot_contrl_t *ctrl) {
|
|
|
- line_ramp_step(&ctrl->torque_lim);
|
|
|
- line_ramp_step(&ctrl->dc_curr_lim);
|
|
|
- line_ramp_step(&ctrl->vel_lim);
|
|
|
+ line_ramp_step(&ctrl->ramp_torque_lim);
|
|
|
+ line_ramp_step(&ctrl->ramp_dc_curr_lim);
|
|
|
+ line_ramp_step(&ctrl->ramp_vel_lim);
|
|
|
mot_contrl_dq_calc(ctrl);
|
|
|
}
|
|
|
|
|
|
@@ -520,9 +520,9 @@ void mot_contrl_set_dccurr_limit(mot_contrl_t *ctrl, float ibusLimit) {
|
|
|
}
|
|
|
ctrl->userlim.dc_curr = ibusLimit;
|
|
|
if (ABS(ctrl->dc_curr_filted) <= ibusLimit){
|
|
|
- line_ramp_reset(&ctrl->dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
+ line_ramp_reset(&ctrl->ramp_dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
}else {
|
|
|
- line_ramp_set_target(&ctrl->dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -532,15 +532,15 @@ void mot_contrl_set_vel_limit(mot_contrl_t *ctrl, float vel) {
|
|
|
}
|
|
|
ctrl->userlim.mot_vel = vel;
|
|
|
if (ABS(ctrl->foc.in.mot_velocity) <= vel) {
|
|
|
- line_ramp_reset(&ctrl->vel_lim, ctrl->userlim.mot_vel);
|
|
|
+ line_ramp_reset(&ctrl->ramp_vel_lim, ctrl->userlim.mot_vel);
|
|
|
}else {
|
|
|
- line_ramp_set_target(&ctrl->vel_lim, ctrl->userlim.mot_vel);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_vel_lim, ctrl->userlim.mot_vel);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void mot_contrl_set_vel_limit_rttime(mot_contrl_t *ctrl, u32 time) {
|
|
|
- line_ramp_set_time(&ctrl->vel_lim, (float)time);
|
|
|
- line_ramp_update(&ctrl->vel_lim);
|
|
|
+ line_ramp_set_time(&ctrl->ramp_vel_lim, (float)time);
|
|
|
+ line_ramp_update(&ctrl->ramp_vel_lim);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -553,15 +553,15 @@ void mot_contrl_set_torque_limit(mot_contrl_t *ctrl, float torque) {
|
|
|
}
|
|
|
ctrl->userlim.torque = torque;
|
|
|
if (ABS(ctrl->target_torque) <= torque){
|
|
|
- line_ramp_reset(&ctrl->torque_lim, ctrl->userlim.torque);
|
|
|
+ line_ramp_reset(&ctrl->ramp_torque_lim, ctrl->userlim.torque);
|
|
|
}else {
|
|
|
- line_ramp_set_target(&ctrl->torque_lim, ctrl->userlim.torque);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_torque_lim, ctrl->userlim.torque);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void mot_contrl_set_torque_limit_rttime(mot_contrl_t *ctrl, u32 time) {
|
|
|
- line_ramp_set_time(&ctrl->torque_lim, (float)time);
|
|
|
- line_ramp_update(&ctrl->torque_lim);
|
|
|
+ line_ramp_set_time(&ctrl->ramp_torque_lim, (float)time);
|
|
|
+ line_ramp_update(&ctrl->ramp_torque_lim);
|
|
|
}
|
|
|
|
|
|
float mot_contrl_get_ebrk_torque(mot_contrl_t *ctrl) {
|
|
|
@@ -574,19 +574,19 @@ float mot_contrl_get_ebrk_torque(mot_contrl_t *ctrl) {
|
|
|
void mot_contrl_set_ebrk_time(mot_contrl_t *ctrl, u32 time) {
|
|
|
ctrl->ebrk_ramp_time = time;
|
|
|
if (ctrl->mode_running == CTRL_MODE_EBRAKE) {
|
|
|
- line_ramp_set_time(&ctrl->input_torque, time);
|
|
|
- line_ramp_update(&ctrl->input_torque);
|
|
|
+ line_ramp_set_time(&ctrl->ramp_input_torque, time);
|
|
|
+ line_ramp_update(&ctrl->ramp_input_torque);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void mot_contrl_set_vdq(mot_contrl_t *ctrl, float vd, float vq) {
|
|
|
- line_ramp_set_target(&ctrl->target_vd, vd);
|
|
|
- line_ramp_set_target(&ctrl->target_vq, vq);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_target_vd, vd);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_target_vq, vq);
|
|
|
}
|
|
|
|
|
|
void mot_contrl_set_vdq_immediate(mot_contrl_t *ctrl, float vd, float vq) {
|
|
|
- line_ramp_reset(&ctrl->target_vd, vd);
|
|
|
- line_ramp_reset(&ctrl->target_vq, vq);
|
|
|
+ line_ramp_reset(&ctrl->ramp_target_vd, vd);
|
|
|
+ line_ramp_reset(&ctrl->ramp_target_vq, vq);
|
|
|
}
|
|
|
|
|
|
bool mot_contrl_set_cruise(mot_contrl_t *ctrl, bool enable) {
|
|
|
@@ -596,7 +596,7 @@ bool mot_contrl_set_cruise(mot_contrl_t *ctrl, bool enable) {
|
|
|
mot_contrl_set_error(ctrl, FOC_NowAllowed_With_Speed);
|
|
|
return false;
|
|
|
}
|
|
|
- line_ramp_reset(&ctrl->cruise_vel, motSpd);
|
|
|
+ line_ramp_reset(&ctrl->ramp_cruise_vel, motSpd);
|
|
|
ctrl->b_cruiseEna = enable;
|
|
|
}
|
|
|
return true;
|
|
|
@@ -605,7 +605,7 @@ bool mot_contrl_set_cruise(mot_contrl_t *ctrl, bool enable) {
|
|
|
|
|
|
bool mot_contrl_resume_cruise(mot_contrl_t *ctrl) {
|
|
|
ctrl->b_cruiseEna = true;
|
|
|
- line_ramp_set_time(&ctrl->cruise_vel, CONFIG_CRUISE_RAMP_TIME);
|
|
|
+ line_ramp_set_time(&ctrl->ramp_cruise_vel, CONFIG_CRUISE_RAMP_TIME);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -615,7 +615,7 @@ bool mot_contrl_set_cruise_speed(mot_contrl_t *ctrl, float rpm) {
|
|
|
rpm = CONFIG_MIN_CRUISE_RPM;
|
|
|
}
|
|
|
float vel = min(ABS(rpm),ctrl->userlim.mot_vel)*SIGN(rpm);
|
|
|
- line_ramp_set_target(&ctrl->cruise_vel, vel);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_cruise_vel, vel);
|
|
|
return true;
|
|
|
}
|
|
|
mot_contrl_set_error(ctrl, FOC_NotCruiseMode);
|
|
|
@@ -624,7 +624,7 @@ bool mot_contrl_set_cruise_speed(mot_contrl_t *ctrl, float rpm) {
|
|
|
|
|
|
bool mot_contrl_set_current(mot_contrl_t *ctrl, float is) {
|
|
|
is = fclamp(is, -ctrl->userlim.phase_curr, ctrl->userlim.phase_curr);
|
|
|
- line_ramp_set_target(&ctrl->target_current, is);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_target_current, is);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -632,17 +632,17 @@ void mot_contrl_set_torque_ramp_time(mot_contrl_t *ctrl, u32 acc, u32 dec) {
|
|
|
ctrl->torque_acc_time = acc;
|
|
|
ctrl->torque_dec_time = dec;
|
|
|
if (ctrl->mode_running == CTRL_MODE_TRQ) {
|
|
|
- line_ramp_set_acctime(&ctrl->input_torque, acc);
|
|
|
- line_ramp_set_dectime(&ctrl->input_torque, dec);
|
|
|
- line_ramp_update(&ctrl->input_torque);
|
|
|
+ line_ramp_set_acctime(&ctrl->ramp_input_torque, acc);
|
|
|
+ line_ramp_set_dectime(&ctrl->ramp_input_torque, dec);
|
|
|
+ line_ramp_update(&ctrl->ramp_input_torque);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void mot_contrl_set_torque_acc_time(mot_contrl_t *ctrl, u32 acc) {
|
|
|
ctrl->torque_acc_time = acc;
|
|
|
if (ctrl->mode_running == CTRL_MODE_TRQ) {
|
|
|
- line_ramp_set_acctime(&ctrl->input_torque, acc);
|
|
|
- line_ramp_update(&ctrl->input_torque);
|
|
|
+ line_ramp_set_acctime(&ctrl->ramp_input_torque, acc);
|
|
|
+ line_ramp_update(&ctrl->ramp_input_torque);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -657,7 +657,7 @@ bool mot_contrl_set_torque(mot_contrl_t *ctrl, float torque) {
|
|
|
torque_max = 0;
|
|
|
}
|
|
|
torque = fclamp(torque, torque_min, torque_max);
|
|
|
- line_ramp_set_target(&ctrl->input_torque, torque);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_input_torque, torque);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -673,7 +673,7 @@ bool mot_contrl_set_force_torque(mot_contrl_t *ctrl, float torque) {
|
|
|
torque_max = 0;
|
|
|
}
|
|
|
torque = fclamp(torque, torque_min, torque_max);
|
|
|
- line_ramp_set_target(&ctrl->input_torque, torque);
|
|
|
+ line_ramp_set_target(&ctrl->ramp_input_torque, torque);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -700,7 +700,7 @@ void mot_contrl_set_autohold(mot_contrl_t *ctrl, bool lock) {
|
|
|
}else if (ctrl->mode_running == CTRL_MODE_SPD) {
|
|
|
PI_Controller_Reset(&ctrl->pi_vel, hold_torque);
|
|
|
}
|
|
|
- line_ramp_reset(&ctrl->input_torque, hold_torque);
|
|
|
+ line_ramp_reset(&ctrl->ramp_input_torque, hold_torque);
|
|
|
ctrl->autohold_torque = hold_torque;
|
|
|
}else {
|
|
|
ctrl->autohold_torque = 0;
|
|
|
@@ -740,7 +740,7 @@ void mot_contrl_set_hw_brake(mot_contrl_t *ctrl, bool hw_brake) {
|
|
|
}
|
|
|
if (is_hw_brake_shutting_power(ctrl)) {
|
|
|
if (!ctrl->b_ebrk_running && !mot_contrl_energy_recovery(ctrl, true)) {
|
|
|
- line_ramp_reset(&ctrl->input_torque, 0);
|
|
|
+ line_ramp_reset(&ctrl->ramp_input_torque, 0);
|
|
|
}
|
|
|
}
|
|
|
cpu_exit_critical(mask);
|