From 0256c99ccc58728085e797e179f1954d60944efc Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期一, 02 十一月 2020 15:31:43 +0800
Subject: [PATCH] 医院出货V2.5

---
 Src/main.c |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/Src/main.c b/Src/main.c
index 679a53c..acac73c 100644
--- a/Src/main.c
+++ b/Src/main.c
@@ -210,23 +210,27 @@
 	}
 
 
-u16 total_slotnum,current_slotnum;
+u16 current_slotnum;
 extern int32_t offsettimeus;
 #define FIXSLOT
+#define FIXSLOTPOS  3
+u16 slotpos_intoatl;
 uint16_t bigslot_num;
-uint8_t fix_slotpos =8; 
+uint8_t fix_slotpos =FIXSLOTPOS; 
 int32_t lpcount,lptime,target_time;
 void SetNextPollTime(u16 slotpos)
 {
-u16 slotpos_intoatl;
+
 #ifdef FIXSLOT
 	slotpos = fix_slotpos;
 #endif
 
-	if(current_slotnum>=total_slotnum)
-		current_slotnum-=total_slotnum;
+	if(current_slotnum>=tag_frequency)
+		current_slotnum-=tag_frequency;
 	slotpos_intoatl = current_slotnum*bigslot_num+slotpos;
 
+	if(current_slotnum==19)
+	{slotpos_intoatl = current_slotnum*bigslot_num+slotpos;}
 	target_time=(slotpos_intoatl*SLOTTIME_MS+100)*100;
 	//if(target_time<90000)
 	{
@@ -248,17 +252,18 @@
 	Usart1ParseDataCallback = UsartParseDataHandler;
 	parameter_init();
 	//deca_sleep(1000);
-	g_com_map[VERSION] = 0x0204;
+	g_com_map[VERSION] = 0x0205;
 #ifdef DEBUG_MODE
 //	g_com_map[DEV_ROLE]=1;
-		g_com_map[DEV_ID]=0x123;
-	g_com_map[COM_INTERVAL]=100;
+//		g_com_map[DEV_ID]=0x123;
+//	g_com_map[COM_INTERVAL]=100;
 //	g_com_map[MAX_REPORT_ANC_NUM]=1;
 //	g_com_map[NOMOVESLEEP_TIME]=10;
-//			g_com_map[IMU_ENABLE]=0;
+			g_com_map[IMU_ENABLE]=0;
+	g_com_map[COM_INTERVAL]=100;
 #endif
 //g_com_map[NOMOVESLEEP_TIME]=10;
-	 g_com_map[COM_INTERVAL]=50;
+	// g_com_map[COM_INTERVAL]=100;
 		if(g_com_map[COM_INTERVAL]==0)
 	{
 	  g_com_map[COM_INTERVAL]=100;
@@ -280,8 +285,7 @@
 	slot_startcount=tyncpoll_time*1000/LPTIMER_LSB;
 	lastpoll_time=tyncpoll_time;
   tag_frequency = 1000/g_com_map[COM_INTERVAL];
-	total_slotnum = 1000/g_com_map[COM_INTERVAL];
-		bigslot_num = TOTAL_SLOTNUM/tag_frequency;
+	bigslot_num = TOTAL_SLOTNUM/tag_frequency;
 	current_slotnum=1;
 	current_time=GetLPTime();
 		if (HAL_LPTIM_TimeOut_Start_IT(&hlptim1, LPTIMER_1S_COUNT, slot_startcount) != HAL_OK)  //system time is 1010ms   1 puls=30.518us
@@ -809,6 +813,7 @@
   /*Enter the Standby mode*/
   HAL_PWR_EnterSTANDBYMode();	
 }
+extern u16 tagslotpos;
 extern uint8_t tx_near_msg[80],stationary_flag,gotosleep_flag;
 float key_keeptime;
 void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim)
@@ -817,7 +822,7 @@
 	i++;
 	g_start_send_flag=1;
 	current_slotnum++;
-	SetNextPollTime(tyncpoll_time);
+	SetNextPollTime(tagslotpos);
 	nomove_count+=(float)g_com_map[COM_INTERVAL]/1000;
 	if(!GET_USERKEY)
 	{

--
Gitblit v1.9.3