From 8c44ac4d11d4e72eba7fc0506b1b78ec86c33dda Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期三, 13 十一月 2019 10:58:24 +0800 Subject: [PATCH] V1.7 --- 源码/核心板/Src/application/dw_app.h | 2 源码/核心板/Src/main.c | 2 源码/核心板/Src/application/beep_logic_app.c | 164 +++++++++++++++++++++++++++--------------------------- 源码/核心板/Src/application/dw_app.c | 4 4 files changed, 86 insertions(+), 86 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 ae59906..41b4659 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,7 +12,7 @@ #define ONTIME3 1 // 500ms #define OFFTIME3 5 // 500ms -int16_t min_dist; +int32_t min_dist; void main_logic(void) //主逻辑在这里执行 { static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime; @@ -22,7 +22,7 @@ if(beep_judge_cnt++ >= 100) { beep_judge_cnt = 0; - min_dist=0x7fff; + min_dist=0x7fffff; for(i = 0; i < 255;i++) { if(g_Tagdist[i] < min_dist) @@ -67,86 +67,86 @@ 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; - } - } +// +// 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; +// } +// } } } diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" index 4c8db75..d017aa1 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" @@ -145,7 +145,7 @@ float dis_after_filter; //当前距离值 LPFilter_Frac* p_Dis_Filter; //测距用的低通滤波器 -uint16_t g_Tagdist[TAG_NUM_IN_SYS]; +int32_t g_Tagdist[TAG_NUM_IN_SYS]; uint8_t g_flag_Taggetdist[256]; /*------------------------------------ Functions ------------------------------------------*/ @@ -612,7 +612,7 @@ dis_after_filter=dist_cm; hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]; if(tag_id_recv-TAG_ID_START<=TAG_NUM_IN_SYS) - if(abs(hex_dist-his_dist[tag_id_recv-TAG_ID_START])<1000&&hex_dist<100000) + if(abs(hex_dist-his_dist[tag_id_recv-TAG_ID_START])<1000&&hex_dist<100000&&hex_dist>-1000) { g_Tagdist[tag_id_recv-TAG_ID_START] = hex_dist; anchor_dist_last_frm[tag_id_recv-TAG_ID_START] = hex_dist; diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.h" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.h" index e3388ff..bda82cb 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.h" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.h" @@ -37,7 +37,7 @@ void Tag_App(void); void Anchor_App(void); void tag_sleep_configuraion(void); -extern uint16_t g_Tagdist[TAG_NUM_IN_SYS]; +extern int32_t g_Tagdist[TAG_NUM_IN_SYS]; extern uint8_t g_flag_Taggetdist[256]; extern void TagDistClear(void); void Dw1000_App_Init(void); diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" index 656a042..ec26f99 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" @@ -57,7 +57,7 @@ // g_com_map[DEV_ID]=1; // g_com_map[COM_INTERVAL]=10; OUT485_ENABLE; - g_com_map[VERSION] = 0x0106; + g_com_map[VERSION] = 0x0107; temp=(float)g_com_map[MAX_REPORT_ANC_NUM]*4/3; temp2=g_com_map[DEV_ID]*g_com_map[MAX_REPORT_ANC_NUM]*4/3; if(temp2<temp) -- Gitblit v1.9.3