/*--------------------------------------------------------------------------------------
*  @file     ParameterSet.c
*  @author   ZhangJing
*  @version  base on stm32f0x   
*  @date     2015.09.11
*  @brief    参数设置数据处理
---------------------------------------------------------------------------------------*/
#include "stm32f10x_gpio.h"
#include "TypeDefine.h"
#include "FlashSetup.h"
#include "FM31256.h"
#include "ParameterSet.h"

uint8_t paramRecordBuf[PARAMETER_DATA_BYTES];//参数数据数组
uint8_t paramTransferBuf[PARAMETER_DATA_BYTES];//中转参数
/*************************************************************************************
*  Function:	ReadParameterRecord					                                                           
*  Object:		读取参数数据
*  输入:			无
*  输出:			无	                                     
*  备注:			1、根据地址PARAMSET_DATA_START_ADDR读取参数存储区，并将值赋给setParamInfo结构体       
*							2uint8_t tempIndex = 0;临时索引变量
*							3、uint8_t tempRes = 0;操作返回状态
**************************************************************************************/
void ReadParameterRecord( void )
{
	uint8_t tempIndex = 0;
//	uint8_t tempRes = 0;
	uint8_t i,a=0;
	
	FlashReadOperate( paramRecordBuf,PARAMETER_DATA_BYTES,PARAMSET_DATA_START_ADDR );
	
	for( i = 0; i < 16 ; i++ )
	{
		//setParamInfo.deviceID[i] = paramRecordBuf[tempIndex++];
		a=paramRecordBuf[tempIndex++];
	}
	
	setParamInfo.password[0] = paramRecordBuf[tempIndex++];
	setParamInfo.password[1] = paramRecordBuf[tempIndex++];
	setParamInfo.password[2] = paramRecordBuf[tempIndex++];
	for( i = 0; i < 3; i++ )
	{
		setParamInfo.password[i] = 0;
	}
	/*
	setParamInfo.pwmSetValue[0] = paramRecordBuf[tempIndex++];
	setParamInfo.pwmSetValue[1] = paramRecordBuf[tempIndex++];
	setParamInfo.pwmSetValue[2] = paramRecordBuf[tempIndex++];
	setParamInfo.pwmSetValue[3] = paramRecordBuf[tempIndex++];
	for( i = 0; i < 4; i++ )
	{
		if( setParamInfo.pwmSetValue[i] > 9 )
		{
			setParamInfo.pwmSetValue[i] = 0;
		}
	}
	runParamInfo.pwmSetValue = setParamInfo.pwmSetValue[0];
	runParamInfo.pwmSetValue *= 10;
	runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[1];
	runParamInfo.pwmSetValue *= 10;
	runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[2];
	runParamInfo.pwmSetValue *= 10;
	runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[3];
	
	if( runParamInfo.pwmSetValue < 200 || runParamInfo.pwmSetValue >1000)
	{
		runParamInfo.pwmSetValue = 200;
	}
	runParamInfo.pwmSetValue = 1000;//test*/
	
	
	for( i = 0; i < 9 ; i++ )//住院号最大值为9位
	{
		paramTransferBuf[i] = paramRecordBuf[tempIndex++];
//		paramTransferBuf[i]=0;
		setParamInfo.hospitalNO[i]=paramTransferBuf[i];
	}	
	for( i = 0 ; i < 3; i++ )//病区最大值为3位
	{
		paramTransferBuf[i]  = paramRecordBuf[tempIndex++];
//		paramTransferBuf[i]=0;
		setParamInfo.sickroom[i] =paramTransferBuf[i];
	}
	for( i = 0 ; i < 3 ; i++ )//病床最大值为3位
	{
		paramTransferBuf[i]  = paramRecordBuf[tempIndex++];
//		paramTransferBuf[i]=0;
		setParamInfo.bedNO[i]=paramTransferBuf[i];
	}
	
	/*for( i = 0; i < 10 ; i++ )//住院号最大值为10位
	{
		setParamInfo.hospitalNO[i] = paramRecordBuf[tempIndex++];
		if( setParamInfo.hospitalNO[i] > 9 )
		{
			setParamInfo.hospitalNO[i] = 0;
		}
	}	
	
	for( i = 0 ; i < 3; i++ )//病区最大值为3位
	{
		setParamInfo.sickroom[i] = paramRecordBuf[tempIndex++];
		if( setParamInfo.sickroom[i] > 9 )
		{
			setParamInfo.sickroom[i] = 0;
		}
	}	
	
	for( i = 0 ; i < 3 ; i++ )//病床最大值为3位
	{
		setParamInfo.bedNO[i] = paramRecordBuf[tempIndex++];
		if( setParamInfo.bedNO[i] > 9 )
		{
			setParamInfo.bedNO[i] = 0;
		}
	}*/	
	
	setParamInfo.totalDose = paramRecordBuf[tempIndex++];
	setParamInfo.totalDose <<= 8;
	setParamInfo.totalDose += paramRecordBuf[tempIndex++];
	if( setParamInfo.totalDose > 999 )
	{
		setParamInfo.totalDose = 0;
	}
 	
	setParamInfo.firstDose = paramRecordBuf[tempIndex++];
	setParamInfo.firstDose <<= 8;
	setParamInfo.firstDose += paramRecordBuf[tempIndex++];	
	if( setParamInfo.firstDose > 99 )
	{
		setParamInfo.firstDose = 0;
	}
	
	setParamInfo.continueDose1 = paramRecordBuf[tempIndex++];
	setParamInfo.continueDose1 <<= 8;
	setParamInfo.continueDose1 += paramRecordBuf[tempIndex++];
	if( setParamInfo.continueDose1 > 500 )
	{
		setParamInfo.continueDose1 = 0;
	}
	
	setParamInfo.superaddition1 = paramRecordBuf[tempIndex++];
	setParamInfo.superaddition1 <<= 8;
	setParamInfo.superaddition1 += paramRecordBuf[tempIndex++];
	if( setParamInfo.superaddition1 > 100 )
	{
		setParamInfo.superaddition1 = 0;
	}
	
	setParamInfo.lockTime1 = paramRecordBuf[tempIndex++];
	setParamInfo.lockTime1 <<= 8;
	setParamInfo.lockTime1 += paramRecordBuf[tempIndex++];
	if( setParamInfo.lockTime1 >= 100 )
	{
		setParamInfo.lockTime1 = 1;
	}
	
	setParamInfo.limitDose1 = paramRecordBuf[tempIndex++];
	setParamInfo.limitDose1 <<= 8;
	setParamInfo.limitDose1 += paramRecordBuf[tempIndex++];
	if( setParamInfo.limitDose1 > 200 )
	{
		setParamInfo.limitDose1 = 90;
	}
	
	setParamInfo.continueDose2 = paramRecordBuf[tempIndex++];
	setParamInfo.continueDose2 <<= 8;
	setParamInfo.continueDose2 += paramRecordBuf[tempIndex++];
	if( setParamInfo.continueDose2 > 99 )
	{
		setParamInfo.continueDose2 = 0;
	}
	
	setParamInfo.superaddition2 = paramRecordBuf[tempIndex++];
	setParamInfo.superaddition2 <<= 8;
	setParamInfo.superaddition2 += paramRecordBuf[tempIndex++];
	if( setParamInfo.superaddition2 > 99 )
	{
		setParamInfo.superaddition2 = 0;
	}
	
	setParamInfo.lockTime2 = paramRecordBuf[tempIndex++];
	setParamInfo.lockTime2 <<= 8;
	setParamInfo.lockTime2 += paramRecordBuf[tempIndex++];
	if( ( setParamInfo.lockTime2 > 99 ) || ( setParamInfo.lockTime2 == 0 ) )
	{
		setParamInfo.lockTime2 = 1;
	}
	
	setParamInfo.limitDose2 = paramRecordBuf[tempIndex++];
	setParamInfo.limitDose2 <<= 8;
	setParamInfo.limitDose2 += paramRecordBuf[tempIndex++];
	if( setParamInfo.limitDose2 > 999 )
	{
		setParamInfo.limitDose2 = 0;
	}
	
	EngineeringModeValue.sickroomQty = paramRecordBuf[tempIndex++];
	if( ( EngineeringModeValue.sickroomQty < 1 ) || ( EngineeringModeValue.sickroomQty > 3 ) )
	{
		 EngineeringModeValue.sickroomQty = 3;
	}
	verifyInfo.sickroom = 0;
	for( i = 0 ; i < ( EngineeringModeValue.sickroomQty - 1 ) ; i++ )
	{
		verifyInfo.sickroom += setParamInfo.sickroom[i];
		verifyInfo.sickroom *= 10;
	}
	verifyInfo.sickroom += setParamInfo.sickroom[i];//最后一位不用乘10倍
	
	EngineeringModeValue.networkState = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.networkState > ENGINEERINGMODE_OFF )
	{
		EngineeringModeValue.networkState = 0;//0开1关，默认开
	}
	
	EngineeringModeValue.bedNOQty = paramRecordBuf[tempIndex++];
	if( ( EngineeringModeValue.bedNOQty < 1 ) || ( EngineeringModeValue.bedNOQty > 3 ) )
	{
		 EngineeringModeValue.bedNOQty = 3;
	}
	verifyInfo.bedNO = 0;
	for( i = 0 ; i < ( EngineeringModeValue.bedNOQty - 1 ) ; i++ )
	{
		verifyInfo.bedNO += setParamInfo.bedNO[i];
		verifyInfo.bedNO *= 10;
	}	
	verifyInfo.bedNO += setParamInfo.bedNO[i];
	
	EngineeringModeValue.evaluateState = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.evaluateState > 1 )
	{
		EngineeringModeValue.evaluateState = 0;//0开1关，默认开
	}
	
	EngineeringModeValue.selfcontrol = paramRecordBuf[tempIndex++];
	EngineeringModeValue.selfcontrol <<= 8;
	EngineeringModeValue.selfcontrol += paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.selfcontrol > 100 )
	{
		EngineeringModeValue.selfcontrol = 100;
	}
	
	EngineeringModeValue.seachState = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.seachState > 1 )
	{
		EngineeringModeValue.seachState = 0;//0开1关，默认开
	}
	
	EngineeringModeValue.hospitalNOQty = paramRecordBuf[tempIndex++];
	if( ( EngineeringModeValue.hospitalNOQty < 1 ) || ( EngineeringModeValue.hospitalNOQty > 10 ) )
	{
		 EngineeringModeValue.hospitalNOQty = 9;
	}
	verifyInfo.hospitalNO = 0;
	for( i = 0 ; i < ( EngineeringModeValue.hospitalNOQty - 1 ) ; i++ )
	{
		verifyInfo.hospitalNO += setParamInfo.hospitalNO[i];
		verifyInfo.hospitalNO *= 10;
	}
	verifyInfo.hospitalNO += setParamInfo.hospitalNO[i];//最后一位不用乘10倍
	
	EngineeringModeValue.passwordState = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.passwordState > ENGINEERINGMODE_OFF )
	{
		EngineeringModeValue.passwordState = ENGINEERINGMODE_ON;//0开1关，默认开
	}
	
	EngineeringModeValue.deviceAlarm = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.deviceAlarm > 1 )
	{
		EngineeringModeValue.deviceAlarm = 0;//0开1关，默认开
	}
	
	EngineeringModeValue.silenceState = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.silenceState > 1 )
	{
		EngineeringModeValue.silenceState = 0;//0开1关，默认开
	}
	
	EngineeringModeValue.bubbleAlarm = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.bubbleAlarm > 1 )
	{
		EngineeringModeValue.bubbleAlarm = 0;//0开1关，默认开
	}
	
	EngineeringModeValue.closedState = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.closedState > 1 )
	{
		EngineeringModeValue.closedState = 0;//0开1关，默认开
	}
	
	EngineeringModeValue.automatic = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.automatic > 1 )
	{
		EngineeringModeValue.automatic = 1;//0开1关，默认关
	}
	
	EngineeringModeValue.jamAlarm = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.jamAlarm > 1 )
	{
		EngineeringModeValue.jamAlarm = 0;//0开1关，默认开
	}
	
	//---------增加压力显示开关-------------------------
	EngineeringModeValue.pressure_switch = paramRecordBuf[tempIndex++];
	if( EngineeringModeValue.pressure_switch > 1 )
	{
		EngineeringModeValue.pressure_switch = 0;	//0开1关，默认开
	}
	
	/*************增加测试开关***************/
	EngineeringModeValue.test = paramRecordBuf[tempIndex++];
	if(EngineeringModeValue.test > 1)
	{
		EngineeringModeValue.test = 0;				//0开1关，默认开
	}
/*	if(paramRecordBuf[PARAMETER_DATA_BYTES-1] == 1)
	{
		
	}*/
}

/*************************************************************************************
*  Function:	WriteParameterRecord					                                                           
*  Object:		写入参数数据
*  输入:			无
*  输出:			无	                                     
*  备注:			1、将setParamInfo结构体中的参数赋值给paramRecordBuf数组，并进行flash存储      
*							2uint8_t tempIndex = 0;临时索引变量
**************************************************************************************/
void WriteParameterRecord( void )
{
	uint8_t tempIndex = 0;
	uint8_t i;
	for( i = 0; i < 16 ; i++ )
	{
		paramRecordBuf[tempIndex++] = setParamInfo.deviceID[i];
	}
	realTimeData.deviceID = 0;
	for( i = 0; i < 15 ; i++ )
	{
		realTimeData.deviceID += setParamInfo.deviceID[i];
		realTimeData.deviceID *= 10;
	}
	realTimeData.deviceID += setParamInfo.deviceID[15];
	
	paramRecordBuf[tempIndex++] = setParamInfo.password[0];
	paramRecordBuf[tempIndex++] = setParamInfo.password[1];
	paramRecordBuf[tempIndex++] = setParamInfo.password[2];
	/*
	paramRecordBuf[tempIndex++] = setParamInfo.pwmSetValue[0];
	paramRecordBuf[tempIndex++] = setParamInfo.pwmSetValue[1];
	paramRecordBuf[tempIndex++] = setParamInfo.pwmSetValue[2];
	paramRecordBuf[tempIndex++] = setParamInfo.pwmSetValue[3];
	
	runParamInfo.pwmSetValue = setParamInfo.pwmSetValue[0];
	runParamInfo.pwmSetValue *= 10;
	runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[1];
	runParamInfo.pwmSetValue *= 10;
	runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[2];
	runParamInfo.pwmSetValue *= 10;
	runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[3];*/
	
	for( i = 0 ; i < 9 ; i++ )
	{
		if( i < EngineeringModeValue.hospitalNOQty )
		{
			paramRecordBuf[tempIndex++] = setParamInfo.hospitalNO[i];
		}
		else
		{
			paramRecordBuf[tempIndex++] = 0;
		}
	}
	
	for( i = 0 ; i < 3 ; i++ )
	{
		if( i < EngineeringModeValue.sickroomQty )
		{
			paramRecordBuf[tempIndex++] = setParamInfo.sickroom[i];
		}
		else
		{
			paramRecordBuf[tempIndex++] = 0;
		}
	}
	for( i = 0 ; i < 3 ; i++ )
	{
		if( i < EngineeringModeValue.bedNOQty )
		{
			paramRecordBuf[tempIndex++] = setParamInfo.bedNO[i];
		}
		else
		{
			paramRecordBuf[tempIndex++] = 0;
		}
	}
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.totalDose & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.totalDose & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.firstDose & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.firstDose & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.continueDose1 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.continueDose1 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.superaddition1 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.superaddition1 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.lockTime1 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.lockTime1 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.limitDose1 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.limitDose1 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.continueDose2 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.continueDose2 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.superaddition2 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.superaddition2 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.lockTime2 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.lockTime2 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.limitDose2 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.limitDose2 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = EngineeringModeValue.sickroomQty;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.networkState;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.bedNOQty;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.evaluateState;
	paramRecordBuf[tempIndex++] = (uint8_t)( ( EngineeringModeValue.selfcontrol & 0xff00 ) >>8 );
	paramRecordBuf[tempIndex++] = (uint8_t)( EngineeringModeValue.selfcontrol & 0x00ff );
	paramRecordBuf[tempIndex++] = EngineeringModeValue.seachState;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.hospitalNOQty;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.passwordState;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.deviceAlarm;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.silenceState;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.bubbleAlarm;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.closedState;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.automatic;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.jamAlarm;
	paramRecordBuf[tempIndex++] = EngineeringModeValue.pressure_switch; //增加压力显示开关
	paramRecordBuf[tempIndex++] = EngineeringModeValue.test;			//新增测试开关
	
	for(; tempIndex < PARAMETER_DATA_BYTES ; tempIndex++ )
	{
		paramRecordBuf[tempIndex] = 0xff;
	}
	paramRecordBuf[126] = 0x0A;
 	FlashWriteOperate( paramRecordBuf,PARAMETER_DATA_BYTES,PARAMSET_DATA_START_ADDR );	
// 	Write_Multi31256RAM( SYSPARMA31256_DATA_START_ADDR ,paramRecordBuf,PARAMETER_DATA_BYTES );
}

/*************************************************************************************
*  Function:	WriteInitParameterRecord					                                                           
*  Object:		写入参数数据
*  输入:			工程开关置位
*  输出:			无	                                     
*  备注:			
**************************************************************************************/
void WriteInitParameterRecord( void )
{
	uint8_t tempIndex = 0;
	uint8_t i;
	for( i = 0; i < 16 ; i++ )
	{
		setParamInfo.deviceID[i] = 0;
		paramRecordBuf[tempIndex++] = setParamInfo.deviceID[i];
	}
	realTimeData.deviceID = 0;
	for( i = 0; i < 15 ; i++ )
	{
		setParamInfo.deviceID[i] = 0;
		realTimeData.deviceID += setParamInfo.deviceID[i];
		realTimeData.deviceID *= 10;
	}
	realTimeData.deviceID += setParamInfo.deviceID[15];
	setParamInfo.password[0] = 0;
	setParamInfo.password[1] = 0;
	setParamInfo.password[2] = 0;
	paramRecordBuf[tempIndex++] = setParamInfo.password[0];
	paramRecordBuf[tempIndex++] = setParamInfo.password[1];
	paramRecordBuf[tempIndex++] = setParamInfo.password[2];
	
	for( i = 0 ; i < 9 ; i++ )
	{
		if( i < EngineeringModeValue.hospitalNOQty )
		{
			setParamInfo.hospitalNO[i] = 0;
			paramRecordBuf[tempIndex++] = setParamInfo.hospitalNO[i];
		}
		else
		{
			paramRecordBuf[tempIndex++] = 0;
		}
	}
	
	for( i = 0 ; i < 3 ; i++ )
	{
		if( i < EngineeringModeValue.sickroomQty )
		{
			setParamInfo.sickroom[i] = 0;
			paramRecordBuf[tempIndex++] = setParamInfo.sickroom[i];
		}
		else
		{
			paramRecordBuf[tempIndex++] = 0;
		}
	}
	for( i = 0 ; i < 3 ; i++ )
	{
		if( i < EngineeringModeValue.bedNOQty )
		{
			setParamInfo.bedNO[i] = 0;
			paramRecordBuf[tempIndex++] = setParamInfo.bedNO[i];
		}
		else
		{
			paramRecordBuf[tempIndex++] = 0;
		}
	}
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.totalDose & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.totalDose & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.firstDose & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.firstDose & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.continueDose1 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.continueDose1 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.superaddition1 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.superaddition1 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.lockTime1 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.lockTime1 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.limitDose1 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 1 ;//(uint8_t)( setParamInfo.limitDose1 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.continueDose2 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.continueDose2 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.superaddition2 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.superaddition2 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.lockTime2 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.lockTime2 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.limitDose2 & 0xff00) >>8 );
	paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.limitDose2 & 0x00ff );
	
	paramRecordBuf[tempIndex++] = 3 ;//EngineeringModeValue.sickroomQty;
	paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.networkState;
	paramRecordBuf[tempIndex++] = 3 ;//EngineeringModeValue.bedNOQty;
	paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.evaluateState;
	paramRecordBuf[tempIndex++] = 1 ;//(uint8_t)( ( EngineeringModeValue.selfcontrol & 0xff00 ) >>8 );
	paramRecordBuf[tempIndex++] = 00;//(uint8_t)( EngineeringModeValue.selfcontrol & 0x00ff );
	paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.seachState;
	paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.hospitalNOQty;
	paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.passwordState;
	paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.deviceAlarm;
	paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.silenceState;
	paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.bubbleAlarm;
	paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.closedState;
	paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.automatic;
	paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.jamAlarm;
	paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.pressure_switch; //增加压力显示开关
	paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.test;			//新增测试开关
	
	for(; tempIndex < PARAMETER_DATA_BYTES ; tempIndex++ )
	{
		paramRecordBuf[tempIndex] = 0xff;
	}
	paramRecordBuf[126] = 0x0A;
 	FlashWriteOperate( paramRecordBuf,PARAMETER_DATA_BYTES,PARAMSET_DATA_START_ADDR );	
}
