From 9f117ad80a25735b7ee4e54c2fdc375a828a899c Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期二, 15 六月 2021 10:52:57 +0800 Subject: [PATCH] 增加信号轻度,去掉滤波 --- 源码/核心板/Src/application/dw_app.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 36 insertions(+), 12 deletions(-) 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 5ab8cdc..a03c04c 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" @@ -135,7 +135,7 @@ /* Configure DW1000. See NOTE 6 below. */ dwt_configure(&config);//配置DW1000 - SetNLOSNTMSettings(); + // SetNLOSNTMSettings(); /* Apply default antenna delay value. See NOTE 1 below. */ dwt_setrxantennadelay(RX_ANT_DLY); //设置接收天线延迟 @@ -704,7 +704,26 @@ UART_PushFrame(usart_send,6+report_num*6); #endif } + double firstpath_power, rx_power,rec_firstpath_power; + double f1, f2, r1, r2; +uint16_t F1,F2,F3,N,C; +double B = 131072; +double A = 121.74; +double min_power; + dwt_rxdiag_t d1; +double LOS(dwt_rxdiag_t *dia) { + F1 = dia->firstPathAmp1; + F2 = dia->firstPathAmp2; + F3 = dia->firstPathAmp3; + N = dia->rxPreamCount; + C = dia->maxGrowthCIR; + + firstpath_power=10* log10((F1*F1+F2*F2+F3*F3)/(N*N))-A; + rx_power=10*log10(C*B/(N*N))-A; + // min_power = - 10 * log10((F1 *F1 + F2 * F2 + F3 * F3) / (C *B)); + return min_power; + } void Tag_App(void)//发送模式(TAG标签) { //LED0_ON; @@ -926,7 +945,10 @@ tof = tof_dtu * DWT_TIME_UNITS; distance = tof * SPEED_OF_LIGHT;//距离=光速*飞行时间 dist_no_bias = distance - dwt_getrangebias(config.chan, (float)distance, config.prf); //距离减去矫正系数 - dist_cm = dist_no_bias * 1000; //dis 为单位为cm的距离 + dist_cm = dist_no_bias * 1000; //dis 为单位为cm的距离 + + dwt_readdiagnostics(&d1); + LOS(&d1); /*--------------------------以下为非测距逻辑------------------------*/ //dist_cm=33000; getrange_success = 1; @@ -935,10 +957,10 @@ dis_after_filter=dist_cm; hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]*10; g_flag_Taggetdist[taglist_pos]=0; - if(hex_dist>0&&hex_dist<2000000) - { - if(abs(hex_dist-his_dist[taglist_pos])<10000||misdist_num[taglist_pos]>3) - { + // if(hex_dist>0&&hex_dist<2000000) + //{ + //if(abs(hex_dist-his_dist[taglist_pos])<10000||misdist_num[taglist_pos]>3) + //{ int32_t filter_dist; #ifdef TDFILTER NewTrackingDiffUpdate(taglist_pos, (float)hex_dist); @@ -950,7 +972,7 @@ tagdist_list[taglist_pos] = filter_dist; his_dist[taglist_pos]=hex_dist; g_Tagdist[taglist_pos]=filter_dist; - #ifndef USART_INTEGRATE_OUTPUT + #ifndef USART_INTEGRATE_OUTPUT usart_send[2] = 1;//正常模式 usart_send[3] = 17;//数据段长度 usart_send[4] = frame_seq_nb2;//数据段长度 @@ -959,6 +981,8 @@ memcpy(&usart_send[9],&tagdist_list[taglist_pos],4); usart_send[13] = battary; usart_send[14] = button; + usart_send[15] = firstpath_power; + usart_send[16] = rx_power; checksum = Checksum_u16(&usart_send[2],17); memcpy(&usart_send[19],&checksum,2); UART_PushFrame(usart_send,21); @@ -967,11 +991,11 @@ memcpy(&usart_send_anc[6+6*anc_report_num],&tagdist_list[taglist_pos],4); anc_report_num++; #endif - }else{ - // printf("%d",hex_dist); - misdist_num[taglist_pos]++; - } - } +// }else{ +// // printf("%d",hex_dist); +// misdist_num[taglist_pos]++; +// } +// } } }else{ //printf("%x/n",status_reg); -- Gitblit v1.9.3