|
@@ -418,7 +418,7 @@ static BOOL uartBattInfoDecode(UINT8* dataPtr)
|
|
|
battI = Batt_current*AppDataInfo.BattCurrentNegFlag + 0x2710;
|
|
|
//bit0 ~ bit31 represent cell0 ~ cell31
|
|
|
battBalanceoInfo = dataPtr[(0x06+BATT_CELL_VOL_NUM+TEMP_NUM)*2+1] | (dataPtr[(0x06+BATT_CELL_VOL_NUM+TEMP_NUM)*2] <<8) + (dataPtr[(0x07+BATT_CELL_VOL_NUM+TEMP_NUM)*2+1]<<16) | (dataPtr[(0x07+BATT_CELL_VOL_NUM+TEMP_NUM)*2] <<24);
|
|
|
- // chargerConnectState = (dataPtr[(0x03+BATT_CELL_VOL_NUM)*2+1])&0x04;//充电器连接状态,0表示未连接,1表示已连接
|
|
|
+ chargerConnectState = (dataPtr[(0x03+BATT_CELL_VOL_NUM)*2+1]>>2)&0x01;//充电器连接状态,0表示未连接,1表示已连接
|
|
|
bmsHwVersion = dataPtr[(0x08+BATT_CELL_VOL_NUM+TEMP_NUM)*2+1];
|
|
|
bmsSwVersion = dataPtr[(0x08+BATT_CELL_VOL_NUM+TEMP_NUM)*2];
|
|
|
|
|
@@ -736,16 +736,17 @@ UINT8 Uart_DataRecv_func(Uart_Read_Msg_Type Uart_Read_Msg_Fun,UINT8* Uart_Recv_B
|
|
|
*/
|
|
|
BOOL BattHeaterSwitch(UINT8* heaterSwitch)
|
|
|
{
|
|
|
- BOOL isNeedtoSwitch = FALSE;
|
|
|
-
|
|
|
- UINT8 i =0;
|
|
|
- UINT8 currentSwitchState = 0;
|
|
|
- //get the current switch state and the cell temp
|
|
|
- currentSwitchState = battHeatEnableState&0x01;
|
|
|
+ BOOL isNeedtoSwitch = FALSE;
|
|
|
+
|
|
|
+ UINT8 i =0;
|
|
|
+ UINT8 currentSwitchState = 0;
|
|
|
+
|
|
|
+ //get the current switch state and the cell temp
|
|
|
+ currentSwitchState = battMOSSwitchState & 0x01;
|
|
|
|
|
|
if(currentSwitchState==0) //当前状态为关闭,判断是否应该开启
|
|
|
{
|
|
|
- if(minCellTemp<5+40 && minCellTemp>=-29+40 && maxCellTemp<25+40)//温度偏移为40
|
|
|
+ if((chargerConnectState == 1 && minCellTemp<5+40 && minCellTemp>=-29+40 && maxCellTemp<25+40)||(chargerConnectState==0 && minCellTemp<5+40 && minCellTemp>=-29+40 && battSOC>=10 && (((battProtectState>> 21)&0x01) == 0)))//温度偏移为40
|
|
|
{
|
|
|
*heaterSwitch = 1;
|
|
|
isNeedtoSwitch = true;
|
|
@@ -753,13 +754,13 @@ BOOL BattHeaterSwitch(UINT8* heaterSwitch)
|
|
|
}
|
|
|
else //当前状态为开启,判断是否应该关闭
|
|
|
{
|
|
|
- if(minCellTemp>=10+40 || maxCellTemp>=30+40)
|
|
|
+ if((minCellTemp>=10+40 || maxCellTemp>=30+40)||(chargerConnectState == 0 && minCellTemp<5+40 && minCellTemp>=-29+40 && battSOC<5))
|
|
|
{
|
|
|
*heaterSwitch = 0;
|
|
|
- isNeedtoSwitch = true;
|
|
|
+ isNeedtoSwitch= true;
|
|
|
}
|
|
|
}
|
|
|
- return isNeedtoSwitch;
|
|
|
+ return isNeedtoSwitch;
|
|
|
}
|
|
|
|
|
|
void battSOCDisplay()
|