fix: 离开延时 OUT_DELAY 改为可配置 relay_delay
- Loop154_Unit 新增 relay_delay 字段 - storage.c 从 delay_time 计算: relay_delay = delay_time * 2 - TMR15_GLOBAL_IRQHandler 使用 unit->relay_delay 替代固定 OUT_DELAY
This commit is contained in:
@@ -122,6 +122,7 @@ typedef struct {
|
|||||||
/*--- 计数器 ---*/
|
/*--- 计数器 ---*/
|
||||||
uint16_t Hold_CNT;
|
uint16_t Hold_CNT;
|
||||||
uint16_t hold_time; // 有限存在时长 (tick 数)
|
uint16_t hold_time; // 有限存在时长 (tick 数)
|
||||||
|
uint16_t relay_delay; // 继电器延时 (tick 数)
|
||||||
uint8_t INCNT, OUTCNT;
|
uint8_t INCNT, OUTCNT;
|
||||||
|
|
||||||
/*--- 输出配置 ---*/
|
/*--- 输出配置 ---*/
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ void TMR15_GLOBAL_IRQHandler(void)
|
|||||||
if (unit->loop_FLAG_OUT) {
|
if (unit->loop_FLAG_OUT) {
|
||||||
if (!unit->SET_DLY) {
|
if (!unit->SET_DLY) {
|
||||||
unit->OUTCNT++;
|
unit->OUTCNT++;
|
||||||
if (unit->OUTCNT > OUT_DELAY) {
|
if (unit->OUTCNT > unit->relay_delay) {
|
||||||
unit->loop_FLAG_OUT = 0;
|
unit->loop_FLAG_OUT = 0;
|
||||||
unit->loop_FLAG_PLUSE = 1;
|
unit->loop_FLAG_PLUSE = 1;
|
||||||
unit->OUTCNT = 0;
|
unit->OUTCNT = 0;
|
||||||
|
|||||||
@@ -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_PLUS = unitout->output_mode & 0x01;
|
||||||
g_loop_states.loop_unit[i].SET_DLY = (unitout->output_mode >> 1) & 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].hold_time = unitout->exist_mode * 20 * 5;
|
||||||
|
g_loop_states.loop_unit[i].relay_delay = unitout->delay_time * 2;
|
||||||
|
|
||||||
unitout++;
|
unitout++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user