From 912dd0543931c411d411923ee37f0433df940fe1 Mon Sep 17 00:00:00 2001
From: WXK <287788329@qq.com>
Date: 星期五, 07 二月 2025 10:53:08 +0800
Subject: [PATCH] 2.12,加入方庄距离1-2之间报警  其他不报警

---
 Src/application/dw_app.c |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c
index 7024a32..b460ef3 100644
--- a/Src/application/dw_app.c
+++ b/Src/application/dw_app.c
@@ -190,6 +190,29 @@
      * As this example only handles one incoming frame with always the same delay and timeout, those values can be set here once for all. */
 				//设置接收超时时间
 }
+uint8_t uwb_onflag=1;
+void UWB_RXON()
+{
+    if(!g_com_map[MODBUS_MODE])
+    {
+    Dw1000_Init();
+    uwb_onflag=1;
+    g_com_map[UWB_ONFLAG]=uwb_onflag;
+    save_com_map_to_flash();    
+    }
+}
+void UWB_RXOFF()
+{
+    if(!g_com_map[MODBUS_MODE])
+    {
+    dwt_setinterrupt(  DWT_INT_RFCG | (DWT_INT_ARFE | DWT_INT_RFSL | DWT_INT_SFDT | DWT_INT_RPHE | DWT_INT_RFCE | DWT_INT_RFTO | DWT_INT_RXPTO), 0);
+    dwt_forcetrxoff();
+    dwt_entersleep();
+    uwb_onflag=0;
+    g_com_map[UWB_ONFLAG]=uwb_onflag;
+    save_com_map_to_flash();    
+    }
+}
 void Dw1000_App_Init(void)
 {
 //g_com_map[DEV_ID] = 0x0b;
@@ -1218,10 +1241,10 @@
 		IdleTask();
 		
 	};
-		if(status_reg==0xffffffff)
-					{
-						NVIC_SystemReset();
-					}
+//		if(status_reg==0xffffffff)
+//					{
+//						NVIC_SystemReset();
+//					}
 					if (status_reg & SYS_STATUS_RXFCG)//如果成功接收
 						{
 							dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_RXFCG | SYS_STATUS_TXFRS);//清楚寄存器标志位				

--
Gitblit v1.9.3