Commit f8e0c73a authored by 李冠华's avatar 李冠华

🦄 refactor:修改混动车型电量值处理逻辑

parent 8bd707a3
......@@ -45,31 +45,19 @@ void Data_Soc_KL15_Init(void)
static void Data_Soc_Battery_Level_Service(void)
{
#if (PART_NUMBER == RMR42E_60)
if ((Get_CAN_Power_State() >= KEY_ACC) && (Get_CAN_Power_State() <= CHRGEND))
{
#if (PART_NUMBER == RMR42E_60)
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A20_Msg)) == CAN_SIG_NORMAL)
{
Soc.Value1 = Get_CAN_CH0_ID_18200A20_Sig_MBMS_Soc();
Soc.Valid1 = 1U;
}
else
{
Soc.Value1 = 0U;
Soc.Valid1 = 0U;
}
#else
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x17A_Msg)) == CAN_SIG_NORMAL)
{
Soc.Value1 = Get_CAN_CH0_ID_17A_Sig_MBMS_StatSoc();
Soc.Valid1 = 1U;
}
else
{
Soc.Value1 = 0U;
Soc.Valid1 = 0U;
}
#endif
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A20_Msg)) == CAN_SIG_NORMAL)
{
Soc.Value1 = Get_CAN_CH0_ID_18200A20_Sig_MBMS_Soc();
Soc.Valid1 = 1U;
}
else
{
Soc.Value1 = 0U;
Soc.Valid1 = 0U;
}
if (Soc.Valid1 != 0U)
{
......@@ -88,35 +76,33 @@ static void Data_Soc_Battery_Level_Service(void)
Soc.Act_Seg1 = 0U;
}
#if (PART_NUMBER == RMR42E_60)
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A21_Msg)) == CAN_SIG_NORMAL)
{
Soc.Value2 = Get_CAN_CH0_ID_18200A21_Sig_SBMS_Soc();
Soc.Valid2 = 1U;
}
else
{
Soc.Value2 = 0U;
Soc.Valid2 = 0U;
}
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A21_Msg)) == CAN_SIG_NORMAL)
{
Soc.Value2 = Get_CAN_CH0_ID_18200A21_Sig_SBMS_Soc();
Soc.Valid2 = 1U;
}
else
{
Soc.Value2 = 0U;
Soc.Valid2 = 0U;
}
if (Soc.Valid2 != 0U)
if (Soc.Valid2 != 0U)
{
Soc.Act_Seg2 = (Soc.Value2 / 10);
if ((Soc.Value2 % 10) != 0)
{
Soc.Act_Seg2 = (Soc.Value2 / 10);
if ((Soc.Value2 % 10) != 0)
{
Soc.Act_Seg2++;
}
if (Soc.Act_Seg2 > 10)
{
Soc.Act_Seg2 = 10;
}
Soc.Act_Seg2++;
}
else
if (Soc.Act_Seg2 > 10)
{
Soc.Act_Seg2 = 0U;
Soc.Act_Seg2 = 10;
}
#endif
}
else
{
Soc.Act_Seg2 = 0U;
}
}
else
{
......@@ -127,6 +113,45 @@ static void Data_Soc_Battery_Level_Service(void)
Soc.Act_Seg1 = 0U;
Soc.Act_Seg2 = 0U;
}
#else
if (Get_CAN_Power_State() > KEY_OFF)
{
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x17A_Msg)) == CAN_SIG_NORMAL)
{
Soc.Value1 = Get_CAN_CH0_ID_17A_Sig_MBMS_StatSoc();
Soc.Valid1 = 1U;
}
else
{
Soc.Value1 = 0U;
Soc.Valid1 = 0U;
}
if (Soc.Valid1 != 0U)
{
Soc.Act_Seg1 = (Soc.Value1 / 10U);
if ((Soc.Value1 % 10) != 0)
{
Soc.Act_Seg1++;
}
if (Soc.Act_Seg1 > 10)
{
Soc.Act_Seg1 = 10;
}
}
else
{
Soc.Act_Seg1 = 0U;
}
}
else
{
Soc.Value1 = 0U;
Soc.Valid1 = 0U;
}
#endif
}
static void Data_Soc_DisplayEffect_Service(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment