Commit 01a1ab4c authored by 王雅楠's avatar 王雅楠

🦄 refactor:优化燃油走格函数

parent f7523b7a
......@@ -24,6 +24,7 @@ void AMT630H_GUI_SETTING(void);
void AMT630H_GUI_Quit(void);
void AMT630H_GUI_Phone_Connect(void);
void AMT630H_GUI_Fault_Information(void);
void AMT630H_GUI_FaultCode(uint8_t FaultCodevalid,uint8_t FaultCode_hight,uint8_t FaultCode_mid);
void AMT630H_GUI_Language_Information(void);
void AMT630H_GUI_Unit_Information(void);
void AMT630H_GUI_Display_Mode_Information(void);
......@@ -82,7 +83,7 @@ void AMT630H_GUI_Fault_Information(void)
SetPagePic(GRAPHICS_PAGE_0, Pic_0168_350_290);
SetPagePic(GRAPHICS_PAGE_0, Pic_0169_353_227);/*历史故障*/
SetPagePic(GRAPHICS_PAGE_0, Pic_0170_354_162);/*当前故障*/
//AMT630H_GUI_FaultCode(Get_FaultCode_Valid(),Get_Current_Hight_FaultCode(),Get_Current_Mid_FaultCode());
AMT630H_GUI_FaultCode(Get_FaultCode_Valid(),Get_Current_Hight_FaultCode(),Get_Current_Mid_FaultCode());
}
else if(g_u8Language == EN)
{
......@@ -99,7 +100,7 @@ void AMT630H_GUI_Fault_Information(void)
SetPagePic(GRAPHICS_PAGE_0, Pic_0096_338_228);/*Fault history*/
SetPagePic(GRAPHICS_PAGE_0, Pic_0097_334_163);/*current fault*/
//AMT630H_GUI_FaultCode(Get_FaultCode_Valid(),Get_Current_Hight_FaultCode(),Get_Current_Mid_FaultCode());
AMT630H_GUI_FaultCode(Get_FaultCode_Valid(),Get_Current_Hight_FaultCode(),Get_Current_Mid_FaultCode());
}
}
else if(g_u8Display_Mode == ModeNIGHT)
......@@ -119,7 +120,7 @@ void AMT630H_GUI_Fault_Information(void)
SetPagePic(GRAPHICS_PAGE_0, Pic_0356_353_227);/*历史故障*/
SetPagePic(GRAPHICS_PAGE_0, Pic_0357_354_162);/*当前故障*/
//AMT630H_GUI_FaultCode(Get_FaultCode_Valid(),Get_Current_Hight_FaultCode(),Get_Current_Mid_FaultCode());
AMT630H_GUI_FaultCode(Get_FaultCode_Valid(),Get_Current_Hight_FaultCode(),Get_Current_Mid_FaultCode());
}
else if(g_u8Language == EN)
{
......@@ -136,7 +137,7 @@ void AMT630H_GUI_Fault_Information(void)
SetPagePic(GRAPHICS_PAGE_0, Pic_0284_338_228);
SetPagePic(GRAPHICS_PAGE_0, Pic_0285_334_163);
//AMT630H_GUI_FaultCode(Get_FaultCode_Valid(),Get_Current_Hight_FaultCode(),Get_Current_Mid_FaultCode());
AMT630H_GUI_FaultCode(Get_FaultCode_Valid(),Get_Current_Hight_FaultCode(),Get_Current_Mid_FaultCode());
}
}
}
......@@ -2709,6 +2710,16 @@ static const uint16_t PICList_Fuel[] = {
Pic_0560_586_473,
Pic_0561_623_473,
};
static const uint16_t PICList_Fuel_RED[] = {
Pic_0562_315_473,
Pic_0555_366_473,
Pic_0556_426_473,
Pic_0557_469_473,
Pic_0558_514_473,
Pic_0559_550_473,
Pic_0560_586_473,
Pic_0561_623_473,
};
static const uint16_t PICList_Fuel_SelfCheck[] ={
Pic_0554_315_473,
Pic_0555_366_473,
......@@ -2871,7 +2882,7 @@ static void AMT630H_GUI_TIME(uint16_t Hour, uint16_t Minute)
// }
/*燃油显示函数*/
uint8_t g_u16_GUI_PerFuelLevel = 1;
uint8_t g_u16_GUI_PerFuelLevel = 0;
static void AMT630H_GUI_Fuel(uint8_t Fuel)
{
/*外部传参燃油处于数组第几格*/
......@@ -2886,6 +2897,7 @@ static void AMT630H_GUI_Fuel(uint8_t Fuel)
SetPagePic(GRAPHICS_PAGE_0, Pic_0553_315_473); /*燃油格*/
SetPagePic(GRAPHICS_PAGE_0, Pic_0549_299_533); /*E*/
SetPagePic(GRAPHICS_PAGE_0, Pic_0550_715_533); /*F*/
/*燃油桶闪烁*/
if (FuelLevel == 0)
{
if (FLASH_SYNC_1Hz)
......@@ -2923,6 +2935,19 @@ static void AMT630H_GUI_Fuel(uint8_t Fuel)
{
SetPagePic(GRAPHICS_PAGE_0, Pic_0552_503_529); /*黄色燃油灯*/
}
s_FuelLowTime = 0;
}
else if(FuelLevel == 1)
{
s_FuelLowTime++;
if (s_FuelLowTime < 15)
{
SetPagePic(GRAPHICS_PAGE_0, Pic_0552_503_529); /*黄色燃油灯*/
}
if (s_FuelLowTime == 20)
{
s_FuelLowTime = 0;
}
}
else
{
......@@ -2931,10 +2956,15 @@ static void AMT630H_GUI_Fuel(uint8_t Fuel)
}
/*燃油格数走格*/
if (FuelLevel > 1)
if (FuelLevel > 0)
{
if (FuelLevel != g_u16_GUI_PerFuelLevel)
{
for (uint8_t i = 0; i <= g_u16_GUI_PerFuelLevel; i++)
{
SetPagePic(GRAPHICS_PAGE_0, PICList_Fuel[i]);
}
if (FuelLevel > g_u16_GUI_PerFuelLevel)
{
g_u16_GUI_PerFuelLevel++;
......@@ -2943,25 +2973,57 @@ static void AMT630H_GUI_Fuel(uint8_t Fuel)
{
g_u16_GUI_PerFuelLevel--;
}
else if (FuelLevel == g_u16_GUI_PerFuelLevel)
else
{
;
}
}
else if (FuelLevel == g_u16_GUI_PerFuelLevel)
{
g_u16_GUI_PerFuelLevel = FuelLevel;
for (uint8_t i = 0; i <= g_u16_GUI_PerFuelLevel; i++)
{
SetPagePic(GRAPHICS_PAGE_0, PICList_Fuel[i]);
}
}
for (uint8_t i = 0; i < g_u16_GUI_PerFuelLevel; i++)
{
SetPagePic(GRAPHICS_PAGE_0, PICList_Fuel[i]);
}
}
else
{
SetPagePic(GRAPHICS_PAGE_0, Pic_0562_315_473);
}
if (FuelLevel != g_u16_GUI_PerFuelLevel)
{
for (uint8_t i = 0; i <= g_u16_GUI_PerFuelLevel; i++)
{
{
SetPagePic(GRAPHICS_PAGE_0, PICList_Fuel_RED[i]);
}
}
if (FuelLevel > g_u16_GUI_PerFuelLevel)
{
g_u16_GUI_PerFuelLevel++;
}
else if ((FuelLevel < g_u16_GUI_PerFuelLevel) && (g_u16_GUI_PerFuelLevel != 0))
{
g_u16_GUI_PerFuelLevel--;
}
else
{
;
}
}
else if (FuelLevel == g_u16_GUI_PerFuelLevel)
{
g_u16_GUI_PerFuelLevel = FuelLevel;
for (uint8_t i = 0; i <= g_u16_GUI_PerFuelLevel; i++)
{
{
SetPagePic(GRAPHICS_PAGE_0, PICList_Fuel_RED[i]);
}
}
}
}
}
......@@ -2999,10 +3061,10 @@ static void AMT630H_GUI_Fuel_SelfCheck(uint8_t Fuel)
{
;
}
for (uint8_t i = 0; i < g_u16_GUI_PerFuelLevel; i++)
{
SetPagePic(GRAPHICS_PAGE_0, PICList_Fuel_SelfCheck[i]);
}
for (uint8_t i = 0; i < g_u16_GUI_PerFuelLevel; i++)
{
SetPagePic(GRAPHICS_PAGE_0, PICList_Fuel_SelfCheck[i]);
}
}
......@@ -3802,7 +3864,7 @@ void AMT630H_GUI_BACKGRAND_SelfCheck()
/*燃油自检*/
if(g_u16fuelnumberup < 1200)
{
g_u16fuelnumberup+=6;
g_u16fuelnumberup += 6;
AMT630H_GUI_Fuel_SelfCheck(g_u16fuelnumberup/150);/*初始化g_u16fuelnumberup = 0*/
}
else
......
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