From 8b7f0ebd9a00c82ec30a6a0a68b7caca69b0f43c Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期一, 14 十二月 2020 11:43:07 +0800
Subject: [PATCH] V1.19 修改电机震动不连续BUG

---
 Src/main.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/Src/main.c b/Src/main.c
index a8269c4..dce6b43 100644
--- a/Src/main.c
+++ b/Src/main.c
@@ -123,17 +123,18 @@
 //	LED_TR_OFF;
 	current_time=GetLPTime();
 	//motor_state=2;
-		if(g_com_map[MOTOR_ONTIME]>0)
-	{
-		g_com_map[MOTOR_ONTIME]--;
-		motor_state = 1;
-	}
+//		if(g_com_map[MOTOR_ONTIME]>0)
+//	{
+//		g_com_map[MOTOR_ONTIME]--;
+//		motor_state = 1;
+//	}
+
 	switch(motor_state)
 		{case 0:
 			MOTOR_OFF;
 			break;
 		case 1:
-			if(current_time<MOTOR_ONTIME)
+			if(current_time<WARNING_MOTORONTIME)
 			{
 				MOTOR_ON;		
 			}else{
@@ -241,7 +242,7 @@
 	Usart1ParseDataCallback = UsartParseDataHandler;
 	parameter_init();
 	//deca_sleep(1000);
-	g_com_map[VERSION] = 0x0111;
+	g_com_map[VERSION] = 0x0113;
 #ifdef DEBUG_MODE
 //	g_com_map[DEV_ROLE]=1;
 //		g_com_map[DEV_ID]=1;
@@ -249,7 +250,6 @@
 //	g_com_map[MAX_REPORT_ANC_NUM]=1;
 	g_com_map[NOMOVESLEEP_TIME]=10;
 #endif
-		
 		if(g_com_map[COM_INTERVAL]==0)
 	{
 	  g_com_map[COM_INTERVAL]=100;
@@ -405,9 +405,10 @@
 		{
 			waitusart_timer--;
 		}
-			if(m_bEUARTTxEn==0&&waitusart_timer==0)
+			if(m_bEUARTTxEn==0&&waitusart_timer==0&&(motor_state==0||motor_state==3))
 			{	
-#ifndef DEBUG_MODE				
+#ifndef DEBUG_MODE	
+if(!HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin))				
 				HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);  
 #endif
 			}

--
Gitblit v1.9.3