From eb9f21b08d3106fed424b1b68f2cdcbd8d0e3b10 Mon Sep 17 00:00:00 2001 From: wangfq Date: Fri, 26 Jun 2026 12:02:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=89=E9=99=90=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E6=94=B9=E4=B8=BA=E9=80=9A=E9=81=93=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E9=87=8D=E5=90=AF,=20=E9=81=BF=E5=85=8D=E7=BB=A7?= =?UTF-8?q?=E7=94=B5=E5=99=A8=E7=AB=8B=E5=8D=B3=E9=87=8D=E6=96=B0=E5=90=B8?= =?UTF-8?q?=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原逻辑设 loop_FLAG_OUT=1 触发正常离车流程, 但线圈物理上仍有车, vd1_task 立刻重新检测到有车→继电器又吸合。 改为与安全复位一致的重启逻辑: - LC_Reset=1, loop_INI_LOOP=1 → 强制重新初始化 - loop_stable=0, loop_LOOP_OK0=0 → 重建基线(含稳定期128样本) - 清除所有标志位和计数器 - 移除 loop_VD_FLAG 前置条件 (set_loops_relay_off 无条件执行) --- .../at32f421_freertos_demo/src/TaskLoop.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c b/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c index 784b83d..c0bbf49 100644 --- a/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c +++ b/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c @@ -292,20 +292,29 @@ void TMR15_GLOBAL_IRQHandler(void) } } - /* 有限存在超时 */ + /* 有限存在超时 — 通道重启,重新建立基线 */ if (unit->loop_VD_HOLD) { unit->Hold_CNT++; if (unit->Hold_CNT > unit->hold_time) { unit->loop_VD_HOLD = 0; unit->Hold_CNT = 0; - if (unit->loop_VD_FLAG) { - set_loops_relay_off(unit->loop_num); - unit->loop_VD_FLAG = 0; - unit->loop_FLAG_OUT = 1; - unit->LC_HOLD = 0; - unit->loop_ORG_CNT = 0; - unit->loop_ORG_SUM = 0; - } + set_loops_relay_off(unit->loop_num); + unit->loop_VD_FLAG = 0; + unit->loop_FLAG_IN = 0; + unit->loop_FLAG_OUT = 0; + unit->loop_FLAG_PLUSE = 0; + unit->LC_HOLD = 0; + unit->LC_Reset = 1; + unit->loop_INI_LOOP = 1; + unit->loop_LOOP_OK0 = 0; + unit->loop_stable = 0; + unit->loop_ORG_CNT = 0; + unit->loop_ORG_SUM = 0; +#if USE_FLATNESS_EXIT + unit->exit_state = 0; + unit->max_slope = 0; + unit->max_slope_rate = 0; +#endif } }