#if !defined(_PRIVATE_H_20130115_)
#define _PRIVATE_H_20130115_

#define COORELATOIN_ANALYSIS_SURGE_1 0
#define COORELATOIN_ANALYSIS_SURGE_2 1


//#define  NULL_COMPANY
//#define  FIRSTSAIL_COMPANY
//#define  FUSING_COMPANY
//#define  XMJCO_COMPANY
//#define  JULI_COMPANY
//#define  JULG_COMPANY
//#define  XMJCO2_COMPANY
//#define  EASTJL_COMPANY
//#define  JIANZE_COMPANY
//#define  FIRSTEP_COMPANY
//#define  SPECIAL1_COMPANY
//#define  SPECIAL2_COMPANY
//#define  XIANDIAN_COMPANY


#define COMPANY_NAME_EX_NULL      0
#define COMPANY_NAME_EX_FIRSTSAIL 1
#define COMPANY_NAME_EX_FUSING    2
#define COMPANY_NAME_EX_XMJCO     3
#define COMPANY_NAME_EX_JULI      4
#define COMPANY_NAME_EX_JULG      5
#define COMPANY_NAME_EX_XMJCO2    6 //2012-09-18
#define COMPANY_NAME_EX_EASTJL    6
#define COMPANY_NAME_EX_FIRSTEP   7
#define COMPANY_NAME_EX_SPECIAL1  8
#define COMPANY_NAME_EX_SPECIAL2  9
#define COMPANY_NAME_EX_XIANDIAN  10
#define COMPANY_NAME_EX_ZHANGYOU  11
#define COMPANY_NAME_EX_JOHNSON   12


#define PLC_NAME_NULL      0
#define PLC_NAME_FIRSTSAIL  1
#define PLC_NAME_FUSING     2
#define PLC_NAME_XMJCO      3
#define PLC_NAME_JULI       4
#define PLC_NAME_JULG       5
#define PLC_NAME_XMJCO2     6 //2012-09-18
#define PLC_NAME_EASTJL     6
#define PLC_NAME_FIRSTEP    7
#define PLC_NAME_SPECIAL1   8
#define PLC_NAME_SPECIAL2   9
#define PLC_NAME_XIANDIAN1  10
#define PLC_NAME_XIANDIAN2  11
#define PLC_NAME_MULTI3     12
#define PLC_NAME_TAISHANG1  13
#define PLC_NAME_TAISHANG2  14
#define PLC_NAME_DIVIDE     15
#define PLC_NAME_ZHANGYOU1  16
#define PLC_NAME_ZHANGYOU2        17
#define PLC_NAME_JOHNSON1         18
#define PLC_NAME_JOHNSON_MULTI3   19
#define PLC_NAME_ASSEMBLY_MULTI   20
#define PLC_NAME_XMJCO3           21 //2019-06-19
#define PLC_NAME_ASSEMBLY_MULTI2  22 //2019-07-12
#define PLC_NAME_CHANNEL8         23 //2021-02-23

//#define PLC_NAME_PASSMARK  13
//=====================================================
#define MANUFA_RELAY_ORMON      0 // 20
#define MANUFA_RELAY_NAIS       1 // 12
#define MANUFA_RELAY_NEC        2 // 15
#define MANUFA_RELAY_WANGLI     3 // 25
#define MANUFA_RELAY_SONGCHUANG 4 // 12
#define MANUFA_RELAY_ZETTLER    5 // 25
#define MANUFA_RELAY_SLOWEST    6 // 40mS
#define MANUFA_RELAY_SLOWEST2   7 // 60mS
#define MANUFA_RELAY_MY4        8 // 120mS
#define MANUFA_RELAY_KMYT       9 // 250mS
#define MANUFA_RELAY_REED1      10 //5
#define MANUFA_RELAY_REED2      11 //3
#define MANUFA_RELAY_RELAY1     12 //18
#define MANUFA_RELAY_RELAY2     13 //10
#define MANUFA_RELAY_RELAY3     14 //8
#define MANUFA_RELAY_RELAY4     15 //6

#define PVHS70_STYLE_NULL    0
#define PVHS70_STYLE_COM1    1
#define PVHS70_STYLE_COM2    2
#define PVHS70_STYLE_COM3    3
#define PVHS70_STYLE_COM4    4
#define PVHS70_STYLE_IO      5
#define PVHS70_STYLE_DA      6
#define PVHS70_STYLE_COM1_FB 7

#define PVHS70_BROKE_NULL      0
#define PVHS70_BROKE_SOFTWARE1 1
#define PVHS70_BROKE_SOFTWARE2 2
#define PVHS70_BROKE_HARDWARE  3


#define BOARD_500V_NULL     0
#define BOARD_500V_PROGRAM  1
#define BOARD_500V_SINGLE   2

#define HIGHVOL_MODE_SINGLE 0
#define HIGHVOL_MODE_2P     1
#define HIGHVOL_MODE_3P     2
#define HIGHVOL_MODE_3P_EX  3
//=====================================================


#define AROUND_STATE_CCW  0
#define AROUND_STATE_CW   1
#define AROUND_STATE_STOP 2
//===========================================
#define    VALUE_STYLE_NULL                0x0000
#define    VALUE_STYLE_TRUE                0x0001
#define    VALUE_STYLE_YESNO               0x0FE1
#define    VALUE_STYLE_POSI_NEGA           0x0FE2
#define    VALUE_STYLE_ARMATURE_BAR        0x0FE3
#define    VALUE_STYLE_HIPOT               0x0FE4
#define    VALUE_STYLE_INSULATION          0x0FE5
#define    VALUE_STYLE_SURGE               0x0FE6
#define    VALUE_STYLE_ARMATURE_WELD       0x0FE7
#define    VALUE_STYLE_RESISTANCE          0x0FE8
#define    VALUE_STYLE_NOT_LIMIT           0x0FE9
#define    VALUE_STYLE_LOWBOOT             0x0FEA
#define    VALUE_STYLE_NOLOAD              0x0FEB
#define    VALUE_STYLE_SHORT_RESISTANCE    0x0FEC
#define    VALUE_STYLE_ONLY_MIN            0x0FED
#define    VALUE_STYLE_ONLY_MAX            0x0FEE
#define    VALUE_STYLE_YAMING              0x0FEF
#define    VALUE_STYLE_NOBRUSH_VOLTAGE     0x0FF0
#define    VALUE_STYLE_CHARACTERISTIC      0x0FF1
#define    VALUE_STYLE_HIPOT_DC            0x0FF2
#define    VALUE_STYLE_SURGE_EX            0x0FF3
#define    VALUE_STYLE_LEAKING             0x0FF4
#define    VALUE_STYLE_NOISE_MONITOR       0x0FF5
#define    VALUE_STYLE_STAFF               0x0FF6
#define    VALUE_STYLE_SELFNIANXIAN        0x0FF7
#define    VALUE_STYLE_YAMING_PHASE        0x0FF8
#define    VALUE_STYLE_PREVTEST            0x0FF9
#define    VALUE_STYLE_INDUCTANCE          0x0FFA
#define    VALUE_STYLE_ARC                 0x0FFB
#define    VALUE_STYLE_HIPOT_DYNASTIC      0x0FFC
#define    VALUE_STYLE_CAPACITANCE         0x0FFD
#define    VALUE_STYLE_TUILALI             0x0FFE
#define    VALUE_STYLE_ANGLE180_JUDGE      0x0FFF
#define    VALUE_STYLE_LOAD                0x1000
#define    VALUE_STYLE_CAPACITANCE_LEAKING 0x1001

#define    VALUE_STYLE_SURGE_DIFF          0x1002
#define    VALUE_STYLE_RESISTANCE_DIFF     0x1003
#define    VALUE_STYLE_INDUCTANCE_DIFF     0x1004
#define    VALUE_STYLE_CAPACITANCE_DIFF    0x1005
#define    VALUE_STYLE_WELD_DIFF           0x1006

#define    VALUE_STYLE_SURGE_DELTA         0x1007
#define    VALUE_STYLE_RESISTANCE_DELTA    0x1008
#define    VALUE_STYLE_INDUCTANCE_DELTA    0x1009
#define    VALUE_STYLE_CAPACITANCE_DELTA   0x100A
#define    VALUE_STYLE_WELD_DELTA          0x100B


#define    VALUE_STYLE_NOLOAD2             0x100C
#define    VALUE_STYLE_NOLOAD3             0x100D
//#define    VALUE_STYLE_LOAD                0x100E
#define    VALUE_STYLE_LOAD2               0x100F
#define    VALUE_STYLE_LOAD3               0x1010
#define    VALUE_STYLE_RIPPLE              0x1011
#define    VALUE_STYLE_RIPPLE2             0x1012
#define    VALUE_STYLE_RIPPLE3             0x1013

#define    VALUE_STYLE_NOISE               0x1014
#define    VALUE_STYLE_RESERVED1           0x1015
#define    VALUE_STYLE_RESERVED2           0x1016
#define    VALUE_STYLE_RESERVED3           0x1017

#define    VALUE_STYLE_SURGE_EX1          0x2010
#define    VALUE_STYLE_SURGE_EX2          0x2011
#define    VALUE_STYLE_SURGE_EX3          0x2012
#define    VALUE_STYLE_SURGE_EX4          0x2013
#define    VALUE_STYLE_SURGE_EX5          0x2014

#define    VALUE_STYLE_YAMING_EX1          0x2015
#define    VALUE_STYLE_YAMING_EX2          0x2016
#define    VALUE_STYLE_YAMING_EX3          0x2017
#define    VALUE_STYLE_YAMING_EX4          0x2018
#define    VALUE_STYLE_YAMING_EX5          0x2019

#define    VALUE_STYLE_ANGLE180_DELTA      0x201A
#define    VALUE_STYLE_ANGLE180_DELTA2     0x201B
#define    VALUE_STYLE_ANGLE180_DELTA3     0x201C

#define    VALUE_STYLE_YAMING_TRIGGER      0x201D
#define    VALUE_STYLE_YAMING_TRIGGER2     0x201E
#define    VALUE_STYLE_YAMING_TRIGGER3     0x201F
#define    VALUE_STYLE_YAMING_TRIGGER4     0x2020

//===========================================
#define DATAMAP_NULL  0
#define DATAMAP_PASS  1
#define DATAMAP_FAIL  2
//===========================================
#define  MAX_TEST_ITEM_COUNT            (196+3)//128
//===========================================
#define SPC_MOVE_STYLE_NORMAL        0
#define SPC_MOVE_STYLE_SAMPLING      1

typedef struct _tagSTATICGRAPHICPIE
{
	WORD  wLineCount;
	WORD  wSort;
	WORD  wSelect;
	float *pfData;
	BOOL  bDraw;
}STATICGRAPHICPIE;

#define  TEST_NULL   0x0
#define  TEST_NORMAL 0x0
#define  TEST_RETRY  0x1
#define  TEST_SKIP   0x2
#define  TEST_NO     0x3
#define  TEST_CANCEL 0x4

#define SINGLE_ERROR_VALUE    987.980f
#define BROKE_ERROR_VALUE     987.980f
#define FLOW_ERROR_VALUE      987.982f
#define OVER_ERROR_VALUE      987.983f
#define OTHER_ERROR_VALUE     987.984f

#define SINGLE2_ERROR_VALUE    -987.980f
#define BROKE2_ERROR_VALUE     -987.980f
#define FLOW2_ERROR_VALUE      -987.982f
#define OVER2_ERROR_VALUE      -987.983f
#define OTHER2_ERROR_VALUE     -987.984f

#define MAX_TEST_GROUP                30
#define MAX_TEST_GROUP_STRING_LENGTH  32
#define MAX_MODIFY_ARRAY              80

//---------------------------------------------------
//D7,  D6,  D5,  D4,  D3, D2, D1, D0
//SC1  SC0  RW1  RW0  M2  M1  M0  BCD
#define  CHANNEL0_TYPE   0x30 //00110000
#define  CHANNEL1_TYPE   0x70 //01110000
#define  CHANNEL2_TYPE   0xB0 //10110000

#define  SAIL_COUNTER0_PCL711B(nBase)         (nBase+0x00)
#define  SAIL_COUNTER1_PCL711B(nBase)         (nBase+0x01)
#define  SAIL_COUNTER2_PCL711B(nBase)         (nBase+0x02)
#define  SAIL_COUNTER_CONTROL_PCL711B(nBase)  (nBase+0x03)
#define  SAIL_AD_L_PCL711B(nBase)             (nBase+0x04)
#define  SAIL_AD_H_PCL711B(nBase)             (nBase+0x05)
#define  SAIL_DI_L_PCL711B(nBase)             (nBase+0x06)
#define  SAIL_DI_H_PCL711B(nBase)             (nBase+0x07)
#define  SAIL_CLEAR_IRQ_PCL711B(nBase)        (nBase+0x08)
#define  SAIL_GAIN_PCL711B(nBase)             (nBase+0x09)
#define  SAIL_CHANNEL_PCL711B(nBase)          (nBase+0x0A)
#define  SAIL_MODE_PCL711B(nBase)             (nBase+0x0B)
#define  SAIL_SOFTWARE_PCL711B(nBase)         (nBase+0x0C)
#define  SAIL_DO_L_PCL711B(nBase)             (nBase+0x0D)
#define  SAIL_DO_H_PCL711B(nBase)             (nBase+0x0E)
//----------------------------------------------------
#define  SAIL_GAIN_5V00_PCL711B         0x00  //+-10V
#define  SAIL_GAIN_5V01_PCL711B         0x01  //+-5V
#define  SAIL_GAIN_5V02_PCL711B         0x02  //+-2.5V
#define  SAIL_GAIN_5V04_PCL711B         0x04  //+-1.25V
#define  SAIL_GAIN_5V08_PCL711B         0x08  //+-0.625V
#define  SAIL_GAIN_5V16_PCL711B         0x10  //+-0.3125V
//-----------------------------------------------

#define LOWBOOT_NULL    0
#define LOWBOOT_TESTING 1
#define LOWBOOT_NORUN   2
#define LOWBOOT_RUN     3
#define LOWBOOT_OK      4
#define LOWBOOT_FAIL    5

#define NOISE_MONITOR_FAIL 0
#define NOISE_MONITOR_PASS 1


#define TESTMAP_ARMATURE_200 0
#define TESTMAP_ARMATURE_210 1
#define TESTMAP_STATOR_400   2
#define TESTMAP_FS_300_CX    3
#define TESTMAP_FS_750_CX2   4
#define TESTMAP_FS_750       5
#define TESTMAP_FS_750_CX    6
#define TESTMAP_VBTIONFF_700 7
#define TESTMAP_VBTIONFF_500 8
#define TESTMAP_FS_900_CX    9
#define TESTMAP_FS_800_CX    0xA
#define TESTMAP_FS_780_CX    0xB
#define TESTMAP_FS_1500_CX   0xC
#define TESTMAP_FS_1800_CX   0xD
#define TESTMAP_FS_550_CX    0xE
#define TESTMAP_FS_OTHER_CX2 0xF

struct TESTMAP_STRUCT
{
	DWORD dwFlags;
	DWORD dwTotalLength;
	WORD  wStyle;
	WORD  wItemCount;
	DWORD  dwMapOffset;

};



#define  TEMP_TMP35 0
#define  TEMP_TMP36 1
#define  TEMP_TMP37 2

#define TESTMASK_ALL              0
#define TESTMASK_HIPOT            1
#define TESTMASK_INSULATION       2
#define TESTMASK_RESISTANCE_BAR   3
#define TESTMASK_SURGE            4
#define TESTMASK_RESISTANCE_SURGE 5
#define TESTMASK_RESISTANCE_JUMP  6
#define TESTMASK_AROUND_MAG       7
#define TESTMASK_CAPACITANCE      8
#define TESTMASK_CUREENT          9
#define TESTMASK_INDUCTANCE       10
#define TESTMASK_RESERVED_2       11

#if !defined(CONST_SINGLE_T)
	#define CONST_SINGLE_T 3.14159f
#endif


#if !defined(CONST_DOUBLE_T)
	#define CONST_DOUBLE_T 3.14159265359
#endif


#if !defined(MIN)
	#define MIN(a, b) (((a) < (b)) ?  (a) : (b))
#endif
#if !defined(MAX)
	#define MAX(a, b) (((a) > (b)) ?  (a) : (b))
#endif

#define ITEM_BEWEEN(a, b)  ((b >= mAfxEnvironmental.fsTest[a][0] && b <= mAfxEnvironmental.fsTest[a][1]) ? 1 : 0)
#endif
