#ifndef __ONECHIP_DEVINF_DEFINE_H_
#define __ONECHIP_DEVINF_DEFINE_H_


#include "oneChip_basic_define.h"
#include "state_mini.h"

typedef enum {
	ONECHIP_DEV_STATE_NONE,
	ONECHIP_DEV_STATE_POWEROFF,
	ONECHIP_DEV_STATE_OFFLINE,
	ONECHIP_DEV_STATE_NEEDINIT,
	ONECHIP_DEV_STATE_RUNNING,
	ONECHIP_DEV_STATE_IDLE,
	ONECHIP_DEV_STATE_ERR,
}ONECHIP_DEV_STATE_TYPE;



enum SYS_STATE_DEF
{
    SYS_STATE_PREPARE,
    SYS_STATE_READY,
    SYS_STATE_CHECK,
    SYS_STATE_RUNING,
    SYS_STATE_WORKEND,
    SYS_STATE_ERROR_HM = 0xfe,//人为故障
    SYS_STATE_ERROR_HW = 0xff //设备故障
};


#define ORG_NAME_MAX
#define SN_MAX       EEPROM_ADDR_DEV_SERIAL_LEN 
#define WIFI_AP_NAME_MAX_LEN  64
#define WIFI_AP_PWD_MAX_LEN  32

typedef enum {
	MINI7_SUB_FUN_MOTOR = 1,
	MINI7_SUB_FUN_HEATER1 ,
	MINI7_SUB_FUN_HEATER2 
}ONECHIP_SUB_FUN_TYPE;


typedef struct {
	unsigned int  desversion;  				/*描述版本，预留*/	
	unsigned char ORGName[8]; 	/*组织名称*/
	unsigned int  deveice_type;	 			/*设备类型*/
	unsigned int  deveice_ver;	 			/*设备批次*/
	unsigned char serialNumber[16];			
	unsigned int  hardware_type;			/*硬件类型*/
	unsigned int  hardware_ver;				/*硬件批次*/	
	unsigned int  structure_type;			/*结构类型*/		
	unsigned int  structure_ver;			/*结构批次*/		
	unsigned int  firstRunFlag;				/*硬件批次*/		
	unsigned int  updataFlag;				/*硬件批次*/		
}DeviceBasicInfdef,*pDeviceBasicInfdef;

typedef struct {
	DeviceBasicInfdef devdesc;
	unsigned int  ms10_flag;
	unsigned int  ms_conter;	
	unsigned int  conter10ms;		
	unsigned int  deal_espFlag;		
	unsigned int  reccmd_conter;	
	unsigned int  s1_flag;			
	unsigned int  s10_flag;		
	unsigned int  test_flag;	
	unsigned int  sysLoad_flag;	
	unsigned int  trigger_Tick;	
	unsigned int  int_ADC;	
	unsigned int  resetByIwdg;	
	unsigned int  connectTcpFlag;		
	unsigned int  pc_link_timeout;	
	unsigned int  pc_channel_recv;
	unsigned int  samp_flag;
	unsigned int  system_OnlineFlag;
	
	void * debugUart;	
	void * scannerUart;
	void * ESPUart;
	void * pb_Queue;		
	uint16_t  signal_trigger_pin;	
	void * signal_trigger_port;	
	uint16_t  com_led_pin;	
	void * com_led_port;	
	uint16_t  rgb_band_pin;	
	void * rgb_band_port;
	uint16_t  run_led_pin;	
	void * run_led_port;	
	uint8_t amplifState;
	uint8_t lysisState;
	uint8_t updateSt;
	uint8_t amplif_error_code; //错误码 
	uint8_t lysis_error_code; //错误码 
	uint8_t updateError;
	uint8_t updateQR;
	
	ProcessStateMachine_t psmMaster;
	ProcessStateMachine_t psmSlave;

	float lysis_offset;
	float lysis_overHeat;
	float lysis_overHeatTime;
	float lysis_Kp;
	float lysis_Ki;
	float lysis_Kd;
	float    presetTempVal;   //拉升温度
	uint32_t presetTempTime;   //拉升保持时间
	float    setTempVal;      //设定温度
	float    holdTemp;       //稳定温度
	float	tempOffset;		//温度补偿
	uint32_t preHeatTime;	//上电预热时间,min
	float readyTemp;		//就绪温度
	uint32_t log_level;		//日志等级
	uint32_t skip_CheckOrRun;		//插入光变化检测
	float adjtemp;		//调整温度
	float timeinner;
    float swingspeed;
    float swingtime;
    float swingtimeRight;
    float swingtimePause;
    float runLoopTime;
    float runLoopSpeed;
	char wifiname[WIFI_AP_NAME_MAX_LEN];
	char password[WIFI_AP_PWD_MAX_LEN];
	char TCP_IP_Addr[16];
	unsigned char TCP_IP_PORT[8];
	char SN[8];
	uint32_t checksum;		//插入光变化检测
	
	
}oneChipSysdef,*poneChipSysdef;


ONECHIP_GLOBAL_DEF oneChipSysdef sysinf;


#endif //__ONECHIP_BASIC_DEFINE_H_

