Test.c 4.74 KB
#include "hardware.h"
#include "all_value.h"



/*********************************************************************************
函数名:
功能:
参数:
返回:无返回。
实现方法:
编程:pcy
日期:2021-12-16
*********************************************************************************/

void Test_Pro(void)//
{	

									
	switch(AGV.Test_Step)
	{	
		case 0:	//先判断启动信号
						if (VaIndexDW_R(&Touch_Contr,7))							
						{
								switch(SysKey)
								{	
									case 2003:AGV.Test_Step=1;break;//1-2进行升降到特定高度测试										
									case 2004:AGV.Test_Step=10;break;//10-19进行连续升降测试

									case 2007:AGV.Test_Step=20;break;//20-39进行CCD旋转测试	
									case 2008:AGV.Test_Step=40;break;//40-59进行Slam旋转测试	
									default:
												if(SysKey>2009&&SysKey<2018)AGV.Test_Step=60;break;								
								}
						}						
						break;
		/*单次升/降测试*/						
		case 1:	//升													
						AGV.UpDown_Step=1;
						AGV.Type3_Ac=4;
						F_Un.Dis_Height_T=(float)Touch_Dis;
						AGV.Test_Step++;						
						break;		
		case 2:	//												
						if (AGV.UpDown_Step==100)AGV.Test_Step=0;	
						break;

		/*持续升降测试测试*/			
		case 10:	//升													
						AGV.UpDown_Step=1;
						AGV.Type3_Ac=2;
						AGV.Test_Step++;						
						break;		
		case 11:	//												
						if (AGV.UpDown_Step==100){AGV.Test_Step++;	Tim7_TaskDelayNums=0;	}	
						break;		
		case 12:	//降													
						if (Tim7_TaskDelayNums>0)							
						{						
							AGV.UpDown_Step=1;
							AGV.Type3_Ac=3;
							AGV.Test_Step++;	
						}							
						break;						
		case 13:	//降													
						if (AGV.UpDown_Step==100)							
						{						
							AGV.Test_Step++;	
						}							
						break;
		case 14:	//
						if( VaIndexDW_R(&Touch_Contr,17) ) { AGV.Test_Step++;	Tim7_TaskDelayNums=0;}						
						else 	AGV.Test_Step=0;							
						break;	
		case 15:	//
						if (Tim7_TaskDelayNums>1)	AGV.Test_Step=10;													
						break;
		
		/*CCD旋转对中持续测试*/
		case 20:	//CCD对中												
						AGV.Load_Step=1;
						AGV.Type2_AdLev=12;
						AGV.Test_Step++;	
						break;		
		case 21:	//
						if (AGV.Load_Step==100)AGV.Test_Step++;
						break;
		case 22:	//
						F_Un.A_CCD_T=0;
						Tim7_TaskDelayNums=0;
						AGV.Test_Step++;	
						break;
		case 23:	//
						if (Tim7_TaskDelayNums>0){AGV.RotationCCD_Step=1;AGV.Test_Step++;}						
						break;		
		case 24:	//
						if (AGV.RotationCCD_Step==100)AGV.Test_Step++;						
						break;		
		case 25:	//
						if(F_Un.A_CCD_T>=270)
						{ if( VaIndexDW_R(&Touch_Contr,17) )AGV.Test_Step=20;
							else AGV.Test_Step=0;}
						else 
						{ F_Un.A_CCD_T+=90;
							Tim7_TaskDelayNums=0;
							AGV.Test_Step=23;}				
						break;
		/*SLAM旋转持续测试*/
		case 40:	//												
						AGV.Test_Step=42;	
						break;		
		case 42:	//
						F_Un.A_Slam_T=0;
						Tim7_TaskDelayNums=0;
						AGV.Test_Step++;	
						break;
		case 43:	//
						if (Tim7_TaskDelayNums>0)
						{ AGV.RotationSlam_Step=1;
							Ang_MaxDelta=100;
							AGV.Test_Step++;}						
						break;		
		case 44:	//
						if (AGV.RotationSlam_Step==100)AGV.Test_Step++;						
						break;		
		case 45:	//
						if(F_Un.A_Slam_T>=270)
						{ if( VaIndexDW_R(&Touch_Contr,17) )AGV.Test_Step=40;
							else AGV.Test_Step=0;}
						else 
						{ F_Un.A_Slam_T+=90;
							Tim7_TaskDelayNums=0;
							AGV.Test_Step=43;}				
						break;						
						
			/*输送功能测试*/
		case 60:	//
						Unionu8_1.ConyUpTy=0;
						Unionu8_2.ConyDownTy=0;		
						if(Touch_Dis<25)//输送负速度方向与对接工位同向,即AGV的左侧或前侧对接测试
						{ 
							if(SysKey==2010)Unionu8_1.ConyUpTy=4;//10->单层动作:AGV上层接料;
							else if(SysKey==2011)Unionu8_1.ConyUpTy=1;//11->单层动作:AGV上层卸料;
							else if(SysKey==2012)Unionu8_2.ConyDownTy=4;//12->单层动作:AGV下层接料;
							else if(SysKey==2013)Unionu8_2.ConyDownTy=1;//13->单层动作:AGV下层卸料;
						}
						else//输送正速度方向与对接工位同向,即AGV的右侧或后侧对接测试
						{
							if(SysKey==2010)Unionu8_1.ConyUpTy=2;//10->单层动作:AGV上层接料;
							else if(SysKey==2011)Unionu8_1.ConyUpTy=3;//11->单层动作:AGV上层卸料;
							else if(SysKey==2012)Unionu8_2.ConyDownTy=2;//12->单层动作:AGV下层接料;
							else if(SysKey==2013)Unionu8_2.ConyDownTy=3;//13->单层动作:AGV下层卸料;
						}
						AGV.Conveyor_Step=4;
						AGV.Test_Step++;	
						break;
		case 61:	//
						if (AGV.Conveyor_Step==100)AGV.Test_Step++;						
						break;	
		case 62:	//
						AGV.Test_Step=0;						
						break;			
	}			
}

void Action_Fc(u8 Ty)//200-对中;201-升到顶;202-降到底;
{
	switch(Ty)
	{	
		case 200:	//对中
						AGV.Load_Step=1;AGV.Type2_AdLev=12;
						break;
		case 201:	//升到顶
						AGV.UpDown_Step=1;AGV.Type3_Ac=2;
						break;
		case 202:	//降到底
						AGV.UpDown_Step=1;AGV.Type3_Ac=3;
						break;
	}		
}