diff --git a/vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h b/vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h index 42d50d9..85b53bd 100644 --- a/vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h +++ b/vd960Loop/utilities/at32f421_freertos_demo/inc/TaskLoop.h @@ -122,6 +122,7 @@ typedef struct { /*--- 计数器 ---*/ uint16_t Hold_CNT; uint16_t hold_time; // 有限存在时长 (tick 数) + uint16_t relay_delay; // 继电器延时 (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 c8187f7..5af1aaa 100644 --- a/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c +++ b/vd960Loop/utilities/at32f421_freertos_demo/src/TaskLoop.c @@ -271,7 +271,7 @@ void TMR15_GLOBAL_IRQHandler(void) if (unit->loop_FLAG_OUT) { if (!unit->SET_DLY) { unit->OUTCNT++; - if (unit->OUTCNT > OUT_DELAY) { + if (unit->OUTCNT > unit->relay_delay) { unit->loop_FLAG_OUT = 0; unit->loop_FLAG_PLUSE = 1; unit->OUTCNT = 0; diff --git a/vd960Loop/utilities/at32f421_freertos_demo/src/storage.c b/vd960Loop/utilities/at32f421_freertos_demo/src/storage.c index 498d456..62a6f6f 100644 --- a/vd960Loop/utilities/at32f421_freertos_demo/src/storage.c +++ b/vd960Loop/utilities/at32f421_freertos_demo/src/storage.c @@ -185,6 +185,7 @@ void para_store_init(void) 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; + g_loop_states.loop_unit[i].relay_delay = unitout->delay_time * 2; unitout++; }