#define  GLOBALS_APP_CAN
#include "../app_Headers/g_includes.h"


//1000  //2000  //3000  //4000 //5000   //6000  //7000 //7600 //8000
INT16U    EngSpd[10] ={0X0000,0x1F40, 0x3E80, 0x5DC0, 0x7D00, 0x9D40, 0xBB80, 0xDAC0,0XFA00 };
INT16U    EngSpeed[11] = {0x0163, 0x02C7, 0x042A, 0x058E, 0x06F1, 0x0855, 0x09B8,0X0B1C,0X0C7E,0X0DE2,0X0F45 };
   INT8U diwidi= 0;
/*-------------------------------------------------------------------------
* Function Name  : app_Can_handle
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void app_Can_handle(void)
{
    app_Can_handle_PA5();
    
  //  G_Button.LED_STEP = 1;
    
    //================================================
    //
    if(api_TimerOver1((_Clock*)&g_Clock)) //50ms
    {
        api_SetTimer1(TT_50ms,(_Clock*)&g_Clock); 
       
        TxDelayTime = 10;
        
        if(G_Button.LED_STEP == 1)
        {
          WheelSpeedN = WheelSpeedN + glztest;//20kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
          
        }
          CS_OUT_N =CS_FRset[G_Button.LED_STEP]; 
          ZS_OUT_N=ZS_FRset[G_Button.LED_STEP];	
        
        if(G_Button.LED_STEP == 2)
        {
          WheelSpeedN = WheelSpeedN + 32;//40kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        }
        
        if(G_Button.LED_STEP == 3)
        {
          WheelSpeedN = WheelSpeedN + 48;//60kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        }                
        if(G_Button.LED_STEP == 4)
        {
          WheelSpeedN = WheelSpeedN + 64;//80kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        }
        if(G_Button.LED_STEP == 5)
        {
          WheelSpeedN = WheelSpeedN + 80;//100kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        }        
        if(G_Button.LED_STEP == 6)
        {
          WheelSpeedN = WheelSpeedN + 96;//120kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        }        
        if(G_Button.LED_STEP == 7)
        {
          WheelSpeedN = WheelSpeedN + 112;//140kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        }
        if(G_Button.LED_STEP == 8)
        {
          WheelSpeedN = WheelSpeedN + 128;//160kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        }        
        if(G_Button.LED_STEP == 9)
        {
          WheelSpeedN = WheelSpeedN + 480;//180kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        } 
         if(G_Button.LED_STEP == 10)
        {
          WheelSpeedN = WheelSpeedN + 480;//180kmh
          if(WheelSpeedN >= 64255)
          {
              WheelSpeedN = WheelSpeedN - 64255;
          }
          g_Msg08FFF00B.data[4].bbyte = WheelSpeedN % 256;
          g_Msg08FFF00B.data[5].bbyte = WheelSpeedN / 256;
        }                                     
                
     //   g_bReturn = bsp_CANSendExtFrame(g_Msg08FFF00B.id,g_Msg08FFF00B.prio,g_Msg08FFF00B.dlc,g_Msg08FFF00B.data); 
    } 
    
    
    //if(TxDelayTime==0)
    {
     
      if(api_TimerOver0((_Clock*)&g_Clock))
      {
          api_SetTimer0(23,(_Clock*)&g_Clock); //1s
          
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18FE4F17.id,g_Msg18FE4F17.prio,g_Msg18FE4F17.dlc,g_Msg18FE4F17.data); //100
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18FF0113.id,g_Msg18FF0113.prio,g_Msg18FF0113.dlc,g_Msg18FF0113.data); //100 
        //   g_bReturn = bsp_CANSendFrame(g_Msg240.id,g_Msg240.prio,g_Msg240.dlc,g_Msg240.data);//1000
        //   g_bReturn = bsp_CANSendFrame(g_Msg240.id,g_Msg240.prio,g_Msg240.dlc,g_Msg240.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg402.id,g_Msg402.prio,g_Msg402.dlc,g_Msg402.data);  
        //   g_bReturn = bsp_CANSendFrame(g_Msg12B.id,g_Msg12B.prio,g_Msg12B.dlc,g_Msg12B.data);       
        //   g_bReturn = bsp_CANSendFrame(g_Msg125.id,g_Msg125.prio,g_Msg125.dlc,g_Msg125.data); 
        //   g_bReturn = bsp_CANSendFrame(g_Msg084.id,g_Msg084.prio,g_Msg084.dlc,g_Msg084.data); 
        //   g_bReturn = bsp_CANSendFrame(g_Msg230.id,g_Msg230.prio,g_Msg230.dlc,g_Msg230.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg101.id,g_Msg101.prio,g_Msg101.dlc,g_Msg101.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg1B1.id,g_Msg1B1.prio,g_Msg1B1.dlc,g_Msg1B1.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg755.id,g_Msg755.prio,g_Msg755.dlc,g_Msg755.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg2B1.id,g_Msg2B1.prio,g_Msg2B1.dlc,g_Msg2B1.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg15B.id,g_Msg15B.prio,g_Msg15B.dlc,g_Msg15B.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg207.id,g_Msg207.prio,g_Msg207.dlc,g_Msg207.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg11C.id,g_Msg11C.prio,g_Msg11C.dlc,g_Msg11C.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg200.id,g_Msg200.prio,g_Msg200.dlc,g_Msg200.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg137.id,g_Msg137.prio,g_Msg137.dlc,g_Msg137.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg126.id,g_Msg126.prio,g_Msg126.dlc,g_Msg126.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg302.id,g_Msg302.prio,g_Msg302.dlc,g_Msg302.data);
          g_bReturn = bsp_CANSendFrame(g_Msg306.id,g_Msg306.prio,g_Msg306.dlc,g_Msg306.data);
          g_bReturn = bsp_CANSendFrame(g_Msg230.id,g_Msg230.prio,g_Msg230.dlc,g_Msg230.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg21B.id,g_Msg21B.prio,g_Msg21B.dlc,g_Msg21B.data);
          if((G_Button.LED_STEP != 0) && (G_Button.LED_STEP != 1))
          {
            // g_bReturn = bsp_CANSendFrame(g_Msg3B0.id,g_Msg3B0.prio,g_Msg3B0.dlc,g_Msg3B0.data);
          }
        //   g_bReturn = bsp_CANSendExtFrame(g_Msg0C01FF55.id,g_Msg0C01FF55.prio,g_Msg0C01FF55.dlc,g_Msg0C01FF55.data);
        //    g_bReturn = bsp_CANSendExtFrame(g_Msg0C01FFAB.id,g_Msg0C01FFAB.prio,g_Msg0C01FFAB.dlc,g_Msg0C01FFAB.data);
            // g_bReturn = bsp_CANSendExtFrame(g_Msg0C01FFA5.id,g_Msg0C01FFA5.prio,g_Msg0C01FFA5.dlc,g_Msg0C01FFA5.data);
            
          
      }
     if(api_TimerOver3((_Clock*)&g_Clock)) //70ms
      {
          api_SetTimer3(63,(_Clock*)&g_Clock); 
          if(G_Button.LED_STEP != 0)
          {
        //   g_bReturn = bsp_CANSendFrame(g_Msg7E8.id,g_Msg7E8.prio,g_Msg7E8.dlc,g_Msg7E8.data);
        //   g_bReturn = bsp_CANSendFrame(g_Msg7E82.id,g_Msg7E82.prio,g_Msg7E82.dlc,g_Msg7E82.data);
          }
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18FD7C00.id,g_Msg18FD7C00.prio,g_Msg18FD7C00.dlc,g_Msg18FD7C00.data);  //1000
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18FEF100.id,g_Msg18FEF100.prio,g_Msg18FEF100.dlc,g_Msg18FEF100.data); //1000       
      }
     if(api_TimerOver6((_Clock*)&g_Clock))
      {
          api_SetTimer6(50,(_Clock*)&g_Clock); //100ms
          if(G_Button.LED_STEP == 6)
          {
            if(diwidi< 250)
            {
                diwidi++;
            }
          }
        //     g_bReturn = bsp_CANSendFrame(g_Msg772.id,g_Msg772.prio,g_Msg772.dlc,g_Msg772.data);
        //      g_bReturn = bsp_CANSendFrame(g_Msg7728.id,g_Msg7728.prio,g_Msg7728.dlc,g_Msg7728.data);
        //   g_bReturn = bsp_CANSendExtFrame(g_Msg0A31FFE8.id,g_Msg0A31FFE8.prio,g_Msg0A31FFE8.dlc,g_Msg0A31FFE8.data);
        //   g_bReturn = bsp_CANSendExtFrame(g_Msg18FF5000.id,g_Msg18FF5000.prio,g_Msg18FF5000.dlc,g_Msg18FF5000.data);
        //   g_bReturn = bsp_CANSendExtFrame(g_Msg18FF5100.id,g_Msg18FF5100.prio,g_Msg18FF5100.dlc,g_Msg18FF5100.data);
      //    g_bReturn = bsp_CANSendExtFrame(g_Msg18FD0700.id,g_Msg18FD0700.prio,g_Msg18FD0700.dlc,g_Msg18FD0700.data);  //1000 
      //    g_bReturn = bsp_CANSendExtFrame(g_Msg18FEC600.id,g_Msg18FEC600.prio,g_Msg18FEC600.dlc,g_Msg18FEC600.data);  //1000 
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18850000.id,g_Msg18850000.prio,g_Msg18850000.dlc,g_Msg18850000.data);  //1000        
      } 
      
      if(api_TimerOver5((_Clock*)&g_Clock)) //
      {
          api_SetTimer5(5,(_Clock*)&g_Clock); //10ms
        //   g_bReturn = bsp_CANSendExtFrame(g_Msg0A30FFE8.id,g_Msg0A30FFE8.prio,g_Msg0A30FFE8.dlc,g_Msg0A30FFE8.data);
      //    g_bReturn = bsp_CANSendExtFrame(g_Msg18F0010B.id,g_Msg18F0010B.prio,g_Msg18F0010B.dlc,g_Msg18F0010B.data); //1000
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg0CFED926.id,g_Msg0CFED926.prio,g_Msg0CFED926.dlc,g_Msg0CFED926.data); //1000
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18FED800.id,g_Msg18FED800.prio,g_Msg18FED800.dlc,g_Msg18FED800.data); //1000 
      }
    } 
    
}
/*-------------------------------------------------------------------------
* Function Name  : app_Can_handle
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/


void app_Can_IdInit(void)
{
  api_SetTimer0(1,(_Clock*)&g_Clock);
  api_SetTimer1(1,(_Clock*)&g_Clock);
  api_SetTimer2(1,(_Clock*)&g_Clock);
  api_SetTimer3(1,(_Clock*)&g_Clock);
  api_SetTimer4(1,(_Clock*)&g_Clock);
  api_SetTimer5(1,(_Clock*)&g_Clock);
  api_SetTimer6(1,(_Clock*)&g_Clock);
  api_SetTimer7(1,(_Clock*)&g_Clock);
  
    g_Msg18FD0700.id = 0X18FD0700;
    g_Msg18FD0700.prio = 0;
    g_Msg18FD0700.dlc = 8;
    
    g_Msg18FD7C00.id = 0X18FD7C00;
    g_Msg18FD7C00.prio = 0;
    g_Msg18FD7C00.dlc = 8;
    
    
    //
    g_Msg18FE4F17.id = 0X18FE4F17;
    g_Msg18FE4F17.prio = 0;
    g_Msg18FE4F17.dlc = 8;
    
    //ת��
    g_Msg18FF0113.id = 0X0CF00400 ;
    g_Msg18FF0113.prio = 0;
    g_Msg18FF0113.dlc = 8;
    
    g_Msg0C01FF55.id = 0x0C01FF55 ;
    g_Msg0C01FF55.prio = 0;
    g_Msg0C01FF55.dlc = 8;

   g_Msg0C01FFA5.id = 0x0C01FFA5 ;
    g_Msg0C01FFA5.prio = 0;
    g_Msg0C01FFA5.dlc = 8;

 g_Msg0C01FFAB.id = 0x0C01FFAB ;
    g_Msg0C01FFAB.prio = 0;
    g_Msg0C01FFAB.dlc = 8;

    g_Msg0A30FFE8.id = 0X0A30FFE8;
    g_Msg0A30FFE8.prio = 0;
    g_Msg0A30FFE8.dlc = 8;

    g_Msg0A31FFE8.id = 0X0A31FFE8;
    g_Msg0A31FFE8.prio = 0;
    g_Msg0A31FFE8.dlc = 8;

    g_Msg0CFED926.id = 0X0CFED926;
    g_Msg0CFED926.prio = 0;
    g_Msg0CFED926.dlc = 8;
    
    g_Msg240.id = 0X240 ;
    g_Msg240.prio = 0;
    g_Msg240.dlc = 8;

    g_Msg101.id = 0X101 ;
    g_Msg101.prio = 0;
    g_Msg101.dlc = 8;

    g_Msg402.id = 0X402 ;
    g_Msg402.prio = 0;
    g_Msg402.dlc = 8;




    g_Msg230.id = 0X230 ;
    g_Msg230.prio = 0;
    g_Msg230.dlc = 8;

    g_Msg21B.id = 0X21B ;
    g_Msg21B.prio = 0;
    g_Msg21B.dlc = 8;

    g_Msg125.id = 0X125 ;
    g_Msg125.prio = 0;
    g_Msg125.dlc = 8;


    g_Msg7E8.id = 0X7E8 ;
    g_Msg7E8.prio = 0;
    g_Msg7E8.dlc = 8;

    g_Msg7E82.id = 0X7E8 ;
    g_Msg7E82.prio = 0;
    g_Msg7E82.dlc = 8;

    g_Msg084.id = 0X084 ;
    g_Msg084.prio = 0;
    g_Msg084.dlc = 8;

    g_Msg402.id = 0X402 ;
    g_Msg402.prio = 0;
    g_Msg402.dlc = 8;
    
    g_Msg18F0010B.id = 0X18F0010B;
    g_Msg18F0010B.prio = 0;
    g_Msg18F0010B.dlc = 8;
    
    
    //����ѹ��
    g_Msg08FFF00B.id = 0X08FFF00B;
    g_Msg08FFF00B.prio = 0;
    g_Msg08FFF00B.dlc = 8;
    
    
    g_Msg18FED800.id = 0X18FED800;
    g_Msg18FED800.prio = 0;
    g_Msg18FED800.dlc = 8;
    
    g_Msg18FEF100.id = 0X18FEF100;
    g_Msg18FEF100.prio = 0;
    g_Msg18FEF100.dlc = 8;
    
    g_Msg18DA17F9.id = 0X18DA17F9;
    g_Msg18DA17F9.prio = 0;
    g_Msg18DA17F9.dlc = 8; 
    g_Msg18DA17F9.data[0].bbyte=0x02;
    g_Msg18DA17F9.data[1].bbyte=0x3E;
    
    g_Msg18FEC600.id = 0X18FEC600;
    g_Msg18FEC600.prio = 0;
    g_Msg18FEC600.dlc = 8;    
    
    g_Msg18850000.id = 0X18850000;
    g_Msg18850000.prio = 0;
    g_Msg18850000.dlc = 8;

    g_Msg18FF5100.id = 0X18FF5100;
    g_Msg18FF5100.prio = 0;
    g_Msg18FF5100.dlc = 8;
    
    g_Msg18FF5000.id = 0X18FF5000;
    g_Msg18FF5000.prio = 0;
    g_Msg18FF5000.dlc = 8;

    g_Msg1B1.id = 0X1B1;
    g_Msg1B1.prio = 0;
    g_Msg1B1.dlc = 8;

    g_Msg755.id = 0X755;
    g_Msg755.prio = 0;
    g_Msg755.dlc = 8;

    g_Msg2B1.id = 0X2B1;
    g_Msg2B1.prio = 0;
    g_Msg2B1.dlc = 8;

    g_Msg3B0.id = 0X3B0;
    g_Msg3B0.prio = 0;
    g_Msg3B0.dlc = 8;

    g_Msg15B.id = 0X15B;
    g_Msg15B.prio = 0;
    g_Msg15B.dlc = 8;

    g_Msg207.id = 0X207;
    g_Msg207.prio = 0;
    g_Msg207.dlc = 8;

    g_Msg11C.id = 0X11C;
    g_Msg11C.prio = 0;
    g_Msg11C.dlc = 8;

    g_Msg200.id = 0X200;
    g_Msg200.prio = 0;
    g_Msg200.dlc = 8;

    g_Msg137.id = 0X137;
    g_Msg137.prio = 0;
    g_Msg137.dlc = 8;

    g_Msg126.id = 0X126;
    g_Msg126.prio = 0;
    g_Msg126.dlc = 8;

    g_Msg302.id = 0X302;
    g_Msg302.prio = 0;
    g_Msg302.dlc = 8;

    g_Msg108.id = 0X108;
    g_Msg108.prio = 0;
    g_Msg108.dlc = 8;

    g_Msg082.id = 0X082;
    g_Msg082.prio = 0;
    g_Msg082.dlc = 8;

    g_Msg772.id=0x772;
    g_Msg772.prio=0;
    g_Msg772.dlc=8;

      g_Msg7728.id=0x772;
    g_Msg7728.prio=0;
    g_Msg7728.dlc=2;

    g_Msg230.id=0x230;
    g_Msg230.prio=0;
    g_Msg230.dlc=8;

    g_Msg306.id=0x306;
    g_Msg306.prio=0;
    g_Msg306.dlc=8;
}




void app_Can_handle_PA5(void) {
    
    
#if PA5_EN
        
 /*   if(G_Button.LED_STEP == 1)
    {      
        g_Msg240.data[7].bbyte=0xE3;  // ˮ�� 40�� --1ge
        g_Msg18FD0700.data[0].bbyte=0x04; //SVS 
        g_Msg18FEC600.data[2].bbyte=0xA0; //��ѹ4000kpa--1ge
        g_Msg18FEC600.data[3].bbyte=0x0F;
        g_Msg18FEF100.data[6].bbyte=0x0A;
    }
    if(G_Button.LED_STEP == 2)
    {
        g_Msg240.data[7].bbyte=0xE3;  // ˮ�� 50��--2ge
        g_Msg18FD0700.data[0].bbyte=0x40;  //OBD
        g_Msg18FEC600.data[2].bbyte=0x40; //��ѹ8000kpa--2ge
        g_Msg18FEC600.data[3].bbyte=0x1F;        
    }
    if(G_Button.LED_STEP == 3)
    {
        g_Msg240.data[7].bbyte=0xE3;  // ˮ�� 70��--4ge
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x01; //DPF-GPF
        g_Msg18FEC600.data[2].bbyte=0xE0; //��ѹ12000kpa--3ge
        g_Msg18FEC600.data[3].bbyte=0x2E;        
    }
    if(G_Button.LED_STEP == 4)
    {
        g_Msg240.data[7].bbyte=0xE3;  // ˮ�� 105��--7ge
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x04; //DPF-GPF  FLASH
        g_Msg18FEC600.data[2].bbyte=0x80; //��ѹ16000kpa--4ge
        g_Msg18FEC600.data[3].bbyte=0x3E;        
    }
    if(G_Button.LED_STEP == 5)
    {
        g_Msg240.data[7].bbyte=0xE3;  // ˮ�� 110��--8ge
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x01; //G
    }
    if(G_Button.LED_STEP == 6)
    {
        g_Msg240.data[7].bbyte=0xC8;  // ˮ�� 120��--9ge
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x02; //G flash
    }
    if(G_Button.LED_STEP == 13)
    {
        g_Msg240.data[7].bbyte=0xC8; 
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x00;
        g_Msg18FEF100.data[3].bbyte=0x01;  //����Ѳ��
    }
    if(G_Button.LED_STEP == 12)
    {
        g_Msg240.data[7].bbyte=0xC8; 
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x00;
        g_Msg18FEF100.data[3].bbyte=0x00;
        g_Msg18FE4F17.data[0].bbyte=0x01; //ESC--ESP
    }
    if(G_Button.LED_STEP == 14)
    {
    //    g_Msg240.data[7].bbyte=0xC8; 
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x00;
        g_Msg18FEF100.data[3].bbyte=0x00; 
        g_Msg18850000.data[1].bbyte=0x82;//sport
    }
    if(G_Button.LED_STEP == 9)
    {
    //    g_Msg240.data[7].bbyte=0xC8; 
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x00;
        g_Msg18FEF100.data[3].bbyte=0x00;
        g_Msg18FE4F17.data[0].bbyte=0x00;
        g_Msg0CFED926.data[0].bbyte=0x01;//Eps
    }
    if(G_Button.LED_STEP == 10)
    {
    //    g_Msg240.data[7].bbyte=0xC8; 
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x00;
        g_Msg18FEF100.data[3].bbyte=0x00;
        g_Msg18FE4F17.data[0].bbyte=0x00;
        g_Msg0CFED926.data[0].bbyte=0x02;//Eps flash
    }
    if(G_Button.LED_STEP == 7)
    {
        Req_1001FlagY = 0;
        Req_1003FlagY = 0;
        Req_2701FlagY = 0; 
        Req_2702FlagY = 0;
        Req_1001Flag = 0;
        Req_1003Flag = 0;
        Req_2701Flag = 0; 
        Req_2702Flag = 0;                  
        g_Msg240.data[7].bbyte=0xC8; 
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x00;
        g_Msg18FEF100.data[3].bbyte=0x00;
        g_Msg18FE4F17.data[0].bbyte=0x00;
        g_Msg0CFED926.data[0].bbyte=0x00;
        g_Msg18F0010B.data[5].bbyte=0x10;  //ABS 
    }
    
    if(G_Button.LED_STEP != 8) 
    {
        Req_1001FlagY1 = 0;
        Req_1003FlagY1 = 0;
        Req_2701FlagY1 = 0; 
        Req_2702FlagY1 = 0;
        Req_1001Flag1 = 0;
        Req_1003Flag1 = 0;
        Req_2701Flag1 = 0; 
        Req_2702Flag1 = 0;  
    }
    
    if(G_Button.LED_STEP == 8)   //ALL  //����: �г���
    {                
    //    g_Msg240.data[7].bbyte=0xC8; 
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x00;
        g_Msg18FEF100.data[3].bbyte=0x00;
        g_Msg18FE4F17.data[0].bbyte=0x00;
        g_Msg0CFED926.data[0].bbyte=0x00;
        g_Msg18F0010B.data[5].bbyte=0x10;  //ABS   
        g_Msg0CFED926.data[0].bbyte=0x01;//Eps  
        g_Msg18FE4F17.data[0].bbyte=0x01; //ESC--ESP
        g_Msg18FEF100.data[3].bbyte=0x01;  //����Ѳ�� 
        g_Msg18FED800.data[0].bbyte=0x01; //G
        g_Msg18FD7C00.data[0].bbyte=0x01; //DPF-GPF 
        g_Msg18FD0700.data[0].bbyte=0x40;  //OBD  
        g_Msg18FD0700.data[0].bbyte=0x04; //SVS     
        
       Req_1001Flag1 = 0;
       Req_1003Flag1 = 0;
       Req_2701Flag1 = 0; 
       Req_2702Flag1 = 0;        
       if(!Req_1001FlagY1)
       {
          Req_1001FlagY1 = 1;
          g_Msg18DA17F9.data[0].bbyte=0x02; //
          g_Msg18DA17F9.data[1].bbyte=0x10;
          g_Msg18DA17F9.data[2].bbyte=0x01; 
        //  g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);
          bsp_IIC_delay(); 
       }        
       if(!Req_1003FlagY1)
       {
          Req_1003FlagY1 = 1;
          g_Msg18DA17F9.data[0].bbyte=0x02; //
          g_Msg18DA17F9.data[1].bbyte=0x10;
          g_Msg18DA17F9.data[2].bbyte=0x03; 
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);
          bsp_IIC_delay(); 
       }        
       if(!Req_2701FlagY1)
       {
          Req_2701FlagY1 = 1;
          g_Msg18DA17F9.data[0].bbyte=0x02; 
          g_Msg18DA17F9.data[1].bbyte=0x27;
          g_Msg18DA17F9.data[2].bbyte=0x01; 
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);
          bsp_IIC_delay(); 
       }
       if((!Req_2702FlagY1) && (LockY == 1)) 
       {
          Req_2702FlagY1 = 1;
          UnlockProY(); 
          g_Msg18DA17F9.data[0].bbyte=0x06; //27 02 ....
          g_Msg18DA17F9.data[1].bbyte=0x27;
          g_Msg18DA17F9.data[2].bbyte=0x02; 
          g_Msg18DA17F9.data[3].bbyte=(INT8U)(CalcKey>>24); 
          g_Msg18DA17F9.data[4].bbyte=(INT8U)(CalcKey>>16); 
          g_Msg18DA17F9.data[5].bbyte=(INT8U)(CalcKey>>8); 
          g_Msg18DA17F9.data[6].bbyte=(INT8U)CalcKey; 
      //    g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);
          bsp_IIC_delay(); 
          g_Msg18DA17F9.data[0].bbyte=0x04; //2E 02 10  _01
          g_Msg18DA17F9.data[1].bbyte=0x2E;
          g_Msg18DA17F9.data[2].bbyte=0x02; 
          g_Msg18DA17F9.data[3].bbyte=0x1F; 
          g_Msg18DA17F9.data[4].bbyte=0x01; 
          g_Msg18DA17F9.data[5].bbyte=0x00; 
          g_Msg18DA17F9.data[6].bbyte=0x00; 
          g_Msg18DA17F9.data[6].bbyte=0x00;
      //    g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);                     
       }   
                          
    }    
    
    if(G_Button.LED_STEP != 11) 
    {
        Req_1001FlagY = 0;
        Req_1003FlagY = 0;
        Req_2701FlagY = 0; 
        Req_2702FlagY = 0;
        Req_1001Flag = 0;
        Req_1003Flag = 0;
        Req_2701Flag = 0; 
        Req_2702Flag = 0;  
    }
 
    if(G_Button.LED_STEP == 11) //����: ����ѹ,�޳���
    {       
       if(!Req_1001FlagY)
       {
          Req_1001FlagY = 1;
          g_Msg18DA17F9.data[0].bbyte=0x02; //
          g_Msg18DA17F9.data[1].bbyte=0x10;
          g_Msg18DA17F9.data[2].bbyte=0x01; 
      //    g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);
          bsp_IIC_delay(); 
       }        
       if(!Req_1003FlagY)
       {
          Req_1003FlagY = 1;
          g_Msg18DA17F9.data[0].bbyte=0x02; //
          g_Msg18DA17F9.data[1].bbyte=0x10;
          g_Msg18DA17F9.data[2].bbyte=0x03; 
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);
          bsp_IIC_delay(); 
       }        
       if(!Req_2701FlagY)
       {
          Req_2701FlagY = 1;
          g_Msg18DA17F9.data[0].bbyte=0x02; 
          g_Msg18DA17F9.data[1].bbyte=0x27;
          g_Msg18DA17F9.data[2].bbyte=0x01; 
      //    g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);
          bsp_IIC_delay(); 
       }
       if((!Req_2702FlagY) && (LockY == 1)) 
       {
          Req_2702FlagY = 1;
          UnlockProY(); 
          g_Msg18DA17F9.data[0].bbyte=0x06; //27 02 ....
          g_Msg18DA17F9.data[1].bbyte=0x27;
          g_Msg18DA17F9.data[2].bbyte=0x02; 
          g_Msg18DA17F9.data[3].bbyte=(INT8U)(CalcKey>>24); 
          g_Msg18DA17F9.data[4].bbyte=(INT8U)(CalcKey>>16); 
          g_Msg18DA17F9.data[5].bbyte=(INT8U)(CalcKey>>8); 
          g_Msg18DA17F9.data[6].bbyte=(INT8U)CalcKey; 
     //    g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);
          bsp_IIC_delay(); 
          g_Msg18DA17F9.data[0].bbyte=0x04; //2E 02 10  _14
          g_Msg18DA17F9.data[1].bbyte=0x2E;
          g_Msg18DA17F9.data[2].bbyte=0x02; 
          g_Msg18DA17F9.data[3].bbyte=0x10; 
          g_Msg18DA17F9.data[4].bbyte=0x14; 
          g_Msg18DA17F9.data[5].bbyte=0x00; 
          g_Msg18DA17F9.data[6].bbyte=0x00; 
          g_Msg18DA17F9.data[6].bbyte=0x00;
     //     g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);     
          
          bsp_IIC_delay(); 
          g_Msg18DA17F9.data[0].bbyte=0x04; //2E 02 1F  _00
          g_Msg18DA17F9.data[1].bbyte=0x2E;
          g_Msg18DA17F9.data[2].bbyte=0x02; 
          g_Msg18DA17F9.data[3].bbyte=0x1F; 
          g_Msg18DA17F9.data[4].bbyte=0x00; 
          g_Msg18DA17F9.data[5].bbyte=0x00; 
          g_Msg18DA17F9.data[6].bbyte=0x00; 
          g_Msg18DA17F9.data[6].bbyte=0x00;
       //   g_bReturn = bsp_CANSendExtFrame(g_Msg18DA17F9.id,g_Msg18DA17F9.prio,g_Msg18DA17F9.dlc,g_Msg18DA17F9.data);                 
       }               
    } 
    

    if(G_Button.LED_STEP == 0)
    {
    //    g_Msg240.data[7].bbyte=0xC8; 
        g_Msg18FD0700.data[0].bbyte=0x00;
        g_Msg18FD0700.data[1].bbyte=0x00;
        g_Msg18FD7C00.data[0].bbyte=0x00;
        g_Msg18FED800.data[0].bbyte=0x00;
        g_Msg18FEF100.data[3].bbyte=0x00;
        g_Msg18FE4F17.data[0].bbyte=0x00;
        g_Msg0CFED926.data[0].bbyte=0x00;
        g_Msg18F0010B.data[5].bbyte=0x00;
        Req_1001FlagY = 0;
        Req_1003FlagY = 0;
        Req_2701FlagY = 0; 
        Req_2702FlagY = 0;
        Req_1001Flag = 0;
        Req_1003Flag = 0;
        Req_2701Flag = 0; 
        Req_2702Flag = 0;  
        g_Msg18FEC600.data[2].bbyte=0x00; 
        g_Msg18FEC600.data[3].bbyte=0x00;                      
    }
      */
    if(G_Button.LED_STEP == 0)
    {
        g_Msg230.data[0].bbyte = 0x08;      //车速显示（需要配合单位一起发）16
    }
    if(G_Button.LED_STEP == 1)
    {
        g_Msg230.data[0].bbyte = 0x10;      //车速显示（需要配合单位一起发）32
    }
    if(G_Button.LED_STEP == 2)
    {
        g_Msg230.data[0].bbyte = 0x18;      //车速显示（需要配合单位一起发）48
    }
    if(G_Button.LED_STEP == 3)
    {
        g_Msg230.data[0].bbyte = 0x20;      //车速显示（需要配合单位一起发）64
    }
    if(G_Button.LED_STEP == 4)
    {
        g_Msg230.data[0].bbyte = 0x28;      //车速显示（需要配合单位一起发）80
    }
    if(G_Button.LED_STEP == 5)
    {
        g_Msg230.data[0].bbyte = 0x30;      //车速显示（需要配合单位一起发）96
    }
    if(G_Button.LED_STEP == 6)
    {
       g_Msg230.data[0].bbyte = 0x38;      //车速显示（需要配合单位一起发）112
    }
    if(G_Button.LED_STEP == 7)
    {
        g_Msg230.data[0].bbyte = 0x40;      //车速显示（需要配合单位一起发）128
    }
    if(G_Button.LED_STEP == 8)
    {
        g_Msg230.data[0].bbyte = 0x48;      //车速显示（需要配合单位一起发）144
    }
    if(G_Button.LED_STEP == 9)
    {
        g_Msg230.data[0].bbyte = 0x50;      //车速显示（需要配合单位一起发）160
    }
#endif
}

