Ver código fonte

V0.2.1.11 修复放电安时计算bug

LAPTOP-KB7QFH2U\ChenJie-PC 1 ano atrás
pai
commit
dc2b84fa63
3 arquivos alterados com 6 adições e 11 exclusões
  1. 2 2
      code/app/AppGlobalVar.c
  2. 3 4
      code/app/AppTaskCan.c
  3. 1 5
      code/app/AppTaskUart1.c

+ 2 - 2
code/app/AppGlobalVar.c

@@ -39,7 +39,7 @@ AppConfigBody AppConfigInfo = {false, true, {defaultSn}, {0}};
 #endif
 
 //*全局变量*//
-const uint32 AppSwVersion = 0x0002010A;
+const uint32 AppSwVersion = 0x0002010B;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint16 HwVersion = 0x0102;
 const uint32 BlSwVersion = 0x00000002;
@@ -186,7 +186,7 @@ UINT8 BMS_CharSysNum = 0x00;					// 可充电储能子系统总数(保留),,Re-1
 UINT8 BMS_FtCode = 0x00;						// 电池系统故障码,详见附表电池系统故障码列表,Re-1,Off-0,
 UINT8 BMS_ST1CheckSum = 0x00;					// B2V_ST1的CheckSum,Byte0=Byte1 XOR Byte2 XOR Byte3 XOR Byte4 XOR Byte5 XOR Byte6 XOR Byte7,Re-1,Off-0,
 UINT8 BMS_ST1Counter = 0x00;					// B2V_ST1的生命信号,0~14循环,15:信号无效,Re-1,Off-0,
-UINT8 BMS_Mode = 0x00;							// BMS当前状态,和新版协议不匹配
+UINT8 BMS_Mode = 0x00;							// BMS当前状态,0-未上高压,2-上高压
 UINT8 BMS_AuxRlySt = 0x00;						// 附件继电器状态,0:开启;1:闭合;,Re-1,Off-0,
 UINT8 BMS_BattBalaSt = 0x00;					// BMS当前均衡状态,0:未开启均衡;1:开启均衡;,Re-1,Off-0,
 UINT8 BMS_CharGunSt = 0x00;						// 直流充电枪连接状态,0:未连接1 : 连接, Re - 1, Off - 0,

+ 3 - 4
code/app/AppTaskCan.c

@@ -75,14 +75,13 @@ static void CalAccAhFunc(void)//100ms运行一次
 {
 	static float tmp_DischrgAh = 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)//海南协议为 0-高压下电,2-高压上电
+	if(BcuRxLongError[3]==0)
 	{
-		if(BMS_CharSt==1)//1是正在充电
+		if(BMS_CharSt==1)//充电计算
 		{
 			tmp_ChrgAh = tmp_ChrgAh + (float)(abs(BMS_PackCurr - 10000)/360);
 		}
-		else//放电计算
+		else if(BMS_Mode==2)//放电计算
 		{
 			tmp_DischrgAh = tmp_DischrgAh + (float)(abs(BMS_PackCurr - 10000)/360);
 		}

+ 1 - 5
code/app/AppTaskUart1.c

@@ -1048,13 +1048,9 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 		{
 			bmsHVOn = 1;
 		}
-		else if (BMS_Mode == 0)
-		{
-			bmsHVOn = 0;
-		}
 		else
 		{
-			bmsHVOn = 0xFF;
+			bmsHVOn = 2;
 		}
 		*(SendBuffer + 0x37) = (bmsHVOn & 0xFF);			 // uint8	bms上高压指令
 		*(SendBuffer + 0x38) = (currentGearPosition & 0xFF); // uint8	当前档位