From b660ffcc47c00bdf00a40a2c8b7fcb60e6fc794e Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期日, 19 九月 2021 18:05:08 +0800 Subject: [PATCH] V1.66 修改继电器触发延迟BUG --- 源码/核心板/Src/application/beep_logic_app.c | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/beep_logic_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/beep_logic_app.c" index 702660a..171a26c 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/beep_logic_app.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/beep_logic_app.c" @@ -21,11 +21,13 @@ static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime; if (min_dist <= g_com_map[ALARM_DISTANCE2]+distoffset1) { - beep_ontime = JDQ_time; - beep_offtime = JDQ_time; + beep_ontime = 1; + beep_offtime = 0; beep_state=2; distoffset1=0; distoffset2=0; + beep_timer = 0; + timer_state = 1; } else if (min_dist <= g_com_map[ALARM_DISTANCE3]+distoffset2) { @@ -39,6 +41,8 @@ beep_state=0; distoffset1=0; distoffset2=0; + beep_timer = 0; + timer_state = 1; } if(beep_state!=0) @@ -64,6 +68,9 @@ } } + }else { + RELAY1_OFF; + // RELAY2_OFF; } } void Relay2Task(u16 min_dist) @@ -72,11 +79,13 @@ static uint8_t beep_state2,timer_state2,beep_timer2,beep_ontime2,beep_offtime2; if (min_dist <= g_com_map[RELAY2_DISTANCE2]+distoffset12) { - beep_ontime2 = JDQ_time; - beep_offtime2 = JDQ_time; + beep_ontime2 = 1; + beep_offtime2 = 0; beep_state2=2; distoffset12=0; distoffset22=0; + timer_state2=1; + beep_timer2=0; } else if (min_dist <= g_com_map[RELAY2_DISTANCE3]+distoffset22) { @@ -90,6 +99,8 @@ beep_state2=0; distoffset12=0; distoffset22=0; + timer_state2=1; + beep_timer2=0; } if(beep_state2!=0) @@ -115,6 +126,9 @@ } } + }else { + // RELAY1_OFF; + RELAY2_OFF; } } void main_logic(void) //主逻辑在这里执行 @@ -122,7 +136,7 @@ uint16_t i; //除UWB之外的其他代码... static uint16_t beep_judge_cnt = 0; - if(g_com_map[ALARM_DISTANCE1]!=0||g_com_map[ALARM_DISTANCE2]!=0||g_com_map[ALARM_DISTANCE3]!=0) + if(g_com_map[ALARM_DISTANCE1]!=0||g_com_map[ALARM_DISTANCE2]!=0||g_com_map[ALARM_DISTANCE3]!=0||g_com_map[RELAY2_DISTANCE1]!=0||g_com_map[RELAY2_DISTANCE2]!=0||g_com_map[RELAY2_DISTANCE3]!=0) { if(beep_judge_cnt++ >= 100) { -- Gitblit v1.9.3