From f29299e0f55536545590f3813c122bcc7e069b00 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期四, 13 一月 2022 10:34:24 +0800 Subject: [PATCH] 1.59 发货 --- 源码/核心板/Src/application/beep_logic_app.c | 60 +++++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 45 insertions(+), 15 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 89a10f2..dafd917 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" @@ -15,35 +15,58 @@ int32_t min_dist1,min_dist2; extern u16 JDQ_time; -void Relay1Task(u16 min_dist) +u8 JDQgroup1_state,JDQgroup2_state; +void Relay1Task(void) { static u8 distoffset1=0,distoffset2=0; static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime; - if (min_dist <= g_com_map[ALARM_DISTANCE2]+distoffset1) + if (min_dist1 <= g_com_map[ALARM_DISTANCE2]+distoffset1) { - beep_ontime = 1; + JDQgroup1_state=2; + } + else if (min_dist1 <= g_com_map[ALARM_DISTANCE3]+distoffset2) + { + JDQgroup1_state=1; + } + else{ + JDQgroup1_state=0; + } + + if (min_dist2 <= g_com_map[RELAY2_DISTANCE2]+distoffset1) + { + JDQgroup2_state=2; + } + else if (min_dist2 <= g_com_map[RELAY2_DISTANCE3]+distoffset2) + { + JDQgroup2_state=1; + } + else{ + JDQgroup2_state=0; + } + + if(JDQgroup1_state==2||JDQgroup2_state==2) + { + 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) - { - beep_ontime = JDQ_time; + }else if(JDQgroup1_state==1||JDQgroup2_state==1) + { + beep_ontime = JDQ_time; beep_offtime = JDQ_time; beep_state=1; distoffset1=0; distoffset2=0; - } - else{ - beep_state=0; + }else{ + beep_state=0; distoffset1=0; distoffset2=0; beep_timer = 0; timer_state = 1; - } + } if(beep_state!=0) { @@ -51,6 +74,7 @@ { if(beep_timer++ < beep_ontime) { + RELAY2_ON; RELAY1_ON; }else{ @@ -60,6 +84,7 @@ }else{ if(beep_timer++ < beep_offtime) { + RELAY2_OFF; RELAY1_OFF; }else{ @@ -70,7 +95,7 @@ } }else { RELAY1_OFF; - // RELAY2_OFF; + RELAY2_OFF; } } void Relay2Task(u16 min_dist) @@ -131,6 +156,8 @@ RELAY2_OFF; } } +#define RELAY2IDHEAD 9 +extern u16 tagid_list[TAG_NUM_IN_SYS]; void main_logic(void) //主逻辑在这里执行 { uint16_t i; @@ -145,18 +172,21 @@ min_dist2=0x1ffff; for(i = 0; i < 255;i++) { + if((tagid_list[i]>>12)!=RELAY2IDHEAD) + { if(g_Tagdist[i] < min_dist1&&g_Tagdist[i]>g_com_map[ALARM_DISTANCE1]) { min_dist1=g_Tagdist[i]; } + }else{ if(g_Tagdist[i] < min_dist2&&g_Tagdist[i]>g_com_map[RELAY2_DISTANCE1]) { min_dist2=g_Tagdist[i]; } - + } } - Relay1Task(min_dist1); - Relay2Task(min_dist2); + Relay1Task(); + // Relay2Task(min_dist2); } }else{ -- Gitblit v1.9.3