#ifndef _GAUGES_H_
#define _GAUGES_H_
#include "Data_Processor.h"
#include "Stepper_Motor.h"
#include "Segmented_Gauges.h "
#include "TSzhen.h"
#include "LCD_SEG.h"
#include "main.h"

extern uint32_t  ESpeedMicrostep;
extern uint32_t  VSpeedMicrostep;
extern uint8_t   CoolantTempSeg;

//----hyq--20190430

extern uint8_t  ContrlorResumeofTEMP;    //ˮ�±����Ʊ�־λ
extern uint8_t  ContrlorResumeofVspeed;  //���ٱ����Ʊ�־λ
extern uint8_t  ContrlorResumeofEspeed;  //ת�ٱ����Ʊ�־λ
extern uint8_t  ContrlorResumeofGAS1  ;  //��ѹ1

extern uint16_t ESpeedVal;               //ת��
//extern uint16_t VspeedVal;               //����
extern uint16_t ESpeedValNUM;            //ת��
extern uint16_t VspeedValNUM;            //����
extern uint8_t TempSeg;                  //ˮ��
//extern uint16_t FuelSeg;                 //ȼ��
//extern uint16_t ADblueSeg;               //����Һ
//extern uint16_t OilSeg;                
//extern uint16_t GAS1_DISPLAY;            //��ѹ1
//extern uint16_t GAS2_DISPLAY;            //��ѹ2

//----hyq--20190430
/******************************************************************************
���ٶ�������
******************************************************************************/
static const uint16_t GaugesSpeedoMeterSegIncTable[] = 
{
  /*=================
    ��ʾ�� | ��  ��
  ---------+-------*/
  /*    0 */    0,
  /*    1 */  110,
  /*    2 */  210,
  /*    3 */  310,
  /*    4 */  410,
  /*    5 */  510,
  /*    6 */  610,
  /*    7 */  710,
  /*    8 */  810,
  /*    9 */  910,
  /*   10 */ 1010,
  /*   11 */ 1110,
  /*   12 */ 1210,
  /*   13 */ 1310,
  /*   14 */ 1410,
  /*   15 */ 1510,
  /*===============*/
};

/******************************************************************************
���ٶ��½���
******************************************************************************/
static const uint16_t GaugesSpeedoMeterSegDecTable[] = 
{
  /*=================
    ��ʾ�� | ��  ��
  ---------+-------*/
  /*    0 */    90,
  /*    1 */   190,
  /*    2 */   290,
  /*    3 */   390,
  /*    4 */   490,
  /*    5 */   590,
  /*    6 */   690,
  /*    7 */   790,
  /*    8 */   890,
  /*    9 */   990,
  /*   10 */  1090,
  /*   11 */  1190,
  /*   12 */  1290,
  /*   13 */  1390,
  /*   14 */  1490,
  /*   15 */  1590,
};
              
#define   GAUGES_TOTAL_SPEEDOMETER_SEG      (sizeof(GaugesSpeedoMeterSegIncTable) / 2)

/******************************************************************************
ת�ٶ�������
******************************************************************************/
static const uint16_t GaugesTachoMeterSegIncTable[] = 
{
  /*=================
    ��ʾ�� | ת  ��
  ---------+-------*/
  /*    0 */     0,
  /*    1 */   600,
  /*    2 */  1100,
  /*    3 */  1600,
  /*    4 */  2100,
  /*    5 */  2600,
  /*    6 */  3100,
  /*    7 */  3600,
  /*    8 */  4100,
  /*    9 */  4600,
  /*=== ============*/
};

/******************************************************************************
ת�ٶ��½���
******************************************************************************/
static const uint16_t GaugesTachoMeterSegDecTable[] = 
{
  /*=================
    ��ʾ�� | ת  ��
  ---------+-------*/
  /*    0 */   400,
  /*    1 */  900 ,
  /*    2 */  1400,
  /*    3 */  1900,
  /*    4 */  2400,
  /*    5 */  2900,
  /*    6 */  3400,
  /*    7 */  3900,
  /*    8 */  4400,
  /*    9 */  4900,
  /*===============*/
};

#define   GAUGES_TOTAL_TACHOMETER_SEG      (sizeof(GaugesTachoMeterSegIncTable) / 2)

/******************************************************************************
��ѹ1��������
******************************************************************************/
static const uint16_t GaugesGAS1IncTable[] = 
{
  /*=================
    ��ʾ�� | ��ѹ1
  ---------+-------*/
  /*    0 */   600,
  /*    1 */   872,
  /*    2 */  1144,
  /*    3 */  1401,
  /*    4 */  1658,
  /*    5 */  1945,
  /*    6 */  2233,
  /*    7 */  2505,
  /*    8 */  2777,
  /*    9 */  3049,
  /*   10 */  3321,
  /*   11 */  3593,
  /*   12 */  3865,
  /*   13 */  4110,
  /*   14 */  4500,
  /*=== ============*/
};

/******************************************************************************
��ѹ1���½���
******************************************************************************/
static const uint16_t GaugesGAS1DecTable[] = 
{
  /*=================
    ��ʾ�� | ��ѹ1
  ---------+-------*/
  /*    0 */   400,
  /*    1 */   672,
  /*    2 */   944,
  /*    3 */  1201,
  /*    4 */  1458,
  /*    5 */  1745,
  /*    6 */  2033,
  /*    7 */  2305,
  /*    8 */  2577,
  /*    9 */  2849,
  /*   10 */  3121,
  /*   11 */  3393,
  /*   12 */  3665,
  /*   13 */  3910,
  /*   14 */  4400,
  /*=== ============*/
};

#define   GAUGES_GAS1_SEG      (sizeof(GaugesGAS1IncTable) / 2)
/******************************************************************************
��ѹ2��������
******************************************************************************/
static const uint16_t GaugesGAS2IncTable[] = 
{
  /*=================
    ��ʾ�� | ��ѹ2
  ---------+-------*/
  /*    0 */   600,
  /*    1 */   872,
  /*    2 */  1144,
  /*    3 */  1401,
  /*    4 */  1658,
  /*    5 */  1945,
  /*    6 */  2233,
  /*    7 */  2505,
  /*    8 */  2777,
  /*    9 */  3049,
  /*   10 */  3321,
  /*   11 */  3593,
  /*   12 */  3865,
  /*   13 */  4110,
  /*   14 */  4500,
  /*=== ============*/
};

/******************************************************************************
ת�ٶ��½���
******************************************************************************/
static const uint16_t GaugesGAS2DecTable[] = 
{
   /*=================
    ��ʾ�� | ��ѹ2
  ---------+-------*/
  /*    0 */   400,
  /*    1 */   672,
  /*    2 */   944,
  /*    3 */  1201,
  /*    4 */  1458,
  /*    5 */  1745,
  /*    6 */  2033,
  /*    7 */  2305,
  /*    8 */  2577,
  /*    9 */  2849,
  /*   10 */  3121,
  /*   11 */  3393,
  /*   12 */  3665,
  /*   13 */  3910,
  /*   14 */  4400,
  /*=== ============*/
};

#define   GAUGES_GAS2_SEG      (sizeof(GaugesGAS2IncTable) / 2)

typedef struct
{
  uint16_t  VSpeedBackup;
  uint16_t  ESpeedBackup;
  uint8_t   VSpeedSeg;
  uint8_t   ESpeedSeg;
  uint16_t  GAS1Backup;
  uint16_t  GAS2Backup;
  uint8_t   GAS1Seg;
  uint8_t   GAS2Seg;
}GaugesCtrlStruct;

extern  GaugesCtrlStruct GaugesCtrl;

/***********************************��ͷ��ʾ����******************************/
void Gauges_ESpeed_Display_OFF(void);
void Gauges_VSpeed_Display_OFF(void);
void Gauges_Management_Service(void);
void Gauges_AirOne_Display_OFF(void);
void Gauges_AirTwo_Display_OFF(void);
#endif