fix: 有限存在超时改为可配置 hold_time 替代固定 HOLD_TIME
- 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
This commit is contained in:
@@ -121,6 +121,7 @@ typedef struct {
|
|||||||
|
|
||||||
/*--- 计数器 ---*/
|
/*--- 计数器 ---*/
|
||||||
uint16_t Hold_CNT;
|
uint16_t Hold_CNT;
|
||||||
|
uint16_t hold_time; // 有限存在时长 (tick 数)
|
||||||
uint8_t INCNT, OUTCNT;
|
uint8_t INCNT, OUTCNT;
|
||||||
|
|
||||||
/*--- 输出配置 ---*/
|
/*--- 输出配置 ---*/
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ void TMR15_GLOBAL_IRQHandler(void)
|
|||||||
/* 有限存在超时 */
|
/* 有限存在超时 */
|
||||||
if (unit->loop_VD_HOLD) {
|
if (unit->loop_VD_HOLD) {
|
||||||
unit->Hold_CNT++;
|
unit->Hold_CNT++;
|
||||||
if (unit->Hold_CNT > HOLD_TIME) {
|
if (unit->Hold_CNT > unit->hold_time) {
|
||||||
unit->loop_VD_HOLD = 0;
|
unit->loop_VD_HOLD = 0;
|
||||||
unit->Hold_CNT = 0;
|
unit->Hold_CNT = 0;
|
||||||
if (unit->loop_VD_FLAG) {
|
if (unit->loop_VD_FLAG) {
|
||||||
|
|||||||
@@ -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].loop_SensLevel = unitout->sensitvity & 0x03;
|
||||||
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;
|
||||||
|
|
||||||
unitout++;
|
unitout++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user