From bfbceec761c17832a38cb3d43bea29993ce9792b Mon Sep 17 00:00:00 2001 From: wangfq Date: Fri, 26 Jun 2026 10:20:13 +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=E5=8F=AF=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20hold=5Ftime=20=E6=9B=BF=E4=BB=A3=E5=9B=BA=E5=AE=9A=20HOLD=5F?= =?UTF-8?q?TIME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Loop154_Unit 新增 hold_time 字段 (tick 数) - storage.c para_store_init 从 exist_mode 计算: hold_time = exist_mode * 20 * 5 - TMR15_GLOBAL_IRQHandler 中使用 unit->hold_time 替代固定 HOLD_TIME --- vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h | 1 + vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c | 2 +- vd960Loop/utilities/at32f421_freertos_demo/src/storage.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h b/vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h index f42f45e..42d50d9 100644 --- a/vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h +++ b/vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h @@ -121,6 +121,7 @@ typedef struct { /*--- 计数器 ---*/ uint16_t Hold_CNT; + uint16_t hold_time; // 有限存在时长 (tick 数) uint8_t INCNT, OUTCNT; /*--- 输出配置 ---*/ diff --git a/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c b/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c index 0addd46..c8187f7 100644 --- a/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c +++ b/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c @@ -295,7 +295,7 @@ void TMR15_GLOBAL_IRQHandler(void) /* 有限存在超时 */ if (unit->loop_VD_HOLD) { unit->Hold_CNT++; - if (unit->Hold_CNT > HOLD_TIME) { + if (unit->Hold_CNT > unit->hold_time) { unit->loop_VD_HOLD = 0; unit->Hold_CNT = 0; if (unit->loop_VD_FLAG) { diff --git a/vd960Loop/utilities/at32f421_freertos_demo/src/storage.c b/vd960Loop/utilities/at32f421_freertos_demo/src/storage.c index 1db86ed..498d456 100644 --- a/vd960Loop/utilities/at32f421_freertos_demo/src/storage.c +++ b/vd960Loop/utilities/at32f421_freertos_demo/src/storage.c @@ -184,6 +184,7 @@ void para_store_init(void) g_loop_states.loop_unit[i].loop_SensLevel = unitout->sensitvity & 0x03; g_loop_states.loop_unit[i].SET_PLUS = unitout->output_mode & 0x01; g_loop_states.loop_unit[i].SET_DLY = (unitout->output_mode >> 1) & 0x01; + g_loop_states.loop_unit[i].hold_time = unitout->exist_mode * 20 * 5; unitout++; }