From 29b382988c5ff4d6f8d2df877beecbc9a7c4c0f7 Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期日, 17 四月 2022 16:50:49 +0800
Subject: [PATCH] V1.30

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

diff --git a/Src/main.c b/Src/main.c
index 2d5be71..539c0a8 100644
--- a/Src/main.c
+++ b/Src/main.c
@@ -94,7 +94,8 @@
 uint16_t lastpoll_count,interval_count,slot_startcount,tag_frequency,lastpoll_time,current_time;
 extern uint8_t module_power;
 extern float nomove_count;
-uint8_t imu_enable,motor_enable;	
+uint8_t imu_enable,motor_enable;
+float cltimeleft;
 u16 GetLPTime(void)
 {
 	u16 count=HAL_LPTIM_ReadCounter(&hlptim1);
@@ -168,12 +169,21 @@
 			}				
 			break;
 		case 2:
+            if(cltimeleft<=0)
+            {
+                cltimeleft = g_com_map[COOLINGTIME_INDEX]; 
+            }
+            if(cltimeleft>g_com_map[COOLINGTIME_INDEX]-20)
+            {
 			if(hardware_type==NSH1)
 				{MOTOR_ON;
 				}else if(hardware_type==GP)
 				{
 				HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_3);
 				}	
+            }else{
+                MOTOR_OFF;
+            }
 			break;
 		case 3:
 			if(hardware_type==NSH1)
@@ -306,7 +316,7 @@
 	hardware_pici = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+2);
 	hardware_type = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4);
 	//deca_sleep(1000);
-	g_com_map[VERSION] = (1<<8)|28;
+	g_com_map[VERSION] = (1<<8)|30;
     active_flag = g_com_map[ACTIVE_INDEX];
     	module_power = g_com_map[POWER];
 	imu_enable=g_com_map[IMU_ENABLE];
@@ -933,6 +943,10 @@
 	current_slotnum++;
 	SetNextPollTime(tyncpoll_time);
 	nomove_count+=(float)g_com_map[COM_INTERVAL]/1000;
+    if(cltimeleft>0)
+    {
+        cltimeleft-=(float)g_com_map[COM_INTERVAL]/1000;
+    }
     if(motor_keeptime>0)
 	{	
 	motor_keeptime-=(float)g_com_map[COM_INTERVAL]/1000;

--
Gitblit v1.9.3