Browse Source

工作模式转换更改,采用电流判定

LAPTOP-EG88H5BE\86151 2 năm trước cách đây
mục cha
commit
025cfafa13
3 tập tin đã thay đổi với 25 bổ sung5 xóa
  1. 10 2
      src/AppFunc.c
  2. 15 1
      src/AppTaskMain.c
  3. 0 2
      src/EmbeddedCoder_src/BCU.c

+ 10 - 2
src/AppFunc.c

@@ -364,7 +364,13 @@ void BattLockFunc(void)
 void BattWorkDelayFunc(UINT8 battWorkCurrentState)
 {
 	static UINT16 workDelayCounter = 0;
-
+	static UINT8 battWorkCurrentStateTemp = 0;
+	if(battWorkCurrentStateTemp!=battWorkCurrentState)
+	{
+		workDelayCounter = 0;
+		battWorkCurrentStateTemp = battWorkCurrentState;
+	}
+     
 	if (battWorkCurrentState == BATT_IDLE_SYM && BattWorkStateDelay == BATT_DISCHARGE_SYM) //从放电转静置 60s延时
 	{
 		workDelayCounter++;
@@ -383,7 +389,7 @@ void BattWorkDelayFunc(UINT8 battWorkCurrentState)
 			BattWorkStateDelay = battWorkCurrentState;
 		}
 	}
-	else if (battWorkCurrentState == BATT_DISCHARGE_SYM && (battI > 10010) && BattWorkStateDelay != BATT_DISCHARGE_SYM) //从 充电或者静置 转放电 2s延时
+	else if (battWorkCurrentState == BATT_DISCHARGE_SYM && BattWorkStateDelay != BATT_DISCHARGE_SYM) //从 充电或者静置 转放电 2s延时
 	{
 		workDelayCounter++;
 		if (workDelayCounter >= 2)
@@ -406,6 +412,8 @@ void BattWorkDelayFunc(UINT8 battWorkCurrentState)
 		BattWorkStateDelay = battWorkCurrentState;
 		workDelayCounter = 0;
 	}
+
+	//printf("cnt:%d,delay:%d,st:%d,I:%d\n",workDelayCounter,BattWorkStateDelay,battWorkCurrentState,battI);
 	return;
 }
 /**

+ 15 - 1
src/AppTaskMain.c

@@ -90,7 +90,21 @@ static void MainTask(void *arg)
             //状态转换延时
             if (TimeCounter % 10 == 0)
             {
-                BattWorkDelayFunc(battWorkState);
+            	UINT8 battWorkStateI = 0;
+            	if(battI>10005)
+            	{
+            		battWorkStateI = BATT_DISCHARGE_SYM;	
+            	}
+				else if(battI<9995&&battI!=0)
+				{
+				   battWorkStateI = BATT_CHARGE_SYM;	
+				}
+				else
+				{
+				   battWorkStateI = BATT_IDLE_SYM;	
+				}
+				
+				BattWorkDelayFunc(battWorkStateI);
 #ifdef USING_PRINTF1
                 printf("[%d]-%d-%d,%d,%d \n", __LINE__, TimeCounter, socd_pct_battSoc, fastChargeTemp, normalChargeTemp);
 #endif

+ 0 - 2
src/EmbeddedCoder_src/BCU.c

@@ -133,8 +133,6 @@ void BCU(void)
 
 					ihd_st_heatStat = battHeatEnableState;
                     // ihd_flg_DTCClear = 1;   //////clear
-                    ihd_st_heatStat = battHeatEnableState;
-                    // ihd_flg_DTCClear = 1; //////clear
 
                     //调用算法
                     SFM();