/*************************** (C) COPYRIGHT 2017 CXHY ****************************
 * 文件名  ：device.c
 * 描  述  ：外部设备控制检测
 * 版  本  ：V1.0
 * 作  者  ：XuZhongPing
 * 日  期  ：2017/09/04
*********************************************************************************/
#include "deviceSet.h"
#include "device.h"
#include "usart1.h"
#include "usart2.h"
#include "delay.h"
#include "timer.h"
#include "data_typedef.h"	  
#include "tcp_protocol.h"
#include "lcd.h"  
#include "display.h"
#include "stmflash.h"
#include "qr_code.h"
#include "scale.h"


/*
***********************************************************************
*	函 数 名: ShowRecyclingType
*	功能说明: 显示回收箱类型
*	形    参：type -> 可回收物类型
*	返 回 值: 无
***********************************************************************
*/
void ShowRecyclingType(uint8_t type)
{
	switch(type)
	{
		case PAPER:
			printf("纸类");
			break;
			
		case PLASTIC:
			printf("塑料");
			break;
			
		case GLASS:
			printf("玻璃");
			break;
			
		case METAL:
			printf("金属");
			break;
			
		case RECYCLED:
			printf("可回收物");
			break;
			
		case KITCHEN:
			printf("厨余");
			break;
			
		case SMALL_BOTTLE:
			printf("小塑料瓶子");
			break;
			
		case BIG_BOTTLE:
			printf("大塑料瓶子");
			break;
			
		case CANS:
			printf("易拉罐");
			break;
			
		case BATTERY:
			printf("电池");
			break;
			
		case FABRIC:
			printf("织物");
			break;
			
		case BOOK:
			printf("书本");
			break;
			
		case NEWSPAPER:
			printf("报纸");
			break;
			
		case KITCHEN_1:
			printf("厨余1");
			break;
			
		case KITCHEN_2:
			printf("厨余2");
			break;
			
		case PLASTIC_2:
			printf("塑料2");
			break;
			
		case OTHER:
			printf("其它");
			break;
		
		case HARMFUL:
			printf("有害");
			break;
			
		case DRY_WASTES:
			printf("干垃圾");
			break;
			
		case WET_WASTES:
			printf("湿垃圾");
			break;
		
		default:
			printf("未知(%d)", type);
			break;
	}
}

/*
***********************************************************************
*	函 数 名: DeviceInfoShow
*	功能说明: 设备信息显示
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void DeviceInfoShow(void)
{
	printf("\r\n设备信息：\r\n");
	printf("------------\r\n");
	
	printf("软件%s\r\n", VersionStr);
	
	switch(deviceType)
	{
		case SINGLE_CLASSIFICATION:
			printf("设备类型: “一分类设备” (");
			ShowRecyclingType(devChannel1Type);
			printf(")\r\n");
			break;
			
		case DOUBLE_CLASSIFICATION:
			printf("设备类型: “两分类设备” (");
			ShowRecyclingType(devChannel1Type);
			printf("、");
			ShowRecyclingType(devChannel2Type);
			printf(")\r\n");
			break;
			
		case DOUBLE_CLASSIFICATION_BOTTLE:
			printf("设备类型: “两分类设备_含瓶类” (");
			ShowRecyclingType(devChannel1Type);
			printf("、");
			ShowRecyclingType(devChannel2Type);
			printf(")\r\n");
			break;
			
		case THREE_CLASSIFICATION:
			printf("设备类型: “三分类设备” (");
			ShowRecyclingType(devChannel1Type);
			printf("、");
			ShowRecyclingType(devChannel2Type);
			printf("、");
			ShowRecyclingType(devChannel3Type);
			printf(")\r\n");
			break;
			
		case FOUR_CLASSIFICATION:
			printf("设备类型: “四分类设备” (");
			ShowRecyclingType(devChannel1Type);
			printf("、");
			ShowRecyclingType(devChannel2Type);
			printf("、");
			ShowRecyclingType(devChannel3Type);
			printf("、");
			ShowRecyclingType(devChannel4Type);
			printf(")\r\n");
			break;
	}
	
	Screen_ShowDeviceInfo(VersionStr, devChannel1Type, devChannel2Type, devChannel3Type, devChannel4Type);

	printf("---------------------------\r\n");
}

/*
***********************************************************************
*	函 数 名: SetDefaultOverflowAlarmParam
*	功能说明: 设置满溢报警默认参数
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void SetDefaultOverflowAlarmParam(void)
{
	switch(deviceType)
	{
		case SINGLE_CLASSIFICATION:		//单分类
			break;
			
		case DOUBLE_CLASSIFICATION:		//两分类
			break;
			
		case DOUBLE_CLASSIFICATION_BOTTLE:		//两分类含瓶子
			break;
			
		default:
			break;
	}
	
// 	printf("\r\n设置默认满溢参数: h1 = %d; H1 = %d; A1 = %d; h2 = %d; H2 = %d; A2 = %d;\r\n", 
// 						setDistance_L_DepthVal, setDistance_L_MaxVal, setDistance_L_AlarmPercent,
// 						setDistance_R_DepthVal, setDistance_R_MaxVal, setDistance_R_AlarmPercent);
}

/*
***********************************************************************
*	函 数 名: DeviceSetParamInit
*	功能说明: 设备设置参数初始化
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void DeviceSetParamInit(void)
{	
	setDeviceType = deviceType;
	setDevChannelNumbers = devChannelNumbers;
	setDevChannel1Type = devChannel1Type;
	setDevChannel2Type = devChannel2Type;
	setDevChannel3Type = devChannel3Type;
	setDevChannel4Type = devChannel4Type;

	setPassword = password;																	//要设置的设备操作密码
	setCustomerID = customerID;															//客户号（用于控制谁可以打开收运清理门）

	setDevChannel1DisDepthVal = devChannel1DisDepthVal;
	setDevChannel1DisMaxVal = devChannel1DisMaxVal;
	setDevChannel1DisAlarmPercent = devChannel1DisAlarmPercent;

	setDevChannel2DisDepthVal = devChannel2DisDepthVal;
	setDevChannel2DisMaxVal = devChannel2DisMaxVal;
	setDevChannel2DisAlarmPercent = devChannel2DisAlarmPercent;
	
	setDevChannel3DisDepthVal = devChannel3DisDepthVal;
	setDevChannel3DisMaxVal = devChannel3DisMaxVal;
	setDevChannel3DisAlarmPercent = devChannel3DisAlarmPercent;
	
	setDevChannel4DisDepthVal = devChannel4DisDepthVal;
	setDevChannel4DisMaxVal = devChannel4DisMaxVal;
	setDevChannel4DisAlarmPercent = devChannel4DisAlarmPercent;
	
	setDisableICCardFunStatus = disableICCardFunStatus;				//设置“禁用IC卡用户”功能标志位
	setEnableCleanQRCodeStatus = enableCleanQRCodeStatus;			//设置“启用收运卡二维码开门”标志
	
	printf("\r\n设备设置参数初始化完成！！！\r\n");
	printf("\r\nSetParam:\r\n");
	printf("P=%d; ID=%d; DevType=%d; Cnt=%d\r\n",
						setPassword,
						setCustomerID,
						setDeviceType,
						setDevChannelNumbers);
					
	printf("T1=%d, h1=%d, H1=%d, A1=%d\r\n",
						setDevChannel1Type, setDevChannel1DisDepthVal, setDevChannel1DisMaxVal, setDevChannel1DisAlarmPercent);
						
	printf("T2=%d, h2=%d, H2=%d, A2=%d\r\n",
						setDevChannel2Type, setDevChannel2DisDepthVal, setDevChannel2DisMaxVal, setDevChannel2DisAlarmPercent);
		
	printf("T3=%d, h3=%d, H3=%d, A3=%d\r\n",
						setDevChannel3Type, setDevChannel3DisDepthVal, setDevChannel3DisMaxVal, setDevChannel3DisAlarmPercent);
						
	printf("T4=%d, h4=%d, H4=%d, A4=%d\r\n",
						setDevChannel4Type, setDevChannel4DisDepthVal, setDevChannel4DisMaxVal, setDevChannel4DisAlarmPercent);
					
	printf("ICE=%d, ICQR=%d\r\n", setDisableICCardFunStatus, setEnableCleanQRCodeStatus);
}

/*
***********************************************************************
*	函 数 名: DeviceParamInit
*	功能说明: 设备参数初始化
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void DeviceParamInit(void)
{	
	password = setPassword;
	customerID = setCustomerID;
	
	deviceType = setDeviceType;
	devChannelNumbers = setDevChannelNumbers;
	devChannel1Type = setDevChannel1Type;
	devChannel2Type = setDevChannel2Type;
	devChannel3Type = setDevChannel3Type;
	devChannel4Type = setDevChannel4Type;

#ifdef FOUR_DROP_PORTS
	deviceType = FOUR_CLASSIFICATION;
	devChannelNumbers = 4;
	setDeviceType = deviceType;
	setDevChannelNumbers = devChannelNumbers;
#endif
	
	devChannel1DisDepthVal = setDevChannel1DisDepthVal;
	devChannel1DisMaxVal = setDevChannel1DisMaxVal;
	devChannel1DisAlarmPercent = setDevChannel1DisAlarmPercent;
	
	devChannel2DisDepthVal = setDevChannel2DisDepthVal;
	devChannel2DisMaxVal = setDevChannel2DisMaxVal;
	devChannel2DisAlarmPercent = setDevChannel2DisAlarmPercent;
	
	devChannel3DisDepthVal = setDevChannel3DisDepthVal;
	devChannel3DisMaxVal = setDevChannel3DisMaxVal;
	devChannel3DisAlarmPercent = setDevChannel3DisAlarmPercent;
	
	devChannel4DisDepthVal = setDevChannel4DisDepthVal;
	devChannel4DisMaxVal = setDevChannel4DisMaxVal;
	devChannel4DisAlarmPercent = setDevChannel4DisAlarmPercent;
	
	disableICCardFunStatus = setDisableICCardFunStatus;
	enableCleanQRCodeStatus = setEnableCleanQRCodeStatus;
					
	printf("\r\nDevice Param Init OK！！！\r\n");
	printf("\r\nCurParam:\r\n");
	printf("P=%d; ID=%d; DevType=%d; Cnt=%d\r\n",
						password,
						customerID,
						deviceType,
						devChannelNumbers);
					
	printf("T1=%d, h1=%d, H1=%d, A1=%d\r\n",
						devChannel1Type, devChannel1DisDepthVal, devChannel1DisMaxVal, devChannel1DisAlarmPercent);
						
	printf("T2=%d, h2=%d, H2=%d, A2=%d\r\n",
						devChannel2Type, devChannel2DisDepthVal, devChannel2DisMaxVal, devChannel2DisAlarmPercent);
		
	printf("T3=%d, h3=%d, H3=%d, A3=%d\r\n",
						devChannel3Type, devChannel3DisDepthVal, devChannel3DisMaxVal, devChannel3DisAlarmPercent);
						
	printf("T4=%d, h4=%d, H4=%d, A4=%d\r\n",
						devChannel4Type, devChannel4DisDepthVal, devChannel4DisMaxVal, devChannel4DisAlarmPercent);
					
	printf("ICE=%d, ICQR=%d\r\n", disableICCardFunStatus, enableCleanQRCodeStatus);
}


//-----------------------------------------------------------------------------------
//通过二维码设置设备参数

/*
***********************************************************************
*	函 数 名: StrToInt
*	功能说明: 字符串转整型数据（带格式校验）
*	形    参：str -> 待转换的字符串
*	返 回 值: 转换后的整型数据，当格式不正确时返回0xFFFFFFFF
***********************************************************************
*/
uint32_t StrToInt(char *str)
{
	uint32_t res = 0xFFFFFFFF;
	
	if(strlen(str) < 10)		//要转换的内容长度小于10位数
	{
		if(strspn(str, "0123456789") == strlen(str))		//校验内容是不是都由数字组成
		{
			res = atoi(str);
		}else{
			res = 0xFFFFFFFF;
			printf("\r\n内容格式错误\r\n");
		}
	}
	return res;
}

/*
***********************************************************************
*	函 数 名: StrArrToIntArr
*	功能说明: 字符串数组转换成整形数组
*	形    参：strArr -> 待转换的字符串数组
						intArr -> 转换后的整形数组
						len -> 要转的数组长度
*	返 回 值: 转换成功返回1，失败返0
***********************************************************************
*/
uint8_t StrArrToIntArr(char strArr[][16], uint32_t intArr[], uint8_t len)
{
	uint8_t i = 0;
	uint32_t temp;
	
// 	printf("\r\nstrArr[i] = {", strArr[i]);
	for(i = 0; i < len; i++)
	{
// 		printf("%s, ", strArr[i]);
		temp = StrToInt(strArr[i]);										//将字符串转换成整型数据
		if(temp != 0xFFFFFFFF)
		{
			intArr[i] = temp;
		}else{
			printf("\r\nwrong format！\r\n");
			return 0;
		}
	}
// 	printf("}\r\n");
	
	return 1;
}

/*
***********************************************************************
*	函 数 名: StringSplit
*	功能说明: 字符串拆分
*	形    参：str -> 待处理字符串
*	返 回 值: 正常分离返回1，错误返回0
***********************************************************************
*/
uint8_t StringSplit(char *str)
{
	uint8_t res = 0;
	uint8_t i = 0;
	uint32_t temp = 0xFFFFFFFF;
	static uint8_t preSetParamCmd = 0;							//上一次的命令码
	char *token;
	
	memset(setParamList, 0x00, 16*16);
	
	//分解出各参数
	printf("\r\n分离参数！\r\n");

	setParamCount = 0;
	token = strtok(str, ",");
	while (token != NULL)
	{
// 		printf("\r\nparam%d %s\r\n", setParamCount, token);
		if(strlen(token) < 16)
		{
			strcpy(setParamList[setParamCount], token);
			token = strtok(NULL, ",");
			setParamCount++;
		}else{
			printf("\r\n参数分离出错！长度过长\r\n");
			return 0;
		}
	}
	
	printf("\r\nlen = %d, dataList: {", setParamCount);
	for(i = 0; i < setParamCount; i++)
	{
		printf("%s, ", setParamList[i]);
	}
	printf("}\r\n");
	
	//分解出命令码		
	temp = StrToInt(setParamList[0]);							//将字符串转换成整型数据
	if(temp != 0xFFFFFFFF)
	{
		setParamCmd = temp;													//保存参数设置指令码
		res = 1;
		printf("\r\ncmd = %d\r\n", setParamCmd);
		
		if((preSetParamCmd != setParamCmd) && (setParamCmd != 1))
		{
			if(setParamCmd != 1)
			{
				setParamChangeMark = 1;
				printf("\r\n指令有变化！\r\n");
			}
			preSetParamCmd = setParamCmd;
		}
	}else{
		res = 0;
		printf("\r\n命令错误\r\n");
	}
	
	return res;
}

/*
***********************************************************************
*	函 数 名: SetParamDecode
*	功能说明: 设置参数解码
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void SetParamDecode(uint8_t *pSetParamStr)
{
	uint32_t temp = 0xFFFFFFFF;
	char paramBuf[128];
	uint32_t intDataArr[16];
	uint8_t i = 0;
	uint8_t len = 0;
	uint8_t decodeOkMark = 0;
	
	char *p;
	char *pParam;
	char *token;
	
	p = (char*)strstr((const char*)pSetParamStr, ":");
	pParam = p+1;
	memset(paramBuf, 0x00, 128);
	strcpy(paramBuf, pParam);												//先备份设置的参数内容
	
	decodeOkMark = StringSplit(paramBuf);						//拆分出各参数
	
	//判断是否为正常的设置命令
	if(decodeOkMark == 1)
	{
		printf("\r\nsetCmd = %d\r\n", setParamCmd);
		switch(setParamCmd)
		{
			case 1:		//管理密码确认
				printf("\r\nSET --> 管理密码确认！\r\n");
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				
				temp = StrToInt(setParamList[1]);								//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getConfirmPassword = temp;									
					getConfirmPasswordMark = 1;										//标志已经取得待确认的密码
					printf("\r\n密码为：%d\r\n", getConfirmPassword);
				}else{
					getConfirmPasswordMark = 0;
					printf("\r\n确认密码内容格式错误\r\n");
					break;
				}
				break;
				
			case 2:		//密码修改
				printf("\r\nSET --> 密码修改！\r\n");
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				
				temp = StrToInt(setParamList[1]);													//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getPassword = temp;										
					getPasswordMark = 1;													//标志已经取得待确认的密码
					printf("\r\n密码为：%d\r\n", getPassword);
				}else{
					getPasswordMark = 0;
					printf("\r\n设置密码内容格式错误\r\n");
					break;
				}
				break;
				
			case 3:		//设备类型设置
				printf("\r\nSET --> 设备类型设置！\r\n");
				
				//设备类型
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				temp = StrToInt(setParamList[1]);										//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getDeviceType = temp;											
					printf("\r\n设备类型为：%d\r\n", getDeviceType);
				}else{
					getDeviceTypeMark = 0;
					printf("\r\n设置类型内容格式错误\r\n");
					break;
				}
				
				//投口通道数量
				printf("\r\nlist[2]：%s\r\n", setParamList[2]);
				temp = StrToInt(setParamList[2]);										//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getDevChannelNumbers = temp;											
					printf("\r\n设备投口通道数量为：%d\r\n", getDevChannelNumbers);
				}else{
					getDeviceTypeMark = 0;
					printf("\r\n设备投口通道数量内容格式错误\r\n");
					break;
				}
				
				temp = StrArrToIntArr(&setParamList[3], intDataArr, getDevChannelNumbers);
				if(temp == 1)
				{
					if(getDevChannelNumbers == 1)		//1分类
					{
						getDevChannel1Type = intDataArr[0];			
						getDeviceTypeMark = 1;											//单投口设备则标志解码成功
						printf("\r\n回收类型1：%d\r\n", getDevChannel1Type);
					}else if(getDevChannelNumbers == 2){		//2分类
						getDevChannel1Type = intDataArr[0];			
						getDevChannel2Type = intDataArr[1];			
						getDeviceTypeMark = 1;											//标志解码成功		
						printf("\r\n回收类型2：%d, %d\r\n", getDevChannel1Type, getDevChannel2Type);
					}else if(getDevChannelNumbers == 3){		//3分类
						getDevChannel1Type = intDataArr[0];			
						getDevChannel2Type = intDataArr[1];
						getDevChannel3Type = intDataArr[2];			
						getDeviceTypeMark = 1;											//标志解码成功		
						printf("\r\n回收类型3：%d, %d, %d\r\n", getDevChannel1Type, getDevChannel2Type, getDevChannel3Type);
					}else if(getDevChannelNumbers == 4){		//4分类
						getDevChannel1Type = intDataArr[0];
						getDevChannel2Type = intDataArr[1];
						getDevChannel3Type = intDataArr[2];
						getDevChannel4Type = intDataArr[3];			
						getDeviceTypeMark = 1;											//标志解码成功		
						printf("\r\n回收类型4：%d, %d, %d, %d\r\n", getDevChannel1Type, getDevChannel2Type, getDevChannel3Type, getDevChannel4Type);	
					}else{}
				}else{
					getDeviceTypeMark = 0;
					printf("\r\n设置回收类型内容格式错误\r\n");
					break;
				}
				break;
				
			case 4:		//设备客户号设置
				printf("\r\nSET --> 设备客户号设置！\r\n");
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				
				temp = StrToInt(setParamList[1]);									//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getCustomerID = temp;	
					getCustomerIDMark = 1;													//标志已经取得待确认的密码
					printf("\r\n客户号为：%d\r\n", getCustomerID);
				}else{
					getCustomerIDMark = 0;
					printf("\r\n设置客户号内容格式错误\r\n");
				}
				break;
				
			case 5:
				break;
				
			case 6:		//启用/停用“禁用的IC卡不能开门”功能设置
				printf("\r\nSET -->（禁用的IC卡不能开门）功能设置！\r\n");
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				
				temp = StrToInt(setParamList[1]);												//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getDisableICCardFunStatus = temp;	
					getDisableICCardFunMark = 1;													//标志已经取得待确认的密码
					printf("\r\n状态为：%d\r\n", getDisableICCardFunStatus);
					break;
				}else{
					getDisableICCardFunMark = 0;
					printf("\r\n设置（禁用的IC卡不能开门）内容格式错误\r\n");
					break;
				}
				break;
				
			case 7:		//启用/停用“收运二维码开门”功能设置
				printf("\r\nSET -->（收运二维码开门）功能设置！\r\n");
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				
				temp = StrToInt(setParamList[1]);												//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getEnableCleanQRCodeStatus = temp;	
					getEnableCleanQRCodeMark = 1;													//标志已经取得待确认的密码
					printf("\r\n状态为：%d\r\n", getEnableCleanQRCodeStatus);
					break;
				}else{
					getEnableCleanQRCodeMark = 0;
					printf("\r\n设置（收运二维码开门）内容格式错误\r\n");
					break;
				}
				break;
				
			case 13:		//满溢报警参数设置
				printf("\r\nSET -->（满溢参数）功能设置！\r\n");
				
				//投口通道数量
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				temp = StrToInt(setParamList[1]);										//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getDevChannelNumbers = temp;	
					printf("\r\n设备投口通道数量为：%d\r\n", getDevChannelNumbers);
				}else{
					getDeviceTypeMark = 0;
					printf("\r\n设备投口通道数量内容格式错误\r\n");
					break;
				}
				
				temp = StrArrToIntArr(&setParamList[2], intDataArr, getDevChannelNumbers*3);
				if(temp == 1)
				{
					if(getDevChannelNumbers == 1)		//1分类
					{
						getDevChannel1DisDepthVal = intDataArr[0];
						getDevChannel1DisMaxVal = intDataArr[1];
						getDevChannel1DisAlarmPercent = intDataArr[2];
						getOverflowSetMark = 1;											//单投口设备则标志解码成功
						printf("\r\nOF1: %d, %d, %d\r\n", getDevChannel1DisDepthVal, getDevChannel1DisMaxVal, getDevChannel1DisAlarmPercent);
					}else if(getDevChannelNumbers == 2){		//2分类
						getDevChannel1DisDepthVal = intDataArr[0];
						getDevChannel1DisMaxVal = intDataArr[1];
						getDevChannel1DisAlarmPercent = intDataArr[2];
						
						getDevChannel2DisDepthVal = intDataArr[3];
						getDevChannel2DisMaxVal = intDataArr[4];
						getDevChannel2DisAlarmPercent = intDataArr[5];
						
						getOverflowSetMark = 1;											//标志解码成功		
						printf("\r\nOF1: %d, %d, %d; OF2: %d, %d, %d\r\n", getDevChannel1DisDepthVal, getDevChannel1DisMaxVal, getDevChannel1DisAlarmPercent,
									getDevChannel2DisDepthVal, getDevChannel2DisMaxVal, getDevChannel2DisAlarmPercent);
					}else if(getDevChannelNumbers == 3){		//3分类
						getDevChannel1DisDepthVal = intDataArr[0];
						getDevChannel1DisMaxVal = intDataArr[1];
						getDevChannel1DisAlarmPercent = intDataArr[2];
						
						getDevChannel2DisDepthVal = intDataArr[3];
						getDevChannel2DisMaxVal = intDataArr[4];
						getDevChannel2DisAlarmPercent = intDataArr[5];
						
						getDevChannel3DisDepthVal = intDataArr[6];
						getDevChannel3DisMaxVal = intDataArr[7];
						getDevChannel3DisAlarmPercent = intDataArr[8];
						
						getOverflowSetMark = 1;											//标志解码成功		
						printf("\r\nOF1: %d, %d, %d; OF2: %d, %d, %d; OF3: %d, %d, %d\r\n", 
									getDevChannel1DisDepthVal, getDevChannel1DisMaxVal, getDevChannel1DisAlarmPercent,
									getDevChannel2DisDepthVal, getDevChannel2DisMaxVal, getDevChannel2DisAlarmPercent,
									getDevChannel3DisDepthVal, getDevChannel3DisMaxVal, getDevChannel3DisAlarmPercent);
					}else if(getDevChannelNumbers == 4){		//4分类
						getDevChannel1DisDepthVal = intDataArr[0];
						getDevChannel1DisMaxVal = intDataArr[1];
						getDevChannel1DisAlarmPercent = intDataArr[2];
						
						getDevChannel2DisDepthVal = intDataArr[3];
						getDevChannel2DisMaxVal = intDataArr[4];
						getDevChannel2DisAlarmPercent = intDataArr[5];
						
						getDevChannel3DisDepthVal = intDataArr[6];
						getDevChannel3DisMaxVal = intDataArr[7];
						getDevChannel3DisAlarmPercent = intDataArr[8];
						
						getDevChannel4DisDepthVal = intDataArr[9];
						getDevChannel4DisMaxVal = intDataArr[10];
						getDevChannel4DisAlarmPercent = intDataArr[11];
						
						getOverflowSetMark = 1;											//标志解码成功		
						printf("\r\nOF1: %d, %d, %d; OF2: %d, %d, %d; OF3: %d, %d, %d; OF4: %d, %d, %d\r\n", 
									getDevChannel1DisDepthVal, getDevChannel1DisMaxVal, getDevChannel1DisAlarmPercent,
									getDevChannel2DisDepthVal, getDevChannel2DisMaxVal, getDevChannel2DisAlarmPercent,
									getDevChannel3DisDepthVal, getDevChannel3DisMaxVal, getDevChannel3DisAlarmPercent,
									getDevChannel4DisDepthVal, getDevChannel4DisMaxVal, getDevChannel4DisAlarmPercent);	
					}else{}
				}else{
					getDeviceTypeMark = 0;
					printf("\r\n设置满溢参数内容格式错误\r\n");
					break;
				}
				break;
				
			case 30:		//称盘校准
				printf("\r\nSET --> 称盘校准！\r\n");
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				
				temp = StrToInt(setParamList[1]);									//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getScaleNum = temp;									
					getScaleCalibrationMark = 1;										//标志已经取得待确认的密码
					printf("\r\n称盘编号为：%d\r\n", getScaleNum);
				}else{
					getConfirmPasswordMark = 0;
					printf("\r\n校准称盘操作内容格式错误\r\n");
					break;
				}
				break;
				
			case 31:		//临时开收运清理门二维码
				printf("\r\nSET --> 临时开门！\r\n");
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				
				temp = StrToInt(setParamList[1]);								//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{							
					getBoxOpenMark = 1;										//标志已经取得待确认的密码
					printf("\r\n开门编号为：%d\r\n", getScaleNum);
				}else{
					getBoxOpenMark = 0;
					printf("\r\n临时开门操作内容格式错误\r\n");
					break;
				}
				break;
				
			case 56:		//密码强制修改
				printf("\r\nSET --> 密码强制修改！\r\n");
				printf("\r\nlist[1]：%s\r\n", setParamList[1]);
				
				temp = StrToInt(setParamList[1]);								//将字符串转换成整型数据
				if(temp != 0xFFFFFFFF)
				{
					getPassword = temp;										
					getForceChangeMark = 1;											//标志已经取得待确认的密码
					printf("\r\n密码为：%d\r\n", getPassword);
				}else{
					getForceChangeMark = 0;
					printf("\r\n强制设置密码内容格式错误\r\n");
					break;
				}
				break;
				
			case 100:		//设备参数恢复出厂设置
				printf("\r\nSET --> 设备参数恢复出厂设置！\r\n");
				getDeviceParamResetMark = 1;
				break;
				
			default:
				break;
		}
	}
}

/*
***********************************************************************
*	函 数 名: PasswordCheck
*	功能说明: 密码校验
*	形    参：无
*	返 回 值: 1：密码确认成功，0：密码未确认
***********************************************************************
*/
uint8_t PasswordCheck(void)
{
	uint8_t res = 0;
	
	if(getConfirmPasswordMark == 1)
	{
		getConfirmPasswordMark = 0;
		if(password == getConfirmPassword)
		{
			printf("\r\n密码校验正确！\r\n");
			res = 1;
		}else{
			printf("\r\n密码校验错误！\r\n");
			res = 0;
		}
	}
	return res;
}

/*
***********************************************************************
*	函 数 名: PasswordSetTask
*	功能说明: 密码修改设置任务
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void PasswordSetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getPasswordMark == 1)
			{
				getPasswordMark = 0;
				getConfirmPasswordMark = 0;
				setParamChangeMark = 0;
				setStep = 0x01;
			}
			break;
			
		case 0x01:
			if(getConfirmPasswordMark == 1)
			{
				getConfirmPasswordMark = 0;
				if(password == getConfirmPassword)
				{
					printf("\r\n密码校验正确！\r\n");
					setPassword = getPassword;
					printf("\r\n密码修改成功！\r\n");
					setParamSaveMark = 1;														//标志有参数进行了修改，需要进行保存
					setStep = 0x00;
					break;
				}else{
					printf("\r\n密码校验错误！\r\n");
					break;
				}
			}
			
			if(setParamChangeMark == 1)
			{
				setParamChangeMark = 0;
				setStep = 0x00;
				printf("\r\n参数设置命令有切换！！\r\n");
				break;
			}
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: PasswordCastSetTask
*	功能说明: 密码强制修改设置任务
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void PasswordCastSetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getForceChangeMark == 1)
			{
				getForceChangeMark = 0;
				setPassword = getPassword;
				setParamSaveMark = 1;														//标志有参数进行了修改，需要进行保存
				printf("\r\n密码强制修改成功！\r\n");
				setStep = 0x00;
			}
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: DeviceTypeSetTask
*	功能说明: 设备类型设置任务
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void DeviceTypeSetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getDeviceTypeMark == 1)
			{
				getDeviceTypeMark = 0;
				getConfirmPasswordMark = 0;
				setParamChangeMark = 0;
				printf("\r\n已取得类型，等待确认密码！\r\n");
				setStep = 0x01;
			}
			break;
			
		case 0x01:
			if(getConfirmPasswordMark == 1)
			{
				getConfirmPasswordMark = 0;
				if(password == getConfirmPassword)
				{
					printf("\r\n密码校验正确！\r\n");
					setDeviceType = getDeviceType;
					setDevChannelNumbers = getDevChannelNumbers;
					setDevChannel1Type = getDevChannel1Type;
					setDevChannel2Type = getDevChannel2Type;
					setDevChannel3Type = getDevChannel3Type;
					setDevChannel4Type = getDevChannel4Type;
// 					SetDefaultOverflowAlarmParam();									//当设备类型有变化时则要重新设置满溢报警参数
					setParamSaveMark = 1;														//标志有参数进行了修改，需要进行保存
					setStep = 0x00;
					break;
				}else{
					printf("\r\n密码校验错误！\r\n");
					break;
				}
			}
			
			if(setParamChangeMark == 1)
			{
				setParamChangeMark = 0;
				setStep = 0x00;
				printf("\r\n参数设置命令有切换！！\r\n");
				break;
			}
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: CustomerIdSetTask
*	功能说明: 设备客户号设置任务
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void CustomerIdSetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getCustomerIDMark == 1)
			{
				getCustomerIDMark = 0;
				getConfirmPasswordMark = 0;
				setParamChangeMark = 0;
				setStep = 0x01;
			}
			break;
			
		case 0x01:
			if(getConfirmPasswordMark == 1)
			{
				getConfirmPasswordMark = 0;
				if(password == getConfirmPassword)
				{
					printf("\r\n密码校验正确！\r\n");
					setCustomerID = getCustomerID;
					printf("\r\n客户号修改成功！\r\n");
					setParamSaveMark = 1;														//标志有参数进行了修改，需要进行保存
					setStep = 0x00;
					break;
				}else{
					printf("\r\n密码校验错误！\r\n");
					break;
				}
			}
			
			if(setParamChangeMark == 1)
			{
				setParamChangeMark = 0;
				setStep = 0x00;
				printf("\r\n参数设置命令有切换！！\r\n");
				break;
			}
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: DisableICCardFunSetTask
*	功能说明: 启用/停用“禁用的IC卡不能开门”功能设置
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void DisableICCardFunSetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getDisableICCardFunMark == 1)
			{
				getDisableICCardFunMark = 0;
				getConfirmPasswordMark = 0;
				setParamChangeMark = 0;
				setStep = 0x01;
			}
			break;
			
		case 0x01:
			if(getConfirmPasswordMark == 1)
			{
				getConfirmPasswordMark = 0;
				if(password == getConfirmPassword)
				{
					printf("\r\n密码校验正确！\r\n");
					setDisableICCardFunStatus = getDisableICCardFunStatus;
					printf("\r\n“禁用的IC卡不能开门”功能修改成功！\r\n");
					if(setDisableICCardFunStatus == 1)
					{
						printf("\r\n停用！\r\n");
					}else{
						printf("\r\n启用！\r\n");
					}
					setParamSaveMark = 1;														//标志有参数进行了修改，需要进行保存
					setStep = 0x00;
					break;
				}else{
					printf("\r\n密码校验错误！\r\n");
					break;
				}
			}
			
			if(setParamChangeMark == 1)
			{
				setParamChangeMark = 0;
				setStep = 0x00;
				printf("\r\n参数设置命令有切换！！\r\n");
				break;
			}
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: DisableICCardFunSetTask
*	功能说明: 启用/停用“收运二维码开门”功能设置
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void EnableCleanQRCodeSetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getEnableCleanQRCodeMark == 1)
			{
				getEnableCleanQRCodeMark = 0;
				getConfirmPasswordMark = 0;
				setParamChangeMark = 0;
				setStep = 0x01;
			}
			break;
			
		case 0x01:
			if(getConfirmPasswordMark == 1)
			{
				getConfirmPasswordMark = 0;
				if(password == getConfirmPassword)
				{
					printf("\r\n密码校验正确！\r\n");
					setEnableCleanQRCodeStatus = getEnableCleanQRCodeStatus;
					printf("\r\n“收运二维码开门”功能修改成功！\r\n");
					if(setEnableCleanQRCodeStatus == 1)
					{
						printf("\r\n启用！\r\n");
					}else{
						printf("\r\n停用！\r\n");
					}
					setParamSaveMark = 1;														//标志有参数进行了修改，需要进行保存
					setStep = 0x00;
					break;
				}else{
					printf("\r\n密码校验错误！\r\n");
					break;
				}
			}
			
			if(setParamChangeMark == 1)
			{
				setParamChangeMark = 0;
				setStep = 0x00;
				printf("\r\n参数设置命令有切换！！\r\n");
				break;
			}
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: OverflowSetTask
*	功能说明: 满溢参数设置任务
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void OverflowSetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getOverflowSetMark == 1)
			{
				getOverflowSetMark = 0;
				getConfirmPasswordMark = 0;
				setParamChangeMark = 0;
				printf("\r\n已取得类型，等待确认密码！\r\n");
				setStep = 0x01;
			}
			break;
			
		case 0x01:
			if(getConfirmPasswordMark == 1)
			{
				getConfirmPasswordMark = 0;
				if(password == getConfirmPassword)
				{
					printf("\r\n密码校验正确！\r\n");
					setDevChannel1DisDepthVal = getDevChannel1DisDepthVal;
					setDevChannel1DisMaxVal = getDevChannel1DisMaxVal;
					setDevChannel1DisAlarmPercent = getDevChannel1DisAlarmPercent;
					
					setDevChannel2DisDepthVal = getDevChannel2DisDepthVal;
					setDevChannel2DisMaxVal = getDevChannel2DisMaxVal;
					setDevChannel2DisAlarmPercent = getDevChannel2DisAlarmPercent;
					
					setDevChannel3DisDepthVal = getDevChannel3DisDepthVal;
					setDevChannel3DisMaxVal = getDevChannel3DisMaxVal;
					setDevChannel3DisAlarmPercent = getDevChannel3DisAlarmPercent;
					
					setDevChannel4DisDepthVal = getDevChannel4DisDepthVal;
					setDevChannel4DisMaxVal = getDevChannel4DisMaxVal;
					setDevChannel4DisAlarmPercent = getDevChannel4DisAlarmPercent;
					
// 					SetDefaultOverflowAlarmParam();									//当设备类型有变化时则要重新设置满溢报警参数
					setParamSaveMark = 1;														//标志有参数进行了修改，需要进行保存
					setStep = 0x00;
					break;
				}else{
					printf("\r\n密码校验错误！\r\n");
					break;
				}
			}
			
			if(setParamChangeMark == 1)
			{
				setParamChangeMark = 0;
				setStep = 0x00;
				printf("\r\n参数设置命令有切换！！\r\n");
				break;
			}
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: ScaleCalibrationTask
*	功能说明: 称盘校准任务
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void ScaleCalibrationTask(void)
{
	static uint8_t setStep = 0x00;
	static timer waitingTimer;
	static timer waitingTimer1S;
	static timer waitingExitTimer;
	
	static uint8_t timer_ok = 0;
	
	if(timer_ok == 0)
	{
		timer_ok = 1;
		timer_set(&waitingTimer, CLOCK_SECOND*3);
		timer_set(&waitingTimer1S, CLOCK_SECOND*1);
		timer_set(&waitingExitTimer, CLOCK_SECOND*20);
	}
	
	switch(setStep)
	{
		case 0x00:		//初始状态
			if(getScaleCalibrationMark == 1)
			{
				getScaleCalibrationMark = 0;
				getConfirmPasswordMark = 0;				//确认密码标志清零
				setParamChangeMark = 0;						//指令切换标志清零
				setStep = 0x01;
			}
			break;
			
		case 0x01:		//校验密码
			if(getConfirmPasswordMark == 1)
			{
				getConfirmPasswordMark = 0;
				if(password == getConfirmPassword)
				{
					printf("\r\n密码校验正确！\r\n");
					
					printf("\r\n开启称盘校准！\r\n");
					setStep = 0x02;
					break;
				}else{
					printf("\r\n密码校验错误！\r\n");
					break;
				}
			}
			
			if(setParamChangeMark == 1)
			{
				setParamChangeMark = 0;
				setStep = 0x00;
				printf("\r\n参数设置命令有切换！！\r\n");
				break;
			}
			break;
			
		case 0x02:		//正在启动进入校准
			Screen_ScaleCalibraEnter(getScaleNum);		//显示正在校准
			
			if(getScaleNum == 0)
			{
				if(deviceWorkStatus == 1)
				{
					Screen_Default();
				}else{
					Screen_DeviceDisable();
				}
				
				setStep = 0x00;
				break;
			}
			
			scaleNum = getScaleNum;
			getCalibraZeroMark1 = 0;
			getCalibraZeroMark2 = 0;
			
			beep_contSlowBeepMark = 1;
			M_S_CommandSend(0xA1);
			timer_restart(&waitingExitTimer);
			setStep = 0x03;
			break;
			
		case 0x3:		//等待称重模块回应取得零点			
			if(timer_expired(&waitingExitTimer))
			{
				printf("\r\n取得校准零点超时退出！\r\n");
				
				beep_contSlowBeepMark = 0;
				setStep = 0x10;
			}
			
			switch(getScaleNum)
			{
				case 1:		//称盘1
					if(getCalibraZeroMark1 == 1)
					{
						printf("\r\n收到称1校准零点！\r\n");
						Screen_ScaleCalibraStart(getScaleNum);
						getCalibraParamOkMark1 = 0;
						
						beep_contSlowBeepMark = 0;
						beep_contFastBeepMark = 1;
						
						timer_restart(&waitingExitTimer);
						setStep = 0x04;
						break;
					}
					break;
					
				case 2:		//称盘2
					if(getCalibraZeroMark2 == 1)
					{
						printf("\r\n收到称2校准零点！\r\n");
						Screen_ScaleCalibraStart(getScaleNum);
						getCalibraParamOkMark2 = 0;
						
						beep_contSlowBeepMark = 0;
						beep_contFastBeepMark = 1;
						
						timer_restart(&waitingExitTimer);
						setStep = 0x04;
						break;
					}
					break;
					
				default:
					setStep = 0x00;
					break;
			}
			break;
			
		case 0x04:		//等待校准完成
			if(timer_expired(&waitingExitTimer))
			{
				printf("\r\n取得校准零点超时退出！\r\n");
				
				beep_contFastBeepMark = 0;
				setStep = 0x10;
				break;
			}
			
			switch(getScaleNum)
			{
				case 1:		//称盘1
					if(getCalibraParamOkMark1 == 1)
					{
						printf("\r\n收到称1校准完成！\r\n");
						Screen_ScaleCalibraFinish(getScaleNum);
						
						beep_contFastBeepMark = 0;
						beep_longBeepMark = 1;
						timer_restart(&waitingTimer);
						setStep = 0x05;
						break;
					}
					break;
					
				case 2:		//称盘2
					if(getCalibraParamOkMark2 == 1)
					{
						printf("\r\n收到称2校准完成！\r\n");
						Screen_ScaleCalibraFinish(getScaleNum);
						
						beep_contFastBeepMark = 0;
						beep_longBeepMark = 1;
						timer_restart(&waitingTimer);
						setStep = 0x05;
						break;
					}
					break;
					
				default:
					setStep = 0x00;
					break;
			}
			break;
			
		case 0x05:		//退出
			if(timer_expired(&waitingTimer))
			{
				beep_contSlowBeepMark = 0;
				beep_contFastBeepMark = 0;
				
				if(deviceWorkStatus == 1)
				{
					Screen_Default();
				}else{
					Screen_DeviceDisable();
				}
				setStep = 0x00;
			}
			break;
			
		case 0x10:		//校准失败重启称重模块电源
//			ScalePowerOFF(1);
//			ScalePowerOFF(2);
			M_S_CommandSend(0xA5);
			timer_restart(&waitingTimer1S);
			setStep = 0x11;
			break;
			
		case 0x11:		//校准失败重启称重模块电源
			if(timer_expired(&waitingTimer1S))
			{
//				ScalePowerON(1);
//				ScalePowerON(2);
				setStep = 0x05;
			}
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: BoxOpenSetTask
*	功能说明: 临时打开收运清理门操作任务
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/

void BoxOpenSetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getBoxOpenMark == 1)
			{
				getBoxOpenMark = 0;
				boxOpenMark = 1;
				printf("\r\n准备打开收运门！\r\n");
				setStep = 0x00;
			}
			break;
			
		default:
			break;
	}
}

// void BoxOpenSetTask(void)
// {
// 	static uint8_t setStep = 0x00;
// 	
// 	switch(setStep)
// 	{
// 		case 0x00:
// 			if(getBoxOpenMark == 1)
// 			{
// 				getBoxOpenMark = 0;
// 				getConfirmPasswordMark = 0;
// 				setParamChangeMark = 0;
// 				setStep = 0x01;
// 			}
// 			break;
// 			
// 		case 0x01:
// 			if(getConfirmPasswordMark == 1)
// 			{
// 				getConfirmPasswordMark = 0;
// 				if(password == getConfirmPassword)
// 				{
// 					printf("\r\n密码校验正确！\r\n");
// 					boxOpenMark = 1;
// 					printf("\r\n准备打开收运门！\r\n");
// 					setStep = 0x00;
// 					break;
// 				}else{
// 					printf("\r\n密码校验错误！\r\n");
// 					break;
// 				}
// 			}
// 			
// 			if(setParamChangeMark == 1)
// 			{
// 				setParamChangeMark = 0;
// 				setStep = 0x00;
// 				printf("\r\n参数设置命令有切换！！\r\n");
// 				break;
// 			}
// 			break;
// 			
// 		default:
// 			break;
// 	}
// }

/*
***********************************************************************
*	函 数 名: DeviceParamResetTask
*	功能说明: 设备参数恢复出厂设置
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void DeviceParamResetTask(void)
{
	static uint8_t setStep = 0x00;
	
	switch(setStep)
	{
		case 0x00:
			if(getDeviceParamResetMark == 1)
			{
				getDeviceParamResetMark = 0;
				getConfirmPasswordMark = 0;
				setParamChangeMark = 0;
				setStep = 0x01;
			}
			break;
			
		case 0x01:
			if(PasswordCheck() == 1)
			{
				printf("\r\n开始恢复设备参数！\r\n");
				ResetDeviceConfig();
				beep_shortBeepMark = 1;
//				DeviceConfigParamInit();					//设备配置参数初始化
				
				
				getDeviceParamResetMark = 0;
				setStep = 0x10;
				break;
			}
			
			if(setParamChangeMark == 1)
			{
				setParamChangeMark = 0;
				
				getDeviceParamResetMark = 0;
				setStep = 0x00;
				printf("\r\n参数设置命令有切换！！\r\n");
				break;
			}
			break;
			
		case 0x10:
			while(1);													//参数恢复完成后重启系统
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: ParamSaveTask
*	功能说明: 设备参数保存任务（有参数修改确认，则需要进行保存）
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void ParamSaveTask(void)
{
	static uint8_t setStep = 0x00;
	
	static timer waitingTimer;
	
	static uint8_t timer_ok = 0;
	
	if(timer_ok == 0)
	{
		timer_ok = 1;
		timer_set(&waitingTimer, CLOCK_SECOND*2);			//创建1个定时器，用于电磁锁开启时间控制
	}
	
	switch(setStep)
	{
		case 0x00:
			if(setParamSaveMark == 1)
			{
				setParamSaveMark = 0;
					
				SaveDeviceConfig();
				DeviceParamInit();										//参数有变动，则重新初始化设备参数
				CalcOverflowStartPointParam();
				
				DeviceInfoShow();
				setStep = 0x01;
				timer_restart(&waitingTimer);
			}
			break;
			
		case 0x01:
			if(timer_expired(&waitingTimer))
			{
				if(deviceWorkStatus == 1)
				{
					Screen_Default();
				}else{
					Screen_DeviceDisable();
				}
				setStep = 0x00;
			}
			break;
			
		case 0x02:
			break;
			
		default:
			break;
	}
}

/*
***********************************************************************
*	函 数 名: ParamSetTask
*	功能说明: 参数设置任务
*	形    参：无
*	返 回 值: 无
***********************************************************************
*/
void ParamSetTask(void)
{
	if(devSetQrCodeState == 1)
	{
		printf("\r\n进入参数设置操作---->\r\n");
		devSetQrCodeState = 0;
		SetParamDecode(codeBuf);									//设置二维码参数解码
	}
	
	PasswordSetTask();												//密码修改任务
	PasswordCastSetTask();										//强制修改密码任务
	DeviceTypeSetTask();											//设备类型设置任务
	CustomerIdSetTask();											//客户号设置任务
	
	DisableICCardFunSetTask();								//启用/停用“禁用的IC卡不能开门”功能设置任务
	EnableCleanQRCodeSetTask();								//启用/停用“收运二维码开门”功能设置任务
	
	OverflowSetTask();												//满溢参数设置任务
	
	ScaleCalibrationTask();										//称盘校准操作任务
	BoxOpenSetTask();													//临时打开收运清理门操作任务
	
	DeviceParamResetTask();										//设备参数恢复出厂设置任务
	
	ParamSaveTask();													//设备参数保存任务
}


/******************** (C) COPYRIGHT 2017 CXHY *****END OF FILE*******************/
