From 30473596c542f4e475b6654bedf63a4cd4e44214 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期三, 29 十一月 2023 16:12:56 +0800 Subject: [PATCH] Merge branch '定位-临近' of http://47.108.70.204:60062/r/XRange_Tag into 定位-临近 --- Src/application/beep_logic_app.c | 112 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Src/application/beep_logic_app.c b/Src/application/beep_logic_app.c index 3e82a67..a501cc7 100644 --- a/Src/application/beep_logic_app.c +++ b/Src/application/beep_logic_app.c @@ -15,66 +15,66 @@ int32_t min_dist; void main_logic(void) //主逻辑在这里执行 { - static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime; - int16_t i; - //除UWB之外的其他代码... - static uint16_t beep_judge_cnt = 0; - if(beep_judge_cnt++ >= 100) - { - beep_judge_cnt = 0; - min_dist=0x7fffff; - for(i = 0; i < 255;i++) - { - if(g_Tagdist[i] < min_dist) - { - min_dist=g_Tagdist[i]; - } - - } - - if(min_dist <= g_com_map[ALARM_DISTANCE1]) - { - beep_ontime = ONTIME1; - beep_offtime = OFFTIME1; - beep_state=1; - RELAY1_ON; - RELAY2_ON; - - } - else if (min_dist <= g_com_map[ALARM_DISTANCE2]) - { - beep_ontime = ONTIME2; - beep_offtime = OFFTIME2; - beep_state=1; - RELAY2_ON; - } - //else if (min_dist <= g_com_map[ALARM_DISTANCE3]) + static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime; + int16_t i; + //除UWB之外的其他代码... + static uint16_t beep_judge_cnt = 0; + if(beep_judge_cnt++ >= 100) + { + beep_judge_cnt = 0; + min_dist=0x7fffff; + for(i = 0; i < 255; i++) + { + if(g_Tagdist[i] < min_dist) + { + min_dist=g_Tagdist[i]; + } + + } + + if(min_dist <= g_com_map[ALARM_DISTANCE1]) + { + beep_ontime = ONTIME1; + beep_offtime = OFFTIME1; + beep_state=1; + RELAY1_ON; + RELAY2_ON; + + } + else if (min_dist <= g_com_map[ALARM_DISTANCE2]) + { + beep_ontime = ONTIME2; + beep_offtime = OFFTIME2; + beep_state=1; + 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]+20) - { - RELAY1_OFF; - } - - if (min_dist >= g_com_map[ALARM_DISTANCE2]+20) - { - RELAY2_OFF; - } - -// + else { + beep_state=0; + } + if (min_dist >= g_com_map[ALARM_DISTANCE1]+20) + { + 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]) +// switch(g_com_map[ALARM_DEV]) // { // case 0: // BEEP2_ON; @@ -96,7 +96,7 @@ // BEEP_ON; // OUT2_ON; // break; -// } +// } // }else{ // timer_state=0; // beep_timer=0; @@ -104,7 +104,7 @@ // }else{ // if(beep_timer++ < beep_offtime) // { -// switch(g_com_map[ALARM_DEV]) +// switch(g_com_map[ALARM_DEV]) // { // case 0: // BEEP2_OFF; @@ -125,11 +125,11 @@ // timer_state=1; // beep_timer=0; // } -// +// // } -// +// // } else { -// switch(g_com_map[ALARM_DEV]) +// switch(g_com_map[ALARM_DEV]) // { // case 0: // BEEP2_OFF; @@ -147,8 +147,8 @@ // break; // } // } - } -} + } +} -- Gitblit v1.9.3