#include "Components.h"
/*static const uint16_t NumbeList_VSpeed[]={
    Pic_0058_348_206,
    Pic_0059_390_206,
    Pic_0060_348_206,
    Pic_0061_348_206,
    Pic_0062_348_206,
    Pic_0063_348_206,
    Pic_0064_348_206,
    Pic_0065_348_206,
    Pic_0066_348_206,
    Pic_0067_348_206,
    Pic_0068_375_225
};*/
static const uint16_t NumbeList_TRIP[]={
    Pic_0070_685_68,
    Pic_0073_687_68,
    Pic_0074_686_68,
    Pic_0075_685_68,
    Pic_0076_685_68,
    Pic_0077_685_68,
    Pic_0078_685_68,
    Pic_0079_686_68,
    Pic_0080_685_68,
    Pic_0081_685_68,
    Pic_0071_725_81,
    Pic_0082_685_77
};
static const uint16_t NumbeList_Battery1[] = {
   Pic_0015_192_390,
   Pic_0016_193_390,
   Pic_0026_192_390,
   Pic_0027_192_390,
   Pic_0028_191_390,
   Pic_0029_192_390,
   Pic_0030_192_390,
   Pic_0031_192_390,
   Pic_0032_192_390,
   Pic_0033_192_390,
   Pic_0034_192_397
};
static const uint16_t NumbeList_Battery2[] = {
    Pic_0015_744_390,
    Pic_0016_745_390,
    Pic_0026_744_390,
    Pic_0027_744_390,
    Pic_0028_743_390,
    Pic_0029_744_390,
    Pic_0030_744_390,
    Pic_0031_744_390,
    Pic_0032_744_390,
    Pic_0033_744_390,
    Pic_0034_744_397
};
static void Gui_Lamp_Disp(void)
{
    //左转向
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0011_22_440);
    }
    //右转向
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0002_751_440);
    }
    //巡航
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0003_681_441);
    }
    //电喷故障
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0004_603_443);
    }
    //示廓指示灯
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0005_521_444);
    }
    //READY
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0006_360_447);
    }
    //远光灯
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0007_293_445);
    }
    //充电状态指示灯
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0008_233_443);
    }
    //胎压
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0009_170_444);
    }
    //ABS
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0010_90_443);
    }
    //来车警示
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0056_0_47);
    }
    //顶部图标2
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0091_658_9);
    }
    //顶部图标3
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0092_540_10);
    }
    //顶部图标4
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0093_489_10);
    }
    //顶部图标5
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0094_443_8);
    }
    //顶部图标6
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0095_383_14);
    }
     //顶部图标7
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0096_339_10);
    }
     //顶部图标8
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0097_292_9);
    }
    //顶部图标9
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0098_245_10);
    }
    //顶部图标10
    if(1)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0099_195_11);
    }
}
/*uint16_t VSpeed=001;
static void AMT630H_GUI_VSpeed(uint16_t VSpeed)
{
    uint16_t VSpeedNumber;
    VSpeedNumber=VSpeed;
   if((VSpeed>=0)&&(VSpeed<10))
   {
    SetPagePic(GRAPHICS_PAGE_0,NumbeList_VSpeed[VSpeed]);//改为数组VSpeed_Single 
   }
   else if((VSpeed>=10)&&(VSpeed<100))
   {
    SetPagePicFree(GRAPHICS_PAGE_0, uint16_t PicIndex, int16_t PosX, int16_t PosY);
   }
   else if((VSpeed>=100)&&(VSpeed<200))
   {
    SetPagePicFree(GRAPHICS_PAGE_0, uint16_t PicIndex, int16_t PosX, int16_t PosY);
   }
}*/
uint16_t TRIP=0.1;//测试
static void AMT630H_GUI_TRIP(uint16_t TRIP)
{
    DISPLAY_NUM_ST DisplayNumPara;
    uint16_t TRIPNumber;
    SetPagePic(GRAPHICS_PAGE_0,Pic_0069_750_68);//TRIP图标
    SetPagePic(GRAPHICS_PAGE_0,Pic_0072_630_68);//km图标
    TRIPNumber =TRIP;
    if (TRIP>=1000)
    {
        TRIPNumber =0;
    }//无效情况
    if ((TRIP>=100)&&(TRIP<1000))
    {
        DisplayNumPara.NumList = NumbeList_TRIP;
        DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT |13;//【数字之间间距与数字小数点间间距不同】
        DisplayNumPara.x = 685;//
        DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS;
        DisplayNumPara.DecimalNum = 1;
        DisplayNumPara.MinDigits = 4;
        DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, TRIPNumber);
    }
    else if((TRIP>=10)&&(TRIP<100))
    {
        DisplayNumPara.NumList = NumbeList_TRIP;
        DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT |13;
        DisplayNumPara.x = 698;//
        DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS;
        DisplayNumPara.DecimalNum = 1;
        DisplayNumPara.MinDigits = 3;
        DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, TRIPNumber);
    }
    else if ((TRIP>=0)&&(TRIP<10))
    {
        DisplayNumPara.NumList = NumbeList_TRIP;
        DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT |13;
        DisplayNumPara.x = 711;//
        DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS; 
        DisplayNumPara.DecimalNum = 1;
        DisplayNumPara.MinDigits = 2;
        DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, TRIPNumber);
    }
}
uint16_t Data_Battery1=5;//测试使用
static void AMT630H_GUI_Battery1(uint16_t Data_Battery1)
{
    DISPLAY_NUM_ST DisplayNumPara;
    uint16_t BatteryNumber;
    if (Data_Battery1==100)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0014_220_390);
        SetPagePic(GRAPHICS_PAGE_0,Pic_0015_210_390);
        SetPagePic(GRAPHICS_PAGE_0,Pic_0015_200_390);
        SetPagePic(GRAPHICS_PAGE_0,Pic_0016_193_390);
    }
    else if((Data_Battery1>=10)&&(Data_Battery1<100))
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0014_213_390);
        BatteryNumber = Data_Battery1;
        DisplayNumPara.NumList = NumbeList_Battery1;
        DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT |10;
        DisplayNumPara.x = 203;
        DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS;
        DisplayNumPara.DecimalNum = 0;
        DisplayNumPara.MinDigits = 2;
        DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, BatteryNumber);
    }
    else if ((Data_Battery1>=0)&&(Data_Battery1<10))
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0014_203_390);
        BatteryNumber = Data_Battery1;
        DisplayNumPara.NumList = NumbeList_Battery1;
        DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT |10;
        DisplayNumPara.x = 193;
        DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS; 
        DisplayNumPara.DecimalNum = 0;
        DisplayNumPara.MinDigits = 1;
        DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, BatteryNumber);
    }
}
uint16_t Data_Battery2=6;//测试使用
static void AMT630H_GUI_Battery2(uint16_t Data_Battery2)
{
    DISPLAY_NUM_ST DisplayNumPara;
    uint16_t BatteryNumber;
    if (Data_Battery2==100)
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0014_772_390);
        SetPagePic(GRAPHICS_PAGE_0,Pic_0015_762_390);
        SetPagePic(GRAPHICS_PAGE_0,Pic_0015_752_390);
        SetPagePic(GRAPHICS_PAGE_0,Pic_0016_745_390);
    }
    else if((Data_Battery2>=10)&&(Data_Battery2<100))
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0014_765_390);
        BatteryNumber = Data_Battery2;
        DisplayNumPara.NumList = NumbeList_Battery2;
        DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT |10;
        DisplayNumPara.x = 755;//有问题
        DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS; // 196;
        DisplayNumPara.DecimalNum = 0;
        DisplayNumPara.MinDigits = 2;
        DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, BatteryNumber);
    }
    else if ((Data_Battery2>=0)&&(Data_Battery2<10))
    {
        SetPagePic(GRAPHICS_PAGE_0,Pic_0014_755_390);
        BatteryNumber = Data_Battery2;
        DisplayNumPara.NumList = NumbeList_Battery2;
        DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT |10;
        DisplayNumPara.x = 745;
        DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS; 
        DisplayNumPara.DecimalNum = 0;
        DisplayNumPara.MinDigits = 1;
        DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, BatteryNumber);
    }
}
void AMT630H_GUI_Background()
{
if (SYS_OPR_STAT_IGN_ON)
    {
        SetPagePic(GRAPHICS_PAGE_0, Pic_0001_0_0);//Pic_0001_0_0白色主题背景
        SetPagePic(GRAPHICS_PAGE_0, Pic_0013_0_57);//中间显示道路装饰线
        SetPagePic(GRAPHICS_PAGE_0, Pic_0012_0_95);//中间显示光晕
       
        SetPagePic(GRAPHICS_PAGE_0, Pic_0047_264_95);//右侧表盘
        SetPagePic(GRAPHICS_PAGE_0, Pic_0048_610_229);//右侧指针
        SetPagePic(GRAPHICS_PAGE_0, Pic_0052_44_95);//左侧表盘
        SetPagePic(GRAPHICS_PAGE_0, Pic_0053_49_229);//左侧指针

        SetPagePic(GRAPHICS_PAGE_0, Pic_0037_309_380);//功率线条
        SetPagePic(GRAPHICS_PAGE_0, Pic_0045_249_412);//power
        SetPagePic(GRAPHICS_PAGE_0, Pic_0044_454_405);//功率8km
        SetPagePic(GRAPHICS_PAGE_0, Pic_0043_313_405);//功率-3km
        Gui_Lamp_Disp();
        //AMT630H_GUI_VSpeed(VSpeed);
        AMT630H_GUI_TRIP(TRIP);
        AMT630H_GUI_Battery1(Data_Battery1);
        AMT630H_GUI_Battery2(Data_Battery2);
    }
    else
    {
         SetPagePic(GRAPHICS_PAGE_0, Pic_0001_0_0);
         SetPagePic(GRAPHICS_PAGE_0, Pic_0013_0_57);
         SetPagePic(GRAPHICS_PAGE_0, Pic_0012_0_95);
         SetPagePic(GRAPHICS_PAGE_0, Pic_0047_264_95);
         SetPagePic(GRAPHICS_PAGE_0, Pic_0048_610_229);
         SetPagePic(GRAPHICS_PAGE_0, Pic_0052_44_95);
         SetPagePic(GRAPHICS_PAGE_0, Pic_0053_49_229);
         SetPagePic(GRAPHICS_PAGE_0, Pic_0057_376_336);
         Gui_Lamp_Disp();
         //AMT630H_GUI_VSpeed(VSpeed);
         AMT630H_GUI_TRIP(TRIP);
         AMT630H_GUI_Battery1(Data_Battery1);
         AMT630H_GUI_Battery2(Data_Battery2);//传参
    }
}

void AMT630H_GUI_DisplayProc(void)
{
    SetPageGuid(GRAPHICS_PAGE_0, 1, 1, 1);
    AMT630H_GUI_Background();
    PackedTransfer_Page();
}