
#include "Gauges.h"

uint32_t  ESpeedMicrostep;
uint32_t  VSpeedMicrostep;
uint8_t   CoolantTempSeg;
uint8_t   CoolantFuelSeg;
uint8_t   GaugesTimer;

//extern uint8_t  ContrlorResumeofFUEL;   //油表控制标志位
//extern uint8_t  ContrlorResumeofTEMP;   //水温表控制标志位
//extern uint8_t  ContrlorResumeofVspeed; //车速表控制标志位
//extern uint8_t  ContrlorResumeofEspeed; //转速表控制标志位

//extern uint16_t ESpeedVal;              //转速
//extern uint16_t VspeedVal;              //车速
//extern uint16_t ESpeedValNUM;           //转速
//extern uint16_t VspeedValNUM;           //车速
//extern uint16_t TempSeg;                //水温
//extern uint16_t FuelSeg;                //燃油
//extern uint16_t WaterTempValNUM;        //水温
//extern uint16_t FuelValNUM;             //燃油
//extern uint16_t WaterTempVal;           //水温
//extern uint16_t FuelVal;                //车速
//extern uint8_t  FuelDisp ; 

/*********************车转水油显示***************************/
void Gauges_Management_Service(void)
{
    uint8_t   UpdateFlag;
    
    if (SYS_IGN_OFF_DISP_MODE)
    {
         Gauges_ESpeed_Display_OFF();
         Gauges_VSpeed_Display_OFF();
         Gauges_AirOne_Display_OFF();
         Gauges_AirTwo_Display_OFF();
    } 
    
    if ( SYS_IGN_ON_DISP_MODE )
    {
        if (GaugesTimer)
        {
            UpdateFlag = 0;
            GaugesTimer--;
        }
        else
        {
            UpdateFlag  = 1;
            GaugesTimer = 5;
        }
        if (UpdateFlag)
        {
            //天蓝液   右下
            if (ContrlorResumeofVspeed == 0)
            {
                CSB_JDMHLBUF_LS = GJ_KDV_JSSYBMBJD(&CSBFrJDTB[0], DataCoolantADblueSegDisp, cnCSBFrJDTBLen);
                STEPPER_MOTOR_0_DST_STEP = CSB_JDMHLBUF_LS;
            }
            else
            {
                CSB_JDMHLBUF_LS = GJ_KDV_JSSYBMBJD(&CSBFrJDTB[0], ADblueSeg, cnCSBFrJDTBLen);
                STEPPER_MOTOR_0_DST_STEP = CSB_JDMHLBUF_LS;
            }
            
            //机油     左下
            if (ContrlorResumeofEspeed == 0)
            {
                zs_JDMHLBUF_LS = GJ_KDV_JSSYBMBJD(&ZSBFrJDTB[0], DataCoolantOilSegDisp, cnZSBFrJDTBLen);
                STEPPER_MOTOR_3_DST_STEP = zs_JDMHLBUF_LS;
            }
            else
            {
                zs_JDMHLBUF_LS = GJ_KDV_JSSYBMBJD(&ZSBFrJDTB[0], OilSeg, cnZSBFrJDTBLen);
                STEPPER_MOTOR_3_DST_STEP = zs_JDMHLBUF_LS;
            }
            
            //燃油   左上
            if (ContrlorResumeofFUEL == 0) 
            {	  
      	        YOUB_FBJD_MHL = GJ_KDV_JSSYBMBJD(&YOUBVJDTB[0], Fuel_Seg, cnYOUBVJDTBLen);  
      	        STEPPER_MOTOR_2_DST_STEP = YOUB_FBJD_MHL;
            }
            else
            {
                YOUB_FBJD_MHL = GJ_KDV_JSSYBMBJD(&YOUBVJDTB[0], Fuel_Seg, cnYOUBVJDTBLen);  
      	        STEPPER_MOTOR_2_DST_STEP = YOUB_FBJD_MHL;	  
            } 	
            //水温   右上
            if (ContrlorResumeofTEMP == 0) 
            { 
      	        SUIB_FBJD_MHL = GJ_KDV_JSSYBMBJD(&SUIBVJDTB[0], DataCoolantTempSegDisp, cnSUIBVJDTBLen);  
      	        STEPPER_MOTOR_1_DST_STEP = SUIB_FBJD_MHL;	       
            }
        	  else
            { 
                SUIB_FBJD_MHL = GJ_KDV_JSSYBMBJD(&SUIBVJDTB[0], TempSeg, cnSUIBVJDTBLen);  
                STEPPER_MOTOR_1_DST_STEP = SUIB_FBJD_MHL;	 
            }
        }
    }
}
/***************************************************************
 转速显示归零         左下
****************************************************************/
void Gauges_ESpeed_Display_OFF(void)
{
    STEPPER_MOTOR_3_DST_STEP = 0;
}
/***************************************************************
 车速显示归零         右下
****************************************************************/
void Gauges_VSpeed_Display_OFF(void)
{
    STEPPER_MOTOR_0_DST_STEP = 0;
}
/***************************************************************
 水表显示归零         左上
****************************************************************/
void Gauges_AirOne_Display_OFF(void)
{
    STEPPER_MOTOR_2_DST_STEP = 0;
}
/***************************************************************
油表显示归零          右上
****************************************************************/
void Gauges_AirTwo_Display_OFF(void)
{
    STEPPER_MOTOR_1_DST_STEP = 0;
}
