From e391e8ff47bd0c6b55fe268ac54414c093ae6246 Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期四, 16 九月 2021 20:08:30 +0800
Subject: [PATCH] V1.55 增加馈线长度,测试通过

---
 源码/核心板/Src/main.c |   24 ++++++++++++++++--------
 1 files changed, 16 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 c4f90b7..5c98265 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"
@@ -2,6 +2,7 @@
 #include "Rcc_Nvic_Systick.h"
 #include "Usart.h"
 #include "Spi.h"
+#include "Flash.h"
 #include "led.h"
 #include "beep.h"
 #include "dw_driver.h"
@@ -81,16 +82,25 @@
 void ComMapCheck(void)
 {
 
+    if(g_com_map[ANT_LENGTH]>10000)
+    {
+        g_com_map[ANT_LENGTH] = 0;
+    }
     if(g_com_map[WAR_JDQ_TIME]>1000||g_com_map[WAR_JDQ_TIME]<0)
     {
         g_com_map[WAR_JDQ_TIME] = 1;
     }
+    	if(g_com_map[COM_INTERVAL]==0)
+	{
+	  g_com_map[COM_INTERVAL]=100;
+	}
     if(dist_threshold<300)
 		{dist_threshold = 300;}
 		if(dist_threshold>15000)
 		{dist_threshold = 15000;}
 }
 u16 JDQ_time;
+u16 g_commap_antdelay;
 void Program_Init(void)
 {	float temp;
 	u16 temp2;
@@ -110,14 +120,12 @@
 		save_com_map_to_flash();
 #endif
 	OUT485_ENABLE;
-	if(g_com_map[COM_INTERVAL]==0)
-	{
-	  g_com_map[COM_INTERVAL]=100;
-	}
-    JDQ_time = g_com_map[WAR_JDQ_TIME];
-	g_com_map[VERSION] = 0x0133;
-    dist_threshold = (g_com_map[SPEEDFILTER_THRES]*10)/(1000/g_com_map[COM_INTERVAL]);
 	ComMapCheck();	
+	g_com_map[VERSION] = 0x0137;
+    FLASH_Read(FLASH_HARDWARE_FLAG, (uint8_t*)&g_com_map[HARDWAREFLAG_INDEX], 16);
+    dist_threshold = (g_com_map[SPEEDFILTER_THRES]*10)/(1000/g_com_map[COM_INTERVAL]);
+    g_commap_antdelay = (float)g_com_map[ANT_LENGTH]*5.8;
+    JDQ_time = g_com_map[WAR_JDQ_TIME]*10;
 	g_com_map[SW_TYPE] = 	SW_FANGZHUANG;
 	dev_id = g_com_map[DEV_ID];
         group_id=g_com_map[GROUP_ID];
@@ -277,7 +285,7 @@
 int main(void)
 {
  
-	Device_Init();
+ 	Device_Init();
 	//StartUpTest();
 	Program_Init();
 	Dw1000_Init();

--
Gitblit v1.9.3