Browse Source

1.储能统计信息更改Bug

LAPTOP-KB7QFH2U\ChenJie-PC 2 years ago
parent
commit
fe5e4ed1bf

+ 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="0x1fff050e,0,0x14200,0x14000,0x0,0x1fffb21c,0x1fffb600,0x1fff04e8,14000000,0x14000000,0x1fffbd12,0x1fffb0f0,0x1fff0500,0x1fffbe28,0x1fffbca0"/>
+<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="0x14000,0x0,0x1fffb21c,0x1fffb600,0x1fff04e8,14000000,0x14000000,0x1fffbd12,0x1fffb0f0,0x1fff0500,0x1fffbe28,0x1fffbca0,0x1fffbb50,0x1fffbb20,0x1fffbb08"/>
 </launchConfiguration>

+ 2 - 2
src/AppTaskUart0.c

@@ -402,8 +402,8 @@ bool bmsOtherInfoDecode(uint8 *dataPtr)//
 	battFanState = getbit(dataPtr[(0x09 + OtherInfoAddrOffset + TEMP_NUM) * 2 + 1],3);
 	battRelayState = getbit(dataPtr[(0x09 + OtherInfoAddrOffset + TEMP_NUM) * 2 + 1],4);
 	battConverState = getbit(dataPtr[(0x09 + OtherInfoAddrOffset + TEMP_NUM) * 2 + 1],6);
-	battSeparateState = getbit(dataPtr[(0x1B + OtherInfoAddrOffset + TEMP_NUM) * 2],7);
-	if (battSeparateState==0)
+	battSeparateState = !getbit(dataPtr[(0x1B + OtherInfoAddrOffset + TEMP_NUM) * 2],7);
+	if (battSeparateState==1)
 	{
 		battMOSSwitchState = battMOSSwitchState | (0x01 << 2);
 	}

+ 30 - 10
src/AppTaskUart1.c

@@ -718,11 +718,11 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
 	{
 		DataIdx = VerMsg; //版本信息发送
 	}
-	else if (TcpSendTimeCounter % 10 == 0)
+	else if (TcpSendTimeCounter % 60 == 0)
 	{
 		DataIdx = BattMsg; //电池信息发送
 	}
-	else if ((TcpSendTimeCounter+1) % 10 == 0)
+	else if ((TcpSendTimeCounter+1) % 60 == 0)
 	{
 		DataIdx = 0x83; //储能开关信息发送
 	}
@@ -730,7 +730,7 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
 	{
 		DataIdx = GpsMsg; //定位信息发送
 	}
-	else if ((TcpSendTimeCounter+3) % 240 == 0)
+	else if ((TcpSendTimeCounter+3) % 10 == 0)
 	{
 		DataIdx = 0x93; //储能电量信息发送
 	}
@@ -987,7 +987,7 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
 	case 0x93://储能场景的电量信息
 	{
 		StorageInfoToTcp2 StorageInfo2;
-		*SendLen = sizeof(StorageInfo);
+		*SendLen = sizeof(StorageInfo2);
 		SendBuffer = malloc(*SendLen);
 		uint16 DataLen = 0;
 		DataLen = (uint16)sizeof(StorageInfo2.StorageMsg2);
@@ -1012,12 +1012,32 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
 		StorageInfo2.StorageMsg2.msgCollectionTimeUTC[3] = UTC8TimeTcp.hour & 0xFF;	 // hour
 		StorageInfo2.StorageMsg2.msgCollectionTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
 		StorageInfo2.StorageMsg2.msgCollectionTimeUTC[5] = UTC8TimeTcp.second & 0xFF;
-		StorageInfo2.StorageMsg2.meter1AllPwr = meterAllPwr[0];
-		StorageInfo2.StorageMsg2.meter1PosPwr = meterPosPwr[0];
-		StorageInfo2.StorageMsg2.meter1NegPwr = meterNegPwr[0];
-		StorageInfo2.StorageMsg2.meter2AllPwr = meterAllPwr[1];
-		StorageInfo2.StorageMsg2.meter2PosPwr = meterPosPwr[1];
-		StorageInfo2.StorageMsg2.meter2NegPwr = meterNegPwr[1];
+		StorageInfo2.StorageMsg2.meter1AllPwr[0] = meterAllPwr[0]>>24;
+		StorageInfo2.StorageMsg2.meter1AllPwr[1] = meterAllPwr[0]>>16;
+		StorageInfo2.StorageMsg2.meter1AllPwr[2] = meterAllPwr[0]>>8;
+		StorageInfo2.StorageMsg2.meter1AllPwr[3] = meterAllPwr[0]>>0;
+		StorageInfo2.StorageMsg2.meter1PosPwr[0] = meterPosPwr[0]>>24;
+		StorageInfo2.StorageMsg2.meter1PosPwr[1] = meterPosPwr[0]>>16;
+		StorageInfo2.StorageMsg2.meter1PosPwr[2] = meterPosPwr[0]>>8;
+		StorageInfo2.StorageMsg2.meter1PosPwr[3] = meterPosPwr[0]>>0;
+		StorageInfo2.StorageMsg2.meter1NegPwr[0] = meterNegPwr[0]>>24;
+		StorageInfo2.StorageMsg2.meter1NegPwr[1] = meterNegPwr[0]>>16;
+		StorageInfo2.StorageMsg2.meter1NegPwr[2] = meterNegPwr[0]>>8;
+		StorageInfo2.StorageMsg2.meter1NegPwr[3] = meterNegPwr[0]>>0;
+
+		StorageInfo2.StorageMsg2.meter2AllPwr[0] = meterAllPwr[1]>>24;
+		StorageInfo2.StorageMsg2.meter2AllPwr[1] = meterAllPwr[1]>>16;
+		StorageInfo2.StorageMsg2.meter2AllPwr[2] = meterAllPwr[1]>>8;
+		StorageInfo2.StorageMsg2.meter2AllPwr[3] = meterAllPwr[1]>>0;
+		StorageInfo2.StorageMsg2.meter2PosPwr[0] = meterPosPwr[1]>>24;
+		StorageInfo2.StorageMsg2.meter2PosPwr[1] = meterPosPwr[1]>>16;
+		StorageInfo2.StorageMsg2.meter2PosPwr[2] = meterPosPwr[1]>>8;
+		StorageInfo2.StorageMsg2.meter2PosPwr[3] = meterPosPwr[1]>>0;
+		StorageInfo2.StorageMsg2.meter2NegPwr[0] = meterNegPwr[1]>>24;
+		StorageInfo2.StorageMsg2.meter2NegPwr[1] = meterNegPwr[1]>>16;
+		StorageInfo2.StorageMsg2.meter2NegPwr[2] = meterNegPwr[1]>>8;
+		StorageInfo2.StorageMsg2.meter2NegPwr[3] = meterNegPwr[1]>>0;
+
 		StorageInfo2.CRC = bcc_chk((uint8 *)&StorageInfo2, sizeof(StorageInfo2) - 1);
 		memcpy(SendBuffer, &StorageInfo2, sizeof(StorageInfo2));
 		*PtrSendAddr = (uint32)SendBuffer;

+ 6 - 6
src/AppTaskUart1.h

@@ -116,12 +116,12 @@ typedef struct StorageInfoType2
 	uint8 sendTimeUTC[6];
 	uint8 msgMark;
 	uint8 msgCollectionTimeUTC[6];
-	uint32 meter1AllPwr;
-	uint32 meter1PosPwr;
-	uint32 meter1NegPwr;
-	uint32 meter2AllPwr;
-	uint32 meter2PosPwr;
-	uint32 meter2NegPwr;
+	uint8 meter1AllPwr[4];
+	uint8 meter1PosPwr[4];
+	uint8 meter1NegPwr[4];
+	uint8 meter2AllPwr[4];
+	uint8 meter2PosPwr[4];
+	uint8 meter2NegPwr[4];
 } StorageInfo2;
 typedef struct StorageInfoToTcpType2
 {