aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Manifests/release.xml
blob: d72e750117387f9bf64d36f2a24d6385adb955f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
             If you want to change the Windows User Account Control level replace the 
             requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel element will disable file and registry virtualization. 
            Remove this element if your application requires this virtualization for backwards
            compatibility.
        -->
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>

  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- A list of the Windows versions that this application has been tested on
           and is designed to work with. Uncomment the appropriate elements
           and Windows will automatically select the most compatible environment. -->

      <!-- Windows Vista -->
      <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->

      <!-- Windows 7 -->
      <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->

      <!-- Windows 8 -->
      <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->

      <!-- Windows 8.1 -->
      <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->

      <!-- Windows 10 -->
      <!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->

    </application>
  </compatibility>

  <!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
       DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need 
       to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should 
       also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
  <!--
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
    </windowsSettings>
  </application>
  -->

  <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
  <!--
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>
  -->

</assembly>
using System;
using System.Text;
using System.IO;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs;

public void OnExecute(StubManager stubManager)
{
string  path="";
		Form form1 = new Form();
	Motor_SetParam(F1_MOTO_RLOADING_TX1,F1_MOTO_RLOADING_TX0,0x0a,0x14000000);							//set kval ran to 0x14,0.65A
		
// Set the caption bar text of the form.
		form1.TopMost = true;
		form1.Text = "RTFU Test";
  		form1.FormBorderStyle = FormBorderStyle.FixedDialog;
 		form1.MaximizeBox = false;
		form1.MinimizeBox = false;
 		form1.StartPosition = FormStartPosition.CenterScreen;
	    form1.AutoSize = true;
	    form1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
// Create buttons to Run. 
 		Button button1 = new Button () 
	{
		Width = 100,
   	  	Height = 100,
  	};
		button1.Text = "Run";
		button1.Location = new Point (40, 100);
	    form1.Controls.Add(button1);
//-----RTFU Serial Number -----------

	Label Label1 = new Label () 
		{
		Width = 150,
   	  	Height = 20,
   	  	Text ="  RTFU S/N"
  		};
	Label1.Location = new Point (30, 10);
 	form1.Controls.Add(Label1);
	TextBox TextBox1 = new TextBox () 
		{
		Width = 100,
   	  	Height = 10,
   	  	Text =""
  		};
	TextBox1.Location = new Point (40, 40);
	form1.Controls.Add(TextBox1);
 //----------LOCATION----------
	 
 Label Label3 = new Label () 
	{
		Width = 150,
   	  	Height = 20,
   	  	Text ="LOCATION"
  	};
Label3.Location = new Point (350, 10);
 form1.Controls.Add(Label3);
	 


TextBox TextBox3 = new TextBox () 
	{
		Width = 100,
   	  	Height = 10,
   	  	Text =""
  	};
TextBox3.Location = new Point (360, 40);
 form1.Controls.Add(TextBox3);
 
 
 	 
	 
	Label Label5 = new Label () 
	{
		Width = 120,
   	  	Height =100,
   	  	Text = ""
  	}; 
	Label5.Location = new Point (300, 100);
	Label5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;

	Label5.Text="";
	Label5.Font = new Font("Arial", 24,FontStyle.Bold);
	form1.Controls.Add(Label5); 	


 
 
//--------------------------------------------------------------------------------

	    stubManager.Write("Counter is 2 \n");
  
	    button1.Click += (_,__) => 
	    
	{ 

		Label5.Text="Pros";
	
	if (!Directory.Exists(path1))
		{
			path=path2;	
			if (!Directory.Exists(path2))
			Directory.CreateDirectory(path2);	
		}			
	else
		path=path1;	

	File_Name1=path + TextBox1.Text +"_RTFU_" + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss")+".log" ;


	stubManager.Write(File_Name1 +"\n");
	stubManager.WriteToFile(File_Name1,DateTime.Now +" " );
	stubManager.Write(DateTime.Now +"\n" );

	stubManager.AppendToFile(File_Name1,"RTFU Test Report" );
	stubManager.Write("RTFU Test Report\n" );

	stubManager.AppendToFile(File_Name1,"RTFU S/N: \t" + TextBox1.Text  );
	stubManager.Write("RTFU S/N:" + TextBox1.Text +"\n" );
                  

	stubManager.AppendToFile(File_Name1,"Location:\t" + TextBox3.Text );
	stubManager.Write("Location:" + TextBox3.Text +"\n" );


//------------------------------- start test -----------
	Test_RLOADING_RTFU();
	stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3);					//hold Rloading high z
	Thread.Sleep(100);
	Motor_SetParam(F1_MOTO_RLOADING_TX1,F1_MOTO_RLOADING_TX0,0x0a,0x14000000);							//set kval ran to 0x14,0.65A

	Test_RDRIVING_RTFU();
	Test_DANCER_RTFU();
	stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RDANCER_Motor, 3);					//hold Rloading high z

	Status=write_to_file();
		stubManager.Write(Status +"\n");	

	Label5.Text=Status;
	TextBox1.Text="";
	};	   
	   
	   form1.ShowDialog();
	
	return ;
   }
 //------------------------------------  
int Test_RLOADING_RTFU()
{
	int	temp=1; 
	int counter;
	
	Motor_SetParam(F1_MOTO_RLOADING_TX1,F1_MOTO_RLOADING_TX0,0x0a,0x2c000000);							//set kval ran to 0x2c- 1.3A
	Thread.Sleep(100);
	stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,200);				//move Rloading down
	Thread.Sleep(3000);
	stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3);					//hold Rloading high z
	Thread.Sleep(1000);
//------------------------------------------ check  F1_LS_RLOADMOTOR_up------------------------------------------------

	var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);	//read LS
	if ((response.Value & F1_LS_RLOADMOTOR_UP) !=F1_LS_RLOADMOTOR_UP )									//if LS_RLOADMOTOR_UP is up then error
	{	
		DialogResult result = MessageBox.Show("Did RLOADIN MOTOR Move?", "Warning",MessageBoxButtons.YesNo);
	if(result == DialogResult.Yes)
		{
		Units_status[0,1]="Fail";
		stubManager.Write("LS_RLOADMOTOR_UP\tFail\n");	
		return 0;
		}
	else 
		{
			Units_status[2,1]="Fail";
			stubManager.Write("RLOADMOTOR\tFail\n");
			return 0;
		}
	}
	
//----------------------------------------- mov RLOADING up -------------------------------------------------
	stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor,false,200);				//move Rloading up
	counter =0;
	while ( counter < 150)
	{
		counter = counter + 1;
		response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);	//if LS_RLOADMOTOR_UP is up then move down
		if ((response.Value & F1_LS_RLOADMOTOR_UP) != F1_LS_RLOADMOTOR_UP  )
			counter=250;
		
			Thread.Sleep(100);	
	}
		stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3);					//hold Rloading high z

	if (counter == 150) 								
	{	
		Units_status[0,1]="Fail";
		stubManager.Write("LS_RLOADMOTOR_UP\tFail\n");	
		return 0;
	}
	DialogResult result1 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo);
	if(result1 == DialogResult.No)
		{
			Units_status[0,1]="Fail";
			stubManager.Write("LS_RLOADMOTOR_UP Not calibrate\n");
			return 0;
		}
	Units_status[0,1]="Pass";
	Units_status[2,1]="Pass";
	
//------------------------------------------ check  F1_LS_RLOADMOTOR_DN------------------------------------------------
		
		response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);		//read LS
	
	if ((response.Value & F1_LS_RLOADMOTOR_DN) !=F1_LS_RLOADMOTOR_DN )										//if LS_RLOADMOTOR_DN is up then error
	{	
		Units_status[1,1]="Fail";
		stubManager.Write("LS_RLOADMOTOR_DN\tFail\n");
		return 0;
	}
//------------------------------------------ mov RLOADING dn ------------------------------------------------

	stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,200);				//move Rloading down
	counter =0;
	while ( counter < 150)
	{
		counter = counter + 1;
		response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);	//if LS_RLOADMOTOR_UP is up then move down
		if ((response.Value & F1_LS_RLOADMOTOR_DN) != F1_LS_RLOADMOTOR_DN  )
			counter=250;	
			
			Thread.Sleep(100);	
	}
	
		if (counter == 150) 								
	{	
		Units_status[1,1]="Fail";
		stubManager.Write("LS_RLOADMOTOR_DN\tFail\n");	
		return 0;
	}
		stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3);					//hold Rloading high z
		
	DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo);
	if(result2 == DialogResult.No)
		{
			Units_status[1,1]="Fail";
			stubManager.Write("LS_RLOADMOTOR_DN Not calibrate\n");
			return 0;
		}
	Units_status[1,1]="Pass";
		stubManager.Write("RLOADMOTOR\tPass\n");
	
		stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,200);				//move Rloading down
			Thread.Sleep(2000);	
		stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3);					//hold Rloading high z

	return 1 ;

}	

//----------------------------------

Int32 ReadEncoder()
{
	Int32 temp;
	stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_RDANCER_ROTENC_DATA_p_TX, 0x0000);		//triggers a TX transmission

	var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_RDANCER_ROTENC_DATA_p_RX_lsb);
	var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_RDANCER_ROTENC_DATA_p_RX_msb);		 

	temp =  Convert.ToInt32 (((((response1.Value <<16) + 	response.Value)>>10 ) & 0x3fff));
	

	return temp;
}
//--------------------------------------------------------------------------------
int Test_DANCER_RTFU()
{
	int counter;
	Int32 temp;
	Int32 temp1;
	
//------------------------------------------ check  F1_LS_RDANCER_DOWN  ------------------------------------------------

	MessageBox.Show("Make sure RDANCER Doun");
	var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);	//read LS
	if ((response.Value & F1_LS_RDANCER_DOWN) !=F1_LS_RDANCER_DOWN )								//if F1_LS_RDANCER_DOWN is up then error
	{	
		Units_status[4,1]="Fail";
		stubManager.Write("LS_RDANCER_DOWN\tFail\n");	
		return 0;
	}
//----------------------------------------- mov RDANCER_Motor up and check F1_LS_RDANCER_DOWN -------------------------------------------------
	stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RDANCER_Motor,true,10);				//move Rloading up
	counter =0;
	while ( counter < 150)
	{
		counter = counter + 1;
		response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);	//if LS_RLOADMOTOR_UP is up then move down
		if ((response.Value & F1_LS_RDANCER_DOWN) != F1_LS_RDANCER_DOWN  )
			counter=250;
		
			Thread.Sleep(100);	
	}
		if (counter == 150) 								
	{	
		Units_status[4,1]="Fail";
		stubManager.Write("LS_RDANCER_DOWN\tFail\n");	
		return 0;
	}
		Units_status[4,1]="Pass";
		stubManager.Write("LS_RDANCER_DOWN\tPass\n");	
	
//----------------------------------------- check F1_LS_RDANCER_UP -------------------------------------------------

	if ((response.Value & F1_LS_RDANCER_UP) !=F1_LS_RDANCER_UP )								//if F1_LS_RDANCER_UP is up then error
	{	
		Units_status[5,1]="Fail";
		stubManager.Write("LS_RDANCER_UP\tFail\n");	
		return 0;
	}
	counter =0;
	while ( counter < 150)
	{
		counter = counter + 1;
		response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);	//if F1_LS_RDANCER_UP is up then move down
		if ((response.Value & F1_LS_RDANCER_UP) != F1_LS_RDANCER_UP  )
			counter=250;
		
			Thread.Sleep(100);	
	}
		if (counter == 150) 								
	{	
		Units_status[5,1]="Fail";
		stubManager.Write("LS_RDANCER_UP\tFail\n");	
		return 0;
	}
		Units_status[5,1]="Pass";
		stubManager.Write("LS_RDANCER_UP\tPass\n");	

//----------------------------------------- check F1_LS_RLOADRAM_DOWN -------------------------------------------------

	if ((response.Value & F1_LS_RLOADRAM_DOWN) !=F1_LS_RLOADRAM_DOWN )								//if F1_LS_RLOADRAM_DOWN is up then error
	{	
		Units_status[6,1]="Fail";
		stubManager.Write("LS_RLOADRAM_DOWN\tFail\n");	
		return 0;
	}
	counter =0;
	while ( counter < 150)
	{
		counter = counter + 1;
		response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);	//if F1_LS_RLOADRAM_DOWN is up then move down
		if ((response.Value & F1_LS_RLOADRAM_DOWN) != F1_LS_RLOADRAM_DOWN  )
			counter=250;
		
			Thread.Sleep(100);	
	}
		if (counter == 150) 								
	{	
		Units_status[6,1]="Fail";
		stubManager.Write("LS_RLOADRAM_DOWN\tFail\n");	
		return 0;
	}
	Units_status[6,1]="Pass";
	stubManager.Write("LS_RLOADRAM_DOWN\tPass\n");	

//----------------------------------------- mov RDANCER_Motor down and check rdancer encoder -------------------------------------------------
	temp= ReadEncoder();
	
	stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RDANCER_Motor,false,10);				//move Rloading down
	counter =0;
	while ( counter < 150)
	{
		counter = counter + 1;
		response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct);	//if LS_RLOADMOTOR_UP is up then move down
		if ((response.Value & F1_LS_RDANCER_DOWN) != F1_LS_RDANCER_DOWN  )
			counter=250;
		
			Thread.Sleep(100);	
	}
		if (counter == 150) 								
	{	
		Units_status[4,1]="Fail";
		stubManager.Write("LS_RDANCER_DOWN\tFail\n");	
		return 0;
	}
	Units_status[7,1]="Pass";
	stubManager.Write("RDANCER_Motor\tPass\n");	

	temp1= ReadEncoder();
	stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RDANCER_Motor, 3);					//hold Rloading high z

	stubManager.Write("temp="+temp + "\temp1="+temp1 +"\n");
		
	DialogResult result = MessageBox.Show("SSI Dancer led is Green(not blinking)?", "Warning",MessageBoxButtons.YesNo);
	if(result == DialogResult.No)
		{
			Units_status[8,1]="Fail";
			stubManager.Write("RDANCER_SSI\tFail\n");	
			return 0;
		}

	if (temp>temp1)
		temp1=temp1+0x4000;

	temp1=temp1-temp;			
	if ((temp1> 15000) || (temp1 <1000))
		{
			Units_status[8,1]="Fail";
			stubManager.Write("RDANCER_SSI\tFail\n");	
			return 0;
		}
	Units_status[8,1]="Pass";
		stubManager.Write("RDANCER_SSI\tPass\n");	
	
	return 1;
}


//-------------------------------------------------------------
int Test_RDRIVING_RTFU()
{	
	stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RDRIVING_Motor, true,200);				//move Rdriving clockwise 
	stubManager.Write("RDRIVING_Motor Motor rotate \n ");
	
	DialogResult result = MessageBox.Show("Are RDRIVING Motor rotate?", "Warning",MessageBoxButtons.YesNo);
	if(result == DialogResult.No)
		{
			Units_status[3,1]="Fail";
			stubManager.Write("RDRIVING Motor not rotate\n");
		}
	else 
		{
			Units_status[3,1]="Pass";
			stubManager.Write("RDRIVING Motor rotate\n");
		}
		stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RDRIVING_Motor,3);		//stop motor

	return 0;
}	



//--------------------------------------------------------------------------------
int Motor_SetParam(Int32 HighAdr, Int32 LowAdr, Int32 ParaAddr, uint ParaData1)
{
	
	Int32 Temp = 0;
	Temp = (ParaAddr << 8 ) + ( (Int32) ParaData1 >> 24);

	stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,HighAdr, (Temp & 0xffff));
	Temp = ((Int32)ParaData1 >> 8) & 0xffff;
	stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,LowAdr, (Temp));
		
	return 1;
}
 //------------------------------------  
string write_to_file() 
{	
	    stubManager.Write("write_to_file\n");
	
string Stemp="Pass";
		for (int i=0;i<UNIT_UNDER_TEST;i++)
		{
			stubManager.AppendToFile(File_Name1,Units_status[i,0]+"\t" + Units_status[i,1] );
			stubManager.Write(Units_status[i,0]+"\t" + Units_status[i,1]+"\n" );

			if ((Units_status[i,1]=="Fail")||(Units_status[i,1]=="Not Test"))
			Stemp="Fail";
		}
		if (Stemp=="Fail")
			{
			stubManager.AppendToFile(File_Name1,"-------------RTFU  Fail ------------ ");
			stubManager.Write("-------------RTFU Fail ------------ ");
			}
		else
			{
			stubManager.AppendToFile(File_Name1,"-------------RTFU Pass ------------ )");
			stubManager.Write("-------------RTFU Pass ------------ ");
			}
			
	return Stemp;
	
}