Commit 04f42c2f authored by 郑萍's avatar 郑萍

🐞 fix:电量显示将电量处理成格数并向上取整

parent 03b9184e
......@@ -16,7 +16,7 @@ User definitions
***********************************************************************************************************************/
#ifndef __TYPEDEF__
#define HAS_BOOTLOADER (1u) // 仅仿真App时设置为0
#define HAS_BOOTLOADER (0u) // 仅仿真App时设置为0
#define APP_BASE (0x00008000ul)
typedef unsigned short MD_STATUS;
......
......@@ -13,10 +13,10 @@ void Gauge_Power_SOC_pull_Display(void)
// uint8_t MBMS_StatBattWorkState = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattWorkState();
if (Common_Get_IG_Sts() == COMMON_POWER_ON && Charge_OFF_Flag == 0)
{
uint8_t SOC_1_Count = Get_CAN_Num_MBMS_Soc();
uint8_t SOC_2_Count = Get_CAN_Num_SBMS_Soc();
SEG_SET_EleDial_1SOC(1, SOC_1_Count);
SEG_SET_EleDial_2SOC(1, SOC_2_Count);
uint8_t Current_1_Grid = Get_CAN_Num_MBMS_Soc_1_Grid();
uint8_t Current_2_Grid = Get_CAN_Num_SBMS_Soc_2_Grid();
SEG_SET_EleDial_1SOC(1, Current_1_Grid);
SEG_SET_EleDial_2SOC(1, Current_2_Grid);
}
else
{
......@@ -78,6 +78,30 @@ void Gauge_Gears_Display(void)
SEG_SET_GEAR(0, Signal1, 0);
}
}
uint8_t Get_CAN_Num_MBMS_Soc_1_Grid(void)
{
uint8_t num = 0;
uint8_t Current_SOC_1_Num = Get_CAN_Num_MBMS_Soc();
num = (Current_SOC_1_Num / 10);
if((Current_SOC_1_Num % 10) != 0)
{
num++;
}
return num;
}
uint8_t Get_CAN_Num_SBMS_Soc_2_Grid(void)
{
uint8_t num = 0;
uint8_t Current_SOC_2_Num = Get_CAN_Num_SBMS_Soc();
num = (Current_SOC_2_Num / 10);
if((Current_SOC_2_Num % 10) != 0)
{
num++;
}
return num;
}
uint8_t SOC1_Count = 0;
uint8_t SOC2_Count = 0;
void Gauge_Power_SOC_CHAGING_Display(void)
......@@ -88,8 +112,9 @@ void Gauge_Power_SOC_CHAGING_Display(void)
// uint8_t MBMS_StatBattWorkState = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattWorkState();
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
uint8_t SOC_1_Count = Get_CAN_Num_MBMS_Soc();
uint8_t SOC_2_Count = Get_CAN_Num_SBMS_Soc();
uint8_t Current_1_Grid = Get_CAN_Num_MBMS_Soc_1_Grid();
uint8_t Current_2_Grid = Get_CAN_Num_SBMS_Soc_2_Grid();
if ((MBMS_TOTALSigAcc == 0x1 && MBMS_TOTALSigCharge == 0x1) || (MBMS_TOTALSigAcc == 0x0 && MBMS_TOTALSigCharge == 0x1)) // 上电充电
{
if (MBMS_StatBattWorkState == 0x1) // 主电池
......@@ -100,13 +125,13 @@ void Gauge_Power_SOC_CHAGING_Display(void)
SEG_SET_EleDial_1SOC(1, SOC1_Count);
SOC1_Count++;
if (SOC1_Count > SOC_1_Count)
if (SOC1_Count > Current_1_Grid)
{
SOC1_Count = 0;
}
}
SEG_SET_EleDial_2SOC(1, SOC_2_Count);
SEG_SET_EleDial_2SOC(1, Current_2_Grid);
}
else if (MBMS_StatBattWorkState == 0x4) // 副电池
{
......@@ -116,13 +141,13 @@ void Gauge_Power_SOC_CHAGING_Display(void)
SEG_SET_EleDial_2SOC(1, SOC2_Count);
SOC2_Count++;
if (SOC2_Count > SOC_2_Count)
if (SOC2_Count > Current_2_Grid)
{
SOC2_Count = 0;
}
}
SEG_SET_EleDial_1SOC(1, SOC_1_Count);
SEG_SET_EleDial_1SOC(1, Current_1_Grid);
}
else if (MBMS_StatBattWorkState == 0x7) // 主副电池
{
......@@ -134,12 +159,12 @@ void Gauge_Power_SOC_CHAGING_Display(void)
SEG_SET_EleDial_2SOC(1, SOC2_Count);
SOC1_Count++;
SOC2_Count++;
if (SOC_1_Count > SOC_2_Count)
if (Current_1_Grid > Current_2_Grid)
{
if (SOC2_Count > SOC_2_Count)
if (SOC2_Count > Current_2_Grid)
{
SOC2_Count--;
if (SOC1_Count > SOC_1_Count)
if (SOC1_Count > Current_1_Grid)
{
SOC1_Count = 0;
SOC2_Count = 0;
......@@ -148,10 +173,10 @@ void Gauge_Power_SOC_CHAGING_Display(void)
}
else
{
if (SOC1_Count > SOC_1_Count)
if (SOC1_Count > Current_1_Grid)
{
SOC1_Count--;
if (SOC2_Count > SOC_2_Count)
if (SOC2_Count > Current_2_Grid)
{
SOC1_Count = 0;
SOC2_Count = 0;
......@@ -162,8 +187,8 @@ void Gauge_Power_SOC_CHAGING_Display(void)
}
else
{
SEG_SET_EleDial_1SOC(1, SOC_1_Count);
SEG_SET_EleDial_2SOC(1, SOC_2_Count);
SEG_SET_EleDial_1SOC(1, Current_1_Grid);
SEG_SET_EleDial_2SOC(1, Current_2_Grid);
}
}
if (MBMS_TOTALSigAcc == 0x0 && MBMS_TOTALSigCharge == 0x1) // 下电充电
......
......@@ -70,6 +70,7 @@ void BUZZER_Init(void);
uint8_t Get_Clock_All_lenth(void);
uint8_t Get_EleDial_AllSOC_lenth(void);
uint8_t Get_Clockonetime_lenth(void);
uint8_t Get_CAN_Num_SBMS_Soc_2_Grid(void);
uint8_t Get_CAN_Num_MBMS_Soc_1_Grid(void);
#endif
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