Explorar o código

V 0.0.1.8-测试,1.BMS累计充放电能力更改

LAPTOP-KB7QFH2U\ChenJie-PC %!s(int64=2) %!d(string=hai) anos
pai
achega
943c98a8df

+ 1 - 1
Project_Settings/Debugger/S32K146_4G_Debug_FLASH_PNE.launch

@@ -216,5 +216,5 @@
 </listAttribute>
 <stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;536806032&quot; label=&quot;RX_Buffer[UART_LPUART2]&quot;/&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;536823956&quot; label=&quot;GpsBufferGet&quot;/&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;255&quot; label=&quot;SocketId&quot;/&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;536805632&quot; label=&quot;0x1fff0100&quot;/&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;536806632&quot; label=&quot;0x1fff04e8&quot;/&gt;&#13;&#10;&lt;/memoryBlockExpressionList&gt;&#13;&#10;"/>
 <stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
-<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="0x10000000,0x1fffbea0,0x1fff7dee,0x1fffbbed,0x1fffbc88,0x1fffbc8a,0x14200,0x80000,0x1fffbb20,0x1fffbb3e,0x1fffb348,0x1fffb5cd,0x14600,0x200022be,0x200022be+60"/>
+<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="0x1fffbbed,0x1fffbc88,0x1fffbc8a,0x14200,0x80000,0x1fffbb20,0x1fffbb3e,0x1fffb348,0x1fffb5cd,0x14600,0x200022be,0x200022be+60,0x1fff3f53,0x1fff3f53+0x34,0x1fff3f53+0x34+0x34"/>
 </launchConfiguration>

+ 1 - 1
code/app/AppGlobalVar.c

@@ -25,7 +25,7 @@ uint16 WebSitePort = 8812;
 #endif
 
 #define defaultSn "SPFPFL264S226D001"
-const uint32 AppSwVersion = 0x00000105;
+const uint32 AppSwVersion = 0x00000108;
 
 const uint8 DataModuleType = 0x02;//01=NB,02-4G
 const uint16 HwVersion = 0x001;

+ 1 - 0
code/app/AppGlobalVar.h

@@ -57,6 +57,7 @@ typedef struct _AppEppType
 {
 	uint32 battDischrgAccCap;  //单位maH
 	uint32 battDischrgAccEnrg; //单位wh
+	uint32 battChrgAccEnrg; //单位wh
 	uint16 battCycleTimes;
 } AppEppBody;
 typedef struct _AppConfigType

+ 17 - 2
code/app/AppTaskUart0.c

@@ -181,8 +181,23 @@ bool bmsOtherInfoDecode(uint8 *dataPtr) //其他数据解析
 	}
 	maxCellVol = (dataPtr[(0x13) * 2] << 8) | dataPtr[(0x13) * 2 + 1];
 	minCellVol = (dataPtr[(0x16) * 2] << 8) | dataPtr[(0x16) * 2 + 1];
-	AppConfigInfo.AppDataInfo.battDischrgAccEnrg = (dataPtr[(0x34) * 2] << 8) | dataPtr[(0x34) * 2 + 1];
-	AppConfigInfo.AppDataInfo.battCycleTimes = AppConfigInfo.AppDataInfo.battDischrgAccEnrg / 49000;
+	if(battPackVol==0)
+	{
+		return false;
+	}
+	else
+	{
+		uint32 temp = 0;
+		temp = ((dataPtr[(0x34) * 2] << 24) | (dataPtr[(0x34) * 2 + 1]<<16)| (dataPtr[(0x35) * 2]<<8)| (dataPtr[(0x35) * 2 + 1]))*100;
+		if ((temp- AppConfigInfo.AppDataInfo.battDischrgAccEnrg)>10)
+		{
+			AppConfigInfo.appSaveFlg = true;
+		}
+		AppConfigInfo.AppDataInfo.battDischrgAccEnrg = temp;
+		temp = ((dataPtr[(0x32) * 2] << 24) | (dataPtr[(0x32) * 2 + 1]<<16)| (dataPtr[(0x33) * 2]<<8)| (dataPtr[(0x33) * 2 + 1]))*100;
+		AppConfigInfo.AppDataInfo.battChrgAccEnrg = temp;
+		AppConfigInfo.AppDataInfo.battCycleTimes = AppConfigInfo.AppDataInfo.battDischrgAccEnrg / 49000;
+	}
 	return true;
 }
 void UartBusReadDataFunc(uint16 RegAddrBegin, uint16 Reg_Num, bool (*decodeFunc)(uint8 *dataPtr))

+ 6 - 5
code/app/AppTaskUart1.c

@@ -1075,6 +1075,7 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
 	}
 	case 0x8A:
 	{
+		uint32 temp = 0;
 		AccInfoToTcp AccInfoToTcpMsg;
 		*SendLen = sizeof(AccInfoToTcpMsg);
 		SendBuffer = pvPortMalloc(*SendLen);
@@ -1107,11 +1108,11 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
 		AccInfoToTcpMsg.AccMsg.accDrvMiles[1] = 0;
 		AccInfoToTcpMsg.AccMsg.sohNoCalibrTime[0] = 0;
 		AccInfoToTcpMsg.AccMsg.sohNoCalibrTime[1] = 0;
-		AccInfoToTcpMsg.AccMsg.accChrgEng[0] = 0;
-		AccInfoToTcpMsg.AccMsg.accChrgEng[1] = 0;
-		AccInfoToTcpMsg.AccMsg.accChrgEng[2] = 0;
-		AccInfoToTcpMsg.AccMsg.accChrgEng[3] = 0;
-		uint32 temp = 0;
+		temp = AppConfigInfo.AppDataInfo.battChrgAccEnrg/1000;
+		AccInfoToTcpMsg.AccMsg.accChrgEng[0] = temp>>24;
+		AccInfoToTcpMsg.AccMsg.accChrgEng[1] = temp>>16;
+		AccInfoToTcpMsg.AccMsg.accChrgEng[2] = temp>>8;
+		AccInfoToTcpMsg.AccMsg.accChrgEng[3] = temp;
 		temp = AppConfigInfo.AppDataInfo.battDischrgAccEnrg/1000;
 		AccInfoToTcpMsg.AccMsg.accDischrgEng[0] = temp>>24;
 		AccInfoToTcpMsg.AccMsg.accDischrgEng[1] = temp>>16;