|
@@ -719,11 +719,15 @@ uint8_t Select_One_BAT(void)
|
|
|
{
|
|
{
|
|
|
uint8_t temp_op = CB_BAT_NO;
|
|
uint8_t temp_op = CB_BAT_NO;
|
|
|
|
|
|
|
|
- if(Is_Sub_BMS_1_Normal())
|
|
|
|
|
|
|
+ if(Is_Sub_BMS_1_Normal() == SHARK_BMS_EXIT_SUCCESS)
|
|
|
{
|
|
{
|
|
|
- if(Is_Sub_BMS_2_Normal())
|
|
|
|
|
|
|
+ if(Is_Sub_BMS_2_Normal() == SHARK_BMS_EXIT_SUCCESS)
|
|
|
{
|
|
{
|
|
|
- if(sub_bms_info_1.packet_common.m_total_vol >= sub_bms_info_2.packet_common.m_total_vol)
|
|
|
|
|
|
|
+ if (sub_bms_info_1.open_times > sub_bms_info_2.open_times) {
|
|
|
|
|
+ temp_op = CB_BAT1;
|
|
|
|
|
+ } else if (sub_bms_info_1.open_times < sub_bms_info_2.open_times) {
|
|
|
|
|
+ temp_op = CB_BAT2;
|
|
|
|
|
+ } if(sub_bms_info_1.packet_common.m_total_vol >= sub_bms_info_2.packet_common.m_total_vol)
|
|
|
{
|
|
{
|
|
|
if(IS_CHARGE_IN())
|
|
if(IS_CHARGE_IN())
|
|
|
{
|
|
{
|
|
@@ -751,7 +755,7 @@ uint8_t Select_One_BAT(void)
|
|
|
temp_op = CB_BAT1;
|
|
temp_op = CB_BAT1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- else if(Is_Sub_BMS_2_Normal())
|
|
|
|
|
|
|
+ else if(Is_Sub_BMS_2_Normal() == SHARK_BMS_EXIT_SUCCESS)
|
|
|
{
|
|
{
|
|
|
temp_op = CB_BAT2;
|
|
temp_op = CB_BAT2;
|
|
|
}
|
|
}
|
|
@@ -765,7 +769,7 @@ uint8_t Check_CB_BAT_1(void)
|
|
|
{
|
|
{
|
|
|
uint8_t temp_op = CB_MAX;
|
|
uint8_t temp_op = CB_MAX;
|
|
|
|
|
|
|
|
- if(Is_Sub_BMS_1_Normal())
|
|
|
|
|
|
|
+ if(Is_Sub_BMS_1_Normal() == SHARK_BMS_EXIT_SUCCESS)
|
|
|
{
|
|
{
|
|
|
if((sub_bms_info_1.packet_common.bms_status & (BMS_STA_D_OPEN | BMS_STA_C_OPEN)) != (BMS_STA_D_OPEN | BMS_STA_C_OPEN))
|
|
if((sub_bms_info_1.packet_common.bms_status & (BMS_STA_D_OPEN | BMS_STA_C_OPEN)) != (BMS_STA_D_OPEN | BMS_STA_C_OPEN))
|
|
|
{
|
|
{
|
|
@@ -801,7 +805,7 @@ uint8_t Check_CB_BAT_2(void)
|
|
|
{
|
|
{
|
|
|
uint8_t temp_op = CB_MAX;
|
|
uint8_t temp_op = CB_MAX;
|
|
|
|
|
|
|
|
- if(Is_Sub_BMS_2_Normal())
|
|
|
|
|
|
|
+ if(Is_Sub_BMS_2_Normal() == SHARK_BMS_EXIT_SUCCESS)
|
|
|
{
|
|
{
|
|
|
if((sub_bms_info_2.packet_common.bms_status & (BMS_STA_D_OPEN | BMS_STA_C_OPEN)) != (BMS_STA_D_OPEN | BMS_STA_C_OPEN))
|
|
if((sub_bms_info_2.packet_common.bms_status & (BMS_STA_D_OPEN | BMS_STA_C_OPEN)) != (BMS_STA_D_OPEN | BMS_STA_C_OPEN))
|
|
|
{
|
|
{
|
|
@@ -854,7 +858,7 @@ uint8_t Check_CB_BAT1_BAT2_PARRALLEL(void)
|
|
|
return temp_op;
|
|
return temp_op;
|
|
|
}
|
|
}
|
|
|
//
|
|
//
|
|
|
- if(Is_Sub_BMS_1_Normal()&&Is_Sub_BMS_2_Normal())
|
|
|
|
|
|
|
+ if(Is_Sub_BMS_1_Normal() == SHARK_BMS_EXIT_SUCCESS && Is_Sub_BMS_2_Normal() == SHARK_BMS_EXIT_SUCCESS)
|
|
|
{
|
|
{
|
|
|
if((sub_bms_info_1.packet_common.bms_status & (BMS_STA_D_OPEN | BMS_STA_C_OPEN)) != (BMS_STA_D_OPEN | BMS_STA_C_OPEN))
|
|
if((sub_bms_info_1.packet_common.bms_status & (BMS_STA_D_OPEN | BMS_STA_C_OPEN)) != (BMS_STA_D_OPEN | BMS_STA_C_OPEN))
|
|
|
{
|
|
{
|
|
@@ -1005,7 +1009,7 @@ uint8_t Check_CB_BAT1_BAT2_SERIES(void)
|
|
|
return temp_op;
|
|
return temp_op;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(Is_Sub_BMS_1_Normal()&&Is_Sub_BMS_2_Normal())
|
|
|
|
|
|
|
+ if(Is_Sub_BMS_1_Normal() == SHARK_BMS_EXIT_SUCCESS && Is_Sub_BMS_2_Normal() == SHARK_BMS_EXIT_SUCCESS)
|
|
|
{
|
|
{
|
|
|
if((sub_bms_info_1.packet_common.bms_status & (BMS_STA_D_OPEN | BMS_STA_C_OPEN)) != (BMS_STA_D_OPEN | BMS_STA_C_OPEN))
|
|
if((sub_bms_info_1.packet_common.bms_status & (BMS_STA_D_OPEN | BMS_STA_C_OPEN)) != (BMS_STA_D_OPEN | BMS_STA_C_OPEN))
|
|
|
{
|
|
{
|
|
@@ -1327,11 +1331,11 @@ void Check_Charge_In(void)
|
|
|
|
|
|
|
|
uint8_t Change_Mode_Sub_BMS_1_Normal(void)
|
|
uint8_t Change_Mode_Sub_BMS_1_Normal(void)
|
|
|
{
|
|
{
|
|
|
- return Is_Sub_BMS_1_Normal();
|
|
|
|
|
|
|
+ return Is_Sub_BMS_1_Normal() == SHARK_BMS_EXIT_SUCCESS;
|
|
|
}
|
|
}
|
|
|
uint8_t Change_Mode_Sub_BMS_2_Normal(void)
|
|
uint8_t Change_Mode_Sub_BMS_2_Normal(void)
|
|
|
{
|
|
{
|
|
|
- return Is_Sub_BMS_2_Normal();
|
|
|
|
|
|
|
+ return Is_Sub_BMS_2_Normal() == SHARK_BMS_EXIT_SUCCESS;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
uint8_t Change_Mode_Sub_BMS_PARRALLEL(void)
|
|
uint8_t Change_Mode_Sub_BMS_PARRALLEL(void)
|
|
@@ -1346,7 +1350,7 @@ uint8_t Change_Mode_Sub_BMS_PARRALLEL(void)
|
|
|
if(is_intelligent && CB_OPERATE_PRECEDENCE_PARRALLEL != PRE_PARRALLEL)
|
|
if(is_intelligent && CB_OPERATE_PRECEDENCE_PARRALLEL != PRE_PARRALLEL)
|
|
|
return 0;
|
|
return 0;
|
|
|
//
|
|
//
|
|
|
- if(Is_Sub_BMS_1_Normal()&&Is_Sub_BMS_2_Normal())
|
|
|
|
|
|
|
+ if(Is_Sub_BMS_1_Normal() == SHARK_BMS_EXIT_SUCCESS && Is_Sub_BMS_2_Normal() == SHARK_BMS_EXIT_SUCCESS)
|
|
|
;
|
|
;
|
|
|
else
|
|
else
|
|
|
return 0;
|
|
return 0;
|
|
@@ -1390,7 +1394,7 @@ uint8_t Change_Mode_Sub_BMS_SERIES(void)
|
|
|
if(IS_CHARGE_IN())
|
|
if(IS_CHARGE_IN())
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
- if(!(Is_Sub_BMS_1_Normal()&&Is_Sub_BMS_2_Normal()))
|
|
|
|
|
|
|
+ if(!(Is_Sub_BMS_1_Normal() == SHARK_BMS_EXIT_SUCCESS && Is_Sub_BMS_2_Normal() == SHARK_BMS_EXIT_SUCCESS))
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
/*if(cb_operate_state == CB_BAT1)
|
|
/*if(cb_operate_state == CB_BAT1)
|