From 9e8a2b9c07fddcba3f0d2ae84c0c65f0f7f16c6a Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期四, 27 一月 2022 20:37:12 +0800
Subject: [PATCH] 中断模式,超宽带芯片读取状态异常,没有超时标志位

---
 源码/核心板/Src/main.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

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 b592840..960746b 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"
@@ -46,7 +46,7 @@
 	RCC_Configuration();
 	//SystemInit();
 	NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x5000);
-	Nvic_Init();
+	
 //	Systick_Init();
 	TIM3_Int_Init();
 	Led_Init();
@@ -55,8 +55,9 @@
 	Uart1_Init();
 	Spi_Init();
 	ADC_Configuration();
-	IWDG_Config(IWDG_Prescaler_128 ,4095);   //10s
-    IWDG_Feed();
+	//IWDG_Config(IWDG_Prescaler_128 ,4095);   //10s
+	Nvic_Init();
+  IWDG_Feed();
 	GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
 }
 u8 anchor_type;
@@ -99,6 +100,7 @@
 		if(dist_threshold>15000)
 		{dist_threshold = 15000;}
 }
+extern u8 needanchorrx;  
 u16 JDQ_time;
 int16_t g_commap_antdelay;
 void Program_Init(void)
@@ -109,6 +111,7 @@
 	parameter_init();
 	//deca_sleep(1000);
 	HeartBeatInit();
+	Modbus_RegMap();
 #ifdef DEBUG_MODE
 //	g_com_map[DEV_ROLE]=1;
 //		g_com_map[DEV_ID]=1;
@@ -168,11 +171,12 @@
 	
 	if(g_com_map[DEV_ROLE])
 	{
+		needanchorrx = 0;
 	printf("标签ID: %d .\r\n",dev_id);
 	printf("通讯间隔: %d ms.\r\n",g_com_map[COM_INTERVAL]);
 	printf("单次通讯基站数量: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]);
 	}else{
-	
+	needanchorrx = 1;
 	anchor_type = dev_id%g_com_map[MAX_REPORT_ANC_NUM];
 	printf("基站ID: %x .\r\n",dev_id);
 	printf("基站类型: %c .\r\n",anchor_type+0x41);
@@ -305,7 +309,7 @@
 		}
 
 	}
-    
+
 int main(void)
 {
  
@@ -329,11 +333,13 @@
 	{
 		g_start_send_flag = 0;		
 		Tag_App();
+		needanchorrx = 1;
 	}
 		IdleTask();		
-if(g_com_map[DEV_ROLE]==0)
-		Anchor_App();
-
+if(g_com_map[DEV_ROLE]==0&&needanchorrx==1)
+    {needanchorrx = 0;
+        Anchor_Start();
+    }
 	}
 }
 

--
Gitblit v1.9.3