Commit 912b1f90 authored by 时昊's avatar 时昊

feat:修改功率表计算方式

parent 3f0ad845
......@@ -270,9 +270,9 @@ void Gauge_Power_Display(void)
SEG_SET_PowerDial(1u, 0u, 0u, 255u);
}
}
else//-
else//PTModeInd = 1
{
if (Batt_Curr < 0xFB00)
if (Batt_Curr < 0xFB00)//0.05 -1600
{
BattCurr.Valid = 1;
Batt_Curr = (Batt_Curr * 5);
......@@ -286,7 +286,12 @@ void Gauge_Power_Display(void)
Batt_Curr = 160000 - Batt_Curr;
BattCurr.Symbol = 1;
}
BattCurr.Value = Batt_Curr/100;
BattCurr.Value = Batt_Curr; //100倍
BattCurr.Value *= 100;//乘100%
BattCurr.Value /= 200;//除200
BattCurr.Value += 90;//大于等于10进1 0.1*100=10
BattCurr.Value /= 100;//1倍,留整数
}
else
{
......@@ -300,27 +305,19 @@ void Gauge_Power_Display(void)
//0格和0%
SEG_SET_PowerDial(1u, 0u, 0u, 0u);
}
else
else//PTModeInd = 1,且有效时
{
//-1格和-50%
SEG_SET_PowerDial(1u, 0x81u, 1u, 50u);
if(BattCurr.Symbol == 1)
if(BattCurr.Symbol == 1)//-
{
if(BattCurr.Value > 100)
if(BattCurr.Value > 50)//负数情况下,数值越大,实际越小
{
//-1 -2格和-100%
SEG_SET_PowerDial(1u, 0x82u, 1u, 100u);
}
}
else
{
if(BattCurr.Value > 0)
{
//0格和0%
SEG_SET_PowerDial(1u, 0u, 0u, 0u);
}
}
}
}
}
......@@ -428,7 +425,14 @@ void Gauge_Clock_Display(void)
//ʱ����ʾ
if(Factory_ClearOdo_Display_Flag == 0)
{
SEG_SET_Clock(RTCTimeCurrent.Hour, RTCTimeCurrent.Minute, FLASH_SYNC_1Hz, 1, 1);
if(CAN_MSG_Status(ID_can0x18FEE69F_Msg_Count) != 0u)
{
SEG_SET_Clock(0, 0, 0, 0, 0);
}
else
{
SEG_SET_Clock(RTCTimeCurrent.Hour, RTCTimeCurrent.Minute, FLASH_SYNC_1Hz, 1, 1);
}
}
}
......
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