fix: CAPVD_fast 初始化条件错误导致始终为 0

根因: TMR3 ISR 首次捕获时直接设置 loop1_CAPVD (不为 0),
导致 vd1_task 的 if(CAPVD==0) 分支永远不执行,
CAPVD_fast 保持 INIT_VD 的 0 值。

修复: CAPVD_fast 判断改为 ==0 时首次锁定为当前 CAPVD 值,
后续正常执行快速 IIR 更新。
This commit is contained in:
wangfq
2026-06-26 16:17:01 +08:00
parent 17e4b07860
commit e0e79db40e

View File

@@ -665,7 +665,9 @@ void vd1_task(void)
}
/* 1b. 快速 IIR — α=0.5: (old + new) / 2 */
if (loop1_CAPVD_fast != 0) {
if (loop1_CAPVD_fast == 0) {
loop1_CAPVD_fast = loop1_CAPVD; // 首次直接锁定
} else {
loop1_CAPVD_fast = (loop1_CAPVD_fast + loop1_CAPVD) / 2;
}