Skip to content

Commit 6836071

Browse files
committed
perf: ⚡ 优化一点电机对象的计算
1 parent 1dee376 commit 6836071

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

device/fc_stp_base.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,8 @@ void fc_stp_base_heart(fc_stp_base_t *stp)
7171
}
7272
else
7373
{
74-
int32_t v_last = stp->v_now;
7574
stp->curve_func(stp, FC_STP_CLAC_NEXT, &(stp->v_now)); // 重新计算下次速度
76-
if (stp->v_now != v_last)
77-
{
78-
stp->freq_set(stp, stp->v_now, &(stp->pulse_scale)); // 仅在速度变化时才重设频率
79-
}
75+
stp->freq_set(stp, stp->v_now, &(stp->pulse_scale)); // 仅在速度变化时才重设频率
8076
}
8177
}
8278
else // 到达指定位置了
@@ -175,7 +171,7 @@ void fc_stp_base_stop(fc_stp_base_t *stp, bool safe_stop)
175171
if (safe_stop) // 缓停
176172
{
177173
STP_HEART_ENTER(stp);
178-
stp->curve_hold_steps = 0; // 退出平台段跳算状态
174+
stp->curve_hold_steps = 0; // 退出平台段跳算状态
179175
stp->curve_func(stp, FC_STP_CLAC_DEC, &(stp->v_now)); // 调用函数进入减速状态
180176
stp->freq_set(stp, stp->v_now, &(stp->pulse_scale));
181177
STP_HEART_EXIT(stp);

0 commit comments

Comments
 (0)