From af4710835316cb2fd8dd70db7867e23147206f31 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期四, 17 二月 2022 09:33:48 +0800 Subject: [PATCH] 增加跳跃时间 --- 源码/核心板/Src/application/beep_logic_app.c | 175 +++++++++++++++++++++++++++++++--------------------------- 1 files changed, 94 insertions(+), 81 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 a40b977..3e82a67 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 - +int32_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=0x7fffff; for(i = 0; i < 255;i++) { if(g_Tagdist[i] < min_dist) @@ -37,6 +37,8 @@ beep_ontime = ONTIME1; beep_offtime = OFFTIME1; beep_state=1; + RELAY1_ON; + RELAY2_ON; } else if (min_dist <= g_com_map[ALARM_DISTANCE2]) @@ -44,6 +46,7 @@ beep_ontime = ONTIME2; beep_offtime = OFFTIME2; beep_state=1; + RELAY2_ON; } //else if (min_dist <= g_com_map[ALARM_DISTANCE3]) // { @@ -54,86 +57,96 @@ else{ beep_state=0; } - - if(beep_state==1) + if (min_dist >= g_com_map[ALARM_DISTANCE1]+20) { - if(timer_state==1) - { - if(beep_timer++ < beep_ontime) - { - switch(g_com_map[ALARM_DEV]) - { - case 0: - BEEP2_ON; - BEEP_OFF; - OUT2_OFF; - break; - case 1: - BEEP_ON; - BEEP2_OFF; - OUT2_OFF; - break; - case 2: - OUT2_ON; - BEEP_OFF; - BEEP2_OFF; - break; - default: - BEEP2_ON; - BEEP_ON; - OUT2_ON; - break; - } - }else{ - timer_state=0; - beep_timer=0; - } - }else{ - if(beep_timer++ < beep_offtime) - { - switch(g_com_map[ALARM_DEV]) - { - case 0: - BEEP2_OFF; - break; - case 1: - BEEP_OFF; - break; - case 2: - OUT2_OFF; - break; - default: - BEEP2_OFF; - BEEP_OFF; - OUT2_OFF; - break; - } - }else{ - timer_state=1; - beep_timer=0; - } - - } - - } else { - switch(g_com_map[ALARM_DEV]) - { - case 0: - BEEP2_OFF; - break; - case 1: - BEEP_OFF; - break; - case 2: - OUT2_OFF; - break; - default: - BEEP2_OFF; - BEEP_OFF; - OUT2_OFF; - break; - } + RELAY1_OFF; } + + if (min_dist >= g_com_map[ALARM_DISTANCE2]+20) + { + RELAY2_OFF; + } + +// +// if(beep_state==1) +// { +// if(timer_state==1) +// { +// if(beep_timer++ < beep_ontime) +// { +// switch(g_com_map[ALARM_DEV]) +// { +// case 0: +// BEEP2_ON; +// BEEP_OFF; +// OUT2_OFF; +// break; +// case 1: +// BEEP_ON; +// BEEP2_OFF; +// OUT2_OFF; +// break; +// case 2: +// OUT2_ON; +// BEEP_OFF; +// BEEP2_OFF; +// break; +// default: +// BEEP2_ON; +// BEEP_ON; +// OUT2_ON; +// break; +// } +// }else{ +// timer_state=0; +// beep_timer=0; +// } +// }else{ +// if(beep_timer++ < beep_offtime) +// { +// switch(g_com_map[ALARM_DEV]) +// { +// case 0: +// BEEP2_OFF; +// break; +// case 1: +// BEEP_OFF; +// break; +// case 2: +// OUT2_OFF; +// break; +// default: +// BEEP2_OFF; +// BEEP_OFF; +// OUT2_OFF; +// break; +// } +// }else{ +// timer_state=1; +// beep_timer=0; +// } +// +// } +// +// } else { +// switch(g_com_map[ALARM_DEV]) +// { +// case 0: +// BEEP2_OFF; +// break; +// case 1: +// BEEP_OFF; +// break; +// case 2: +// OUT2_OFF; +// break; +// default: +// BEEP2_OFF; +// BEEP_OFF; +// OUT2_OFF; +// break; +// } +// } } } -- Gitblit v1.9.3