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/dw_app.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 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 7c3db08..20612af 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"
@@ -842,6 +842,26 @@
 				dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR);
 			}
 }
+ 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;
+  }
 u16 smallcar_idlist[10]={0x4052,0x4032,0x4055,0x4034,0x4016,0x4010,0x4036,0x4027,0x4024,0x4047};
 extern u16 dist_threshold;
 u8 misdist_num[TAG_NUM_IN_SYS],seize_anchor,getrange_success=0;
@@ -940,7 +960,9 @@
 					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;
@@ -991,6 +1013,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);

--
Gitblit v1.9.3