From b3a961fbe28a5be0ae75203fe9a01a98ae7c2e4c Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期一, 11 十一月 2019 19:42:37 +0800 Subject: [PATCH] 周一发到华星,继电器有bug --- 源码/核心板/Src/application/beep_logic_app.c | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 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 33b32a1..ae59906 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" @@ -12,17 +12,17 @@ #define ONTIME3 1 // 500ms #define OFFTIME3 5 // 500ms - +int16_t min_dist; void main_logic(void) //主逻辑在这里执行 { static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime; - uint16_t i, min_dist; + int16_t i; //除UWB之外的其他代码... static uint16_t beep_judge_cnt = 0; if(beep_judge_cnt++ >= 100) { beep_judge_cnt = 0; - min_dist=0xffff; + min_dist=0x7fff; for(i = 0; i < 255;i++) { if(g_Tagdist[i] < min_dist) @@ -37,19 +37,36 @@ beep_ontime = ONTIME1; beep_offtime = OFFTIME1; beep_state=1; - }else if (min_dist <= g_com_map[ALARM_DISTANCE2]) + RELAY1_ON; + RELAY2_ON; + + } + else if (min_dist <= g_com_map[ALARM_DISTANCE2]) { beep_ontime = ONTIME2; beep_offtime = OFFTIME2; beep_state=1; - }else if (min_dist <= g_com_map[ALARM_DISTANCE3]) - { - beep_ontime = ONTIME3; - beep_offtime = OFFTIME3; - beep_state=1; - }else{ + RELAY2_ON; + } + //else if (min_dist <= g_com_map[ALARM_DISTANCE3]) +// { +// beep_ontime = ONTIME3; +// beep_offtime = OFFTIME3; +// beep_state=1; +// } + else{ beep_state=0; } + if (min_dist >= g_com_map[ALARM_DISTANCE1]+10) + { + RELAY1_OFF; + } + + if (min_dist >= g_com_map[ALARM_DISTANCE2]+10) + { + RELAY2_OFF; + } + if(beep_state==1) { -- Gitblit v1.9.3