#include "Gauges.h" 
#include "Common_Interface.h"

typedef struct 
{
  uint32_t SelfDir;
	uint32_t VehicleTestValue;
  uint32_t EngineTestValue;
  uint32_t FuelTestValue;
	uint32_t TempTestValue;
	
}SelfTestTime;

SelfTestTime MotorSelfTestTime;

GaugesCtrlStruct GaugesCtrl;

//20Ms
/*void Gauges_Management_Service(void) 
{
		uint16_t DATA_ENGINE_SPEED_DISPLAYING;
	
	
	if (Common_Get_IG_Sts() == COMMON_POWER_OFF)
	{
		SEG_LCD_Vehicle_Speed_Num_Display(0, 0, 0);
		SEG_LCD_Engine_Speed_Seg_Display(0, 0, 0);
		SEG_LCD_ODO_Trip_Display(0, 0, 0, 0);
		SEG_Fuel_Level_Display(0, 0);
		SEG_LCD_Battery_Voltage_Display(0, 0 ,0);
		SEG_Coolant_Temp_Display(0, 0);
		SEG_LCD_Gear_Display(0, 0, 0);
		
		MotorSelfTestTime.VehicleTestValue = 0;
    MotorSelfTestTime.EngineTestValue = 0;
    MotorSelfTestTime.FuelTestValue = 0;
    MotorSelfTestTime.TempTestValue = 0;
		MotorSelfTestTime.SelfDir = 0;
	}
	//else if (Common_GetIgnOnTime() < 3000)
	if(0) //取消扫表
	{
		if (MotorSelfTestTime.SelfDir >= 15) //顶格停留15*20ms=0.3s
    {
      if (MotorSelfTestTime.EngineTestValue < 200) //1.2s
        MotorSelfTestTime.EngineTestValue = 0;
      else
        MotorSelfTestTime.EngineTestValue -= 210;
      
      if (MotorSelfTestTime.VehicleTestValue < 60) //1.2s
        MotorSelfTestTime.VehicleTestValue = 0;
      else
        MotorSelfTestTime.VehicleTestValue -= 30;
  
      if (MotorSelfTestTime.FuelTestValue < 100)  //1.2s
        MotorSelfTestTime.FuelTestValue = 0;
      else
        MotorSelfTestTime.FuelTestValue -= 10;
			
      if (MotorSelfTestTime.TempTestValue < 100)  //1.2s
        MotorSelfTestTime.TempTestValue = 0;
      else
        MotorSelfTestTime.TempTestValue -= 10;
    }
    else
    {
      if ((MotorSelfTestTime.EngineTestValue >= 12600) && (MotorSelfTestTime.VehicleTestValue >= 1990) &&\
				(MotorSelfTestTime.FuelTestValue >= 600) && (MotorSelfTestTime.FuelTestValue >= 600))
			{
				MotorSelfTestTime.SelfDir ++;
			}
			else
			{
				MotorSelfTestTime.EngineTestValue += 168;  //1.5s
				MotorSelfTestTime.VehicleTestValue += 24;  //1.5s
				MotorSelfTestTime.FuelTestValue += 8;  //1.5s
				MotorSelfTestTime.TempTestValue += 8;  //1.5s
			}
    }
	
	}
	else
	{
		if(0)  //查表未使用
		{
			//转速表
			DATA_ENGINE_SPEED_DISPLAYING = Common_Get_Disp_E_Speed();
			if (DATA_ENGINE_SPEED_DISPLAYING > GaugesCtrl.ESpeedBackup)        //转速增加,查上升表
			{
				while (GaugesCtrl.ESpeedSeg < GAUGES_TOTAL_TACHOMETER_SEG)
				{
					if (DATA_ENGINE_SPEED_DISPLAYING < GaugesTachoMeterSegIncTable[GaugesCtrl.ESpeedSeg])
						break;
					GaugesCtrl.ESpeedSeg++;
				}
			}
			else if (DATA_ENGINE_SPEED_DISPLAYING < GaugesCtrl.ESpeedBackup)   //转速减小,查下降表
			{
				while (GaugesCtrl.ESpeedSeg)
				{
					if (DATA_ENGINE_SPEED_DISPLAYING >= GaugesTachoMeterSegDecTable[GaugesCtrl.ESpeedSeg - 1])
						break;
					GaugesCtrl.ESpeedSeg--;
				}
			}

			GaugesCtrl.ESpeedBackup = DATA_ENGINE_SPEED_DISPLAYING;
			Common_Set_Gauges_E_Speed(GaugesCtrl.ESpeedSeg);
		}
	}
	
	Common_Set_E_Speed_Test(MotorSelfTestTime.VehicleTestValue);
	Common_Set_V_Speed_Test(MotorSelfTestTime.EngineTestValue);
	Common_Set_Fuel_Test(MotorSelfTestTime.FuelTestValue / 100);
  Common_Set_Temp_Test(MotorSelfTestTime.TempTestValue / 100);
}
*/

