Browse Source

V0.2.1.8,海南项目协议更改,0-高压下电,1-预充,2-高压上电

LAPTOP-KB7QFH2U\ChenJie-PC 1 year ago
parent
commit
f019441f97
3 changed files with 9 additions and 8 deletions
  1. 1 1
      code/app/AppGlobalVar.c
  2. 1 1
      code/app/AppTaskCan.c
  3. 7 6
      code/app/AppTaskUart1.c

+ 1 - 1
code/app/AppGlobalVar.c

@@ -35,7 +35,7 @@ uint16 WebSitePort = 8812;
 #endif
 #endif
 
 
 //*全局变量*//
 //*全局变量*//
-const uint32 AppSwVersion = 0x00020107;
+const uint32 AppSwVersion = 0x00020108;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint16 HwVersion = 0x0102;
 const uint16 HwVersion = 0x0102;
 const uint32 BlSwVersion = 0x00000002;
 const uint32 BlSwVersion = 0x00000002;

+ 1 - 1
code/app/AppTaskCan.c

@@ -76,7 +76,7 @@ static void CalAccAhFunc(void)//100ms运行一次
 	static float tmp_DischrgAh = 0;//mah
 	static float tmp_DischrgAh = 0;//mah
 	static float tmp_ChrgAh = 0;//mah
 	static float tmp_ChrgAh = 0;//mah
 //	if(BcuRxLongError[3]==0 && (BcuRxLongError[24]==1||BcuRxShortError[24]==1))//在CAN消息正常,CAN[24]存在时间长的问题,不建议用丢帧处理
 //	if(BcuRxLongError[3]==0 && (BcuRxLongError[24]==1||BcuRxShortError[24]==1))//在CAN消息正常,CAN[24]存在时间长的问题,不建议用丢帧处理
-	if(BcuRxLongError[3]==0 && BMS_Mode==0)
+	if(BcuRxLongError[3]==0 && BMS_Mode==2)//海南协议为 0-高压下电,2-高压上电
 	{
 	{
 		if(BMS_CharSt==1)//1是正在充电
 		if(BMS_CharSt==1)//1是正在充电
 		{
 		{

+ 7 - 6
code/app/AppTaskUart1.c

@@ -255,7 +255,7 @@ static void TcpDataSendFeqHandFunc(uint8* DataIdx)
 		TcpDataFeq.GpsFeqCnt[1] = 60*3;
 		TcpDataFeq.GpsFeqCnt[1] = 60*3;
 		TcpDataFeq.TrkBattFeqCnt[1]  = 10;
 		TcpDataFeq.TrkBattFeqCnt[1]  = 10;
 	}
 	}
-	else if(BMS_Mode==0)//放电中
+	else if(BMS_Mode==2)//放电中
 	{
 	{
 		TcpDataFeq.GpsFeqCnt[1] = 10;
 		TcpDataFeq.GpsFeqCnt[1] = 10;
 		TcpDataFeq.TrkBattFeqCnt[1]  = 30;
 		TcpDataFeq.TrkBattFeqCnt[1]  = 30;
@@ -967,7 +967,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 								{%.2f,%.2f,%.2f,%.2f,%.2f;\
 								{%.2f,%.2f,%.2f,%.2f,%.2f;\
 								%.2f,%.2f,%.2f,%.2f,%.2f,}\
 								%.2f,%.2f,%.2f,%.2f,%.2f,}\
 								{%.2f,%.2f,%.2f,%.2f,%.2f;\
 								{%.2f,%.2f,%.2f,%.2f,%.2f;\
-								%.2f,%.2f,%.2f,%.2f,%.2f,},%s,%d",
+								%.2f,%.2f,%.2f,%.2f,%.2f,},%s,%d--%d,%d,%d",
 				returnFreq[0][0], returnFreq[0][1], returnFreq[0][2], returnFreq[0][3], returnFreq[0][4],
 				returnFreq[0][0], returnFreq[0][1], returnFreq[0][2], returnFreq[0][3], returnFreq[0][4],
 				returnP[0][0], returnP[0][1], returnP[0][2], returnP[0][3], returnP[0][4],
 				returnP[0][0], returnP[0][1], returnP[0][2], returnP[0][3], returnP[0][4],
 
 
@@ -975,7 +975,8 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 				returnP[1][0], returnP[1][1], returnP[1][2], returnP[1][3], returnP[1][4],
 				returnP[1][0], returnP[1][1], returnP[1][2], returnP[1][3], returnP[1][4],
 
 
 				returnFreq[2][0], returnFreq[2][1], returnFreq[2][2], returnFreq[2][3], returnFreq[2][4],
 				returnFreq[2][0], returnFreq[2][1], returnFreq[2][2], returnFreq[2][3], returnFreq[2][4],
-				returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp,DeviceErrNum);
+				returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp,DeviceErrNum,
+				BMS_Mode,BMS_StPosRly,BMS_StNegRly);
 
 
 		BufferLen = strlen((const char *)rbuf);
 		BufferLen = strlen((const char *)rbuf);
 		*SendLen = BufferLen + sizeof(DebugMsgInfo);
 		*SendLen = BufferLen + sizeof(DebugMsgInfo);
@@ -1033,11 +1034,11 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 		*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8	second
 		*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8	second
 		memcpy(SendBuffer + 0x25, VIN, 17);
 		memcpy(SendBuffer + 0x25, VIN, 17);
 		*(SendBuffer + 0x36) = (vehicleStatus & 0xFF); // uint8	整车状态
 		*(SendBuffer + 0x36) = (vehicleStatus & 0xFF); // uint8	整车状态
-		if (BMS_Mode == 1)
+		if (BMS_Mode == 2)
 		{
 		{
 			bmsHVOn = 1;
 			bmsHVOn = 1;
 		}
 		}
-		else if (BMS_Mode == 2)
+		else if (BMS_Mode == 0)
 		{
 		{
 			bmsHVOn = 0;
 			bmsHVOn = 0;
 		}
 		}
@@ -1108,7 +1109,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 		*(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF);	   // uint8	minute
 		*(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF);	   // uint8	minute
 		*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF);	   // uint8	second
 		*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF);	   // uint8	second
 		*(SendBuffer + 0x25) = (CSQValue & 0xFF);			   // uint8	csq
 		*(SendBuffer + 0x25) = (CSQValue & 0xFF);			   // uint8	csq
-		*(SendBuffer + 0x26) = (BMS_Mode & 0xFF);			   // uint8	BMS当前状态,0:预留;1:高压上电;2:高压下电;3:无效;,Re-1,Off-0,
+		*(SendBuffer + 0x26) = (bmsHVOn & 0xFF);			   // uint8	BMS当前状态,0:预留;1:高压上电;2:高压下电;3:无效;,Re-1,Off-0,
 		*(SendBuffer + 0x27) = (BMS_CharGunSt & 0xFF);		   // uint8	直流充电枪连接状态,0:未连接1 : 连接, Re - 1, Off - 0,
 		*(SendBuffer + 0x27) = (BMS_CharGunSt & 0xFF);		   // uint8	直流充电枪连接状态,0:未连接1 : 连接, Re - 1, Off - 0,
 		*(SendBuffer + 0x28) = (BMS_FtLvl & 0xFF);			   // uint8	当前最高故障等级,0-正常 1-1级 轻微故障 2-2级 较严重故障 3-3级 最严重故障,精度_1,偏移量_0,单位_
 		*(SendBuffer + 0x28) = (BMS_FtLvl & 0xFF);			   // uint8	当前最高故障等级,0-正常 1-1级 轻微故障 2-2级 较严重故障 3-3级 最严重故障,精度_1,偏移量_0,单位_
 		*(SendBuffer + 0x29) = (BMS_FtCode & 0xFF);			   // uint8	故障码,见BMS_ErrCode,精度_1,偏移量_0,单位_
 		*(SendBuffer + 0x29) = (BMS_FtCode & 0xFF);			   // uint8	故障码,见BMS_ErrCode,精度_1,偏移量_0,单位_